知识库管理系统
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
XX学院信息科学与工程学院数据结构课程设计
题目:知识库管理系统
学生姓名:
学号:
专业:计算机科学与技术
班级:XX级(X)班
指导教师姓名及职称:
起止时间:20** 年3 月——20** 年6 月
一、需求分析
1.1课题背景及意义
知识库管理系统软件将来自工作中、生活中、培训中、组织内的各类资料和领域知识进行管理维护并提供关联分析和综合查询服务。
系统是一个b/s结构的底层服务软件,其中的服务端均部署在服务器上后台运行,并提供配置web管理界面,以达到知识辅助管理的目的。
1.2课题要求
知识库管理系统包括文件集中存储上传、文档链接、关联文档、规则使用、智能检索等主要功能。
文件集中存储上传:支持文件的批量上传及压缩包导入,支持Office文档、PDF、图像、音视频和图纸等各类型文件。
文档链接:支持将文档发送至常用文档,用户无需每次在打开各个目录中查找;支持将文档发送至目录,方便其他用户查阅;
关联文档:文档新建或上传后,系统会自动或手动为文件生成唯一编号,支持文档的批量关联。
支持通过文件唯一编号,实现文档与相关文档、图纸、图片及其它格式附件进行关联,点击链接即可一键快速查看。
系统支持为图片、音、视频类文件增加摘要及缩略图。
规则使用:系统支持为文件设定规则,指定动作(组合)、条件和操作,当动作触发符合设定的条件,系统则自动执行规则的操作。
智能检索:快速从海量资料中精准检索所需文件,可根据依据文件类型、文件关键信息、时间等,也可在完成检索操作后对信息进行接受、判断、提取、分析和概括之后形成自己的知识,然后保存,成为下一次分析、概括的依据和基础。
可以直接在系统中预览各类格式的图片、播放视频、音频以及浏览各类Office文件,包括Word、Excel、PowerPoint、WPS、Visio等格式
.
1.3设计目标
(1)名称:知识库管理系统
(2)Web主页:
(3)开发工具、搭建环境:visual studio 2015,windows server 2012R,sql server 2008。
(4)运行环境:IE,chrome,firefox,opera
(5)Web特点:
1.图形化且易于导航,具有同一页可以显示丰富的色彩,图形和文本的功能。
2.提供将图形,音频,视频信息集合于一体的特征。
3.与平台无关,无论什么系统,只要通过Internet访问www。
4. Web是分布式的,使在物理上并不一定在一个站点的信息在逻辑上一体化,从用户来看
这些信息是一体的。
5. Web是动态的,经常更新内容信息。
6. Web是交互的,主要表现在超链接,另外通过FORM的形式可以从服务器
方获得动态的信息。
用户通过填写FORM可以向服务器提交请求,服务器可
以根据用户的请求返回相应信息。
(6)功能:文件上传,文件检索,文件下载,系统简介
二、概要设计
2.1 问题解决的思路概述
首先是确定了系统设计的流程图,选定较成熟的bootstrap sql server技术进行开发,利用已经存在的数据结构和函数方法来构造系统的结构,接着把系统实现分为3个步骤:数据库的设计,前台页面的设计,后台程序逻辑的设计。
2.2 前端界面介绍说明
前端界面运用的目前很成熟的bootstrap框架,可以快速搭建系统的前端页面。
该系统总共有7个页面(index.html about.html viewer.html lib_flieList.aspx lib_upload.aspx login.aspx video.aspx)
2.3 主要程序函数调用说明
三、详细设计
3.1 用户注册和登录
<meta name="robots" content="noindex,follow" />
</head>
<body>
<form id="form1" runat="server">
<div class="container">
<div class="login">
<h1>登录系统</h1>
<p>
<asp:TextBox ID="login1" name="login" placeholder="帐号"
runat="server"></asp:TextBox>
<p>
<asp:TextBox ID="password" type="password" name="password" placeholder="密码" runat="server"></asp:TextBox>
<p class="submit">
<asp:Button ID="commit" name="commit" runat="server" Text="登录"
OnClick="commit_Click" />
</div>
<div class="login-help">
<p>注册新用户<a href="#loginmodal" id="modaltrigger">点击注册</a>.</p> </div>
</div>
<div id="loginmodal" style="display: none;">
<h1>用户注册</h1>
<label for="sname">帐号:</label>
<asp:TextBox ID="sname" runat="server" CssClass="txtfield" TabIndex="1" placeholder="帐号"> </asp:TextBox>
<label for="email">邮箱</label>
<asp:TextBox ID="email" runat="server" CssClass="txtfield" TabIndex="2" placeholder="邮箱"></asp:TextBox>
<label for="spassword">密码:</label>
<asp:TextBox type="password" ID="spassword" runat="server" CssClass="txtfield" TabIndex="3" placeholder="密码"></asp:TextBox>
<label for="tpassword">确认密码:</label>
<asp:TextBox type="password" ID="tpassword" runat="server" CssClass="txtfield" TabIndex="4" placeholder="确认密码"></asp:TextBox>
<div class="center">
<asp:Button name="signbtn" ID="signbtn" CssClass="flatbtn-blu hidemodal" Text="注册" TabIndex="5" runat="server" OnClick="signbtn_Click" />
</div>
</div>
<script type="text/javascript">
$(function () {
$('#loginform').submit(function (e) {
后台逻辑:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using datastruct.App_Code;
using SC.Helper;
using System.Data.SqlClient;
using System.Data;
using System.Text.RegularExpressions;
namespace datastruct
{
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void commit_Click(object sender, EventArgs e)
{
if (login1.Text != "" || password.Text != "")
{
SqlParameter[] paras =
{
new SqlParameter("@login",login1.Text.ToString()),
new SqlParameter("@pwd",password.Text.ToString())
};
SqlDataReader sdr = SqlHelper.ExecuteReader(SqlHelper.GetConnSting("datastruct"), CommandType.Text, "select * from uesr where usr_name=@login and usr_pwd=@pwd", paras);
if (sdr.HasRows)
{
if (sdr.Read())
{
Session["id"] = sdr[0].ToString();
Session["login"] = login1.Text.ToString();
Response.Redirect("index.html", true);
}
else
{
sdr.Close();
sdr.Dispose();
ClientScript.RegisterStartupScript(this.GetType(), "status",
"alert('账号密码错误!')", true);
return;
}
}
else
{
if (!sdr.IsClosed)
{
sdr.Close();
sdr.Dispose();
}
ClientScript.RegisterStartupScript(this.GetType(), "status",
"alert('账号或密码错误!')", true);
return;
}
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "statusok",
"alert('输入不能为空,请完成输入')", true);
return;
}
}
protected void signbtn_Click(object sender, EventArgs e)
{
Regex emailregex = new
Regex(@"[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.
)+[\w](?:[\w-]*[\w])?");
Regex namegegex = new Regex(@"^[a-z0-9A-Z]{5,16}");
if (!namegegex.IsMatch(sname.Text.ToString()))
{
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('账号格式错误,请输入数字和字符组合,长度为5-16位!')", true);
return;
}
if (!emailregex.IsMatch(email.Text.ToString()))
{
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('邮箱格式错误!')", true);
return;
}
if (!namegegex.IsMatch(spassword.Text.ToString()))
{
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('密码格式错误,请输入数字和字符组合,长度为5-16位!')", true);
return;
}
if (spassword.Text.ToString()!=tpassword.Text.ToString())
{
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('两次密码输入不一致,请重新输入')", true);
return;
}
SqlParameter[] paras =
{
new SqlParameter("@name",sname.Text.ToString()),
new SqlParameter("@pwd",spassword.Text.ToString()),
new SqlParameter("@email",email.Text.ToString())
};
try
{
SqlDataReader sdr = SqlHelper.ExecuteReader(SqlHelper.GetConnSting("datastruct"), CommandType.Text, "select * from uesr where usr_name=@name", paras);
if (sdr.HasRows)
{
if (sdr.Read())
{
sdr.Close();
sdr.Dispose();
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('用户已经存在!')", true);
return;
}
else
{
sdr.Close();
sdr.Dispose();
}
}
if (SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting("datastruct"), CommandType.Text, "insert
3.2 文件的上传
前台页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="lib_upload.aspx.cs" Inherits="datastruct.lib_upload" %>
<!DOCTYPE html>
<html xmlns="/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="res/css/bootstrap.min.css" />
<link href="res/css/default.css" rel="stylesheet" />
<link href="res/css/fileinput.css" rel="stylesheet" />
<link rel="icon" href="res/photo/book.ico" />
<script src="res/js/jquery.min.js"></script>
<%-- <script src="res/js/jquery-2.2.3.js"></script>--%>
<script src="res/js/bootstrap.min.js"></script>
<title>知识库管理系统</title>
<meta charset="utf-8" />
<!--[if IE]>
<script src="/js/html5shiv/3.7/html5shiv.min.js"></script> <![endif]-->
</head>
<body>
<form id="form1" runat="server">
<div class="container">
<div class="modal-header clearfix">
<nav>
<ul class="nav nav-pills pull-right">
<li role="presentation"><a href="Index.html">首页</a></li>
<li role="presentation" class="active"><a href="lib_upload.aspx">文件上传</a></li>
<li role="presentation"><a href="lib_flieList.aspx">文档列表</a></li>
<li role="presentation"><a href="about.html">关于</a></li>
<li role="presentation"><asp:LinkButton ID="exit" runat="server" Text="退出" OnClick="exit_Click"></asp:LinkButton></li>
</ul>
</nav>
<h3 class="text-muted">知识库管理系统</h3>
</div>
</div>
<div class="htmleaf-container">
<header class="htmleaf-header">
<h1>知识库文件上传</h1>
</header>
<div class="container kv-main">
<div class="page-header">
<h4>文件上传</h4>
</div>
<div>
<asp:FileUpload ID="upfile" runat="server" CssClass="file" multiple data-min-file-count="1" />
<br>
<asp:Button ID="btnupload" runat="server" class="btn btn-primary"
OnClick="btnupload_Click" Text="上传" />
<button type="reset" class="btn btn-default">重置</button>
</div>
<script type="text/javascript">
$("")
</script>
<hr>
<div class="page-header">
<h4>文件描述</h4>
</div>
<div>
<asp:TextBox CssClass="form-control" Rows="3" ID="txtIntro"
runat="server"></asp:TextBox>
</div>
<hr />
</div>
</div>
<script src="res/js/fileinput.js"></script>
<script src="res/js/fileinput_locale_zh.js"></script>
<div class="container">
<fieldset>
<span style="color: OrangeRed; font-size: 15px">知识库管理系统说明:</span>
<ul>
<li>1、目前多选文件不可用,即使上传多个文件,只有第一个文件被上传</li>
<li>2、文件支持类型有:docx、doc、xlsx、xls、pdf、mp4、mp3、jpeg、jpg、png</li>
<li>3、更多功能持续开发中</li>
</ul>
<br />
</fieldset>
<hr />
<footer>
<p>©Luo Zhang Yang</p>
</footer>
</div>
</form>
</body>
</html>
{
}
protected void btnupload_Click(object sender, EventArgs e)
{
if (upfile.HasFile)
{
int uplength = 10;
int muplength = 45;
string filename = Session["login"]+"-"+upfile.FileName;
string fileExtension = System.IO.Path.GetExtension(upfile.FileName).ToLower();
if (fileExtension == ".xls" || fileExtension == ".xlsx" || fileExtension == ".pdf" || fileExtension == ".doc" || fileExtension == ".docx")
{
string upload_file = Server.MapPath(File_PATH_Text) + Session["login"]+"-" +
upfile.FileName;
string upload_file2 = "/Files/Text/" + Session["login"]+"-" + upfile.FileName;
if (!File.Exists(upload_file))
{
if (upfile.FileBytes.Length / (1024 * 1024) > uplength)
{
ClientScript.RegisterStartupScript(this.GetType(), "uploadok", "alert('大小超出" + uplength + "M的限制!');", true);
return;
}
try
{
SqlParameter[] paras = {
new SqlParameter("@name",filename),
new SqlParameter("@path",upload_file2),
new SqlParameter("@intro",txtIntro.Text.ToString()),
new SqlParameter("@uid",Session["id"].ToString()),
};
if (SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(DB_APP), CommandType.Text, "insert into
FilePath(file_id,file_name,file_path,file_intro,file_ML,is_collect,upload_time,usr_id,is_share)
values( newid(),@name,@path,@intro,'文档','未收藏',getdate(),@uid,'分享')", paras) > 0)
{
upfile.PostedFile.SaveAs(upload_file);
if (fileExtension == ".doc" || fileExtension == ".docx")
{
Document doc = new Document(upload_file);
Aspose.Words.Saving.PdfSaveOptions savaOptions = new
Aspose.Words.Saving.PdfSaveOptions();
pliance = PdfCompliance.PdfA1a;
doc.Save(upload_file.Replace(upload_file.Substring(upload_stIndexOf(".") + 1), "pdf"));
}
else if (fileExtension == ".xls" || fileExtension == ".xlsx")
{
Workbook workbook = new Workbook(upload_file);
workbook.Save(upload_file.Replace(upload_file.Substring(upload_stIndexOf(".") + 1), "pdf"),
Aspose.Cells.SaveFormat.Pdf);
}
ClientScript.RegisterStartupScript(this.GetType(), "uploadok", "alert('提示:文件上传成功');", true);
}
}
catch (Exception ex)
{
ClientScript.RegisterStartupScript(this.GetType(), "uploadok", "alert('提示:文件上传失败" + ex.Message + "');", true);
throw;
}
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "uploadok", "alert('提示:文件已经存在,请重新命名上传');", true);
}
}
else if (fileExtension == ".mp3" || fileExtension == ".mp4" || fileExtension == ".jpeg" || fileExtension == ".jpg" || fileExtension == ".png")
{
string upload_file = Server.MapPath(File_PATH_Media) + Session["login"]+"-" +
upfile.FileName;
string upload_file2 = "Files/Media/" + Session["login"] +"-"+ upfile.FileName;
if (!File.Exists(upload_file))
{
if (upfile.FileBytes.Length / (1024 * 1024) > muplength)
{
ClientScript.RegisterStartupScript(this.GetType(), "uploadok", "alert('大小超出" + muplength + "M的限制!');", true);
return;
}
try
{
SqlParameter[] paras = {
new SqlParameter("@name",filename),
new SqlParameter("@path",upload_file2),
new SqlParameter("@intro",txtIntro.Text.ToString()),
new SqlParameter("@uid",Session["id"].ToString())
};
if (SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(DB_APP), CommandType.Text, "insert into
FilePath(file_id,file_name,file_path,file_intro,file_ML,is_collect,upload_time,usr_id,is_share)
values( newid(),@name,@path,@intro,'媒体','未收藏',getdate(),@uid,'分享')", paras) > 0)
{
upfile.PostedFile.SaveAs(upload_file);
ClientScript.RegisterStartupScript(this.GetType(), "uploadok", "alert('提示:文件上传成功');", true);
}
}
catch (Exception ex)
{
ClientScript.RegisterStartupScript(this.GetType(), "uploadok", "alert('提示:文件上传失败" + ex.Message + "');", true);
throw;
}
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "uploadok", "alert('提示:文件已经存在,请重新命名上传');", true);
}
}
else
{
Response.Write("<script>alert('目前系统不支持该文件!')</script>");
}
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "uploadok", "alert('请选择上传文件!')", true);
}
}
protected void exit_Click(object sender, EventArgs e)
{
Session.Clear();
Response.Redirect("index.html");
}
}
}
3.3 文档列表
前台页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="lib_flieList.aspx.cs" Inherits= "datastruct.lib_flieList" %>
<!DOCTYPE html>
<html xmlns="/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="res/css/bootstrap.min.css" rel="stylesheet" />
<link href="res/css/litebox.css" rel="stylesheet" />
<link rel="icon" href="res/photo/book.ico" />
<script src="res/js/jquery-2.2.3.js"></script>
<script src="res/js/bootstrap.min.js"></script>
<title>文件列表</title>
<meta charset="utf-8" />
<script type="text/javascript">
function Enter(buttonname) {
if (event.keyCode == 13) {
event.keyCode = 9;
event.returnValue = false;
document.all[buttonname].click();
}
};
</script>
<style>
/* reset webkit search input browser style */
input {
margin: 5px auto;
outline: none;
}
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none; /* remove the search and cancel icon */
}
/* search input field */
input[type=search] {
background: #ededed url(res/photo/search-icon.png) no-repeat 9px center;
border: solid 1px #ccc;
padding: 9px 10px 9px 32px;
width: 55px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
input[type=search]:focus {
width: 130px;
background-color: #fff;
border-color: #6dcff6;
-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
box-shadow: 0 0 5px rgba(109,207,246,.5);
}
/* placeholder */
input:-moz-placeholder {
color: #999;
}
input::-webkit-input-placeholder {
color: #999;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="container">
<div class="modal-header clearfix">
<nav>
<ul class="nav nav-pills pull-right">
<li role="presentation"><a href="Index.html">首页</a></li>
<li role="presentation"><a href="lib_upload.aspx">文件上传</a></li>
<li role="presentation" class="active"><a href="lib_flieList.aspx">文档列表</a></li>
<li role="presentation"><a href="about.html">关于</a></li>
<li role="presentation">
<asp:LinkButton ID="exit" runat="server" Text="退出" OnClick="exit_Click"> </asp:LinkButton>
</li>
</ul>
</nav>
<h3 class="text-muted">知识库管理系统</h3>
</div>
</div>
<div class="container" style="margin: 15px auto;">
<div style="float: right">
<nav>
<ul class="nav nav-pills pull-left">
<li id="cs1" role="presentation">
<asp:LinkButton ID="lbttotal" runat="server" OnClick="lbttotal_Click">全部
</asp:LinkButton></li>
<li id="cs2" role="presentation">
<asp:LinkButton ID="lbttext" runat="server" OnClick="lbttext_Click">文档
</asp:LinkButton></li>
<li id="cs3" role="presentation">
<asp:LinkButton ID="lbtmedia" runat="server" OnClick="lbtmedia_Click">媒体</asp:LinkButton></li>
<li id="cs4" role="presentation">
<asp:LinkButton ID="lbtcollect" runat="server" OnClick="lbtcollect_Click">收藏</asp:LinkButton></li>
</ul>
</nav>
</div>
<div style="float: left">
<asp:TextBox ID="txbx" runat="server" placeholder="Search" Type="Search"></asp:TextBox>
<asp:Button ID="button" runat="server" OnClick="button_Click" Style="display: none" /> </div>
</div>
<div class="container list">
<table class="table table-striped">
<asp:Repeater runat="server" ID="file_rp" OnItemCommand="file_rp_ItemCommand">
<HeaderTemplate>
<tr class="even point">
<td style="text-align: center">文件编号</td>
<td style="text-align: center">文件名</td>
<td style="text-align: center">目录</td>
<td style="text-align: center">文件描述</td>
<td style="text-align: center">上传时间</td>
<td style="text-align:center">分享</td>
<td style="text-align: center">收藏</td>
<td style="text-align: center">删除</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="text-align: center"><%#Eval("file_id") %></td>
<td style="text-align: center"><%#Getfilepath(Eval("file_path").ToString(),
Eval("file_ml").ToString(),Eval("file_name").ToString()) %>
</td>
<td style="text-align: center; width: 60px;"><%#Eval("file_ml") %></td>
<td style="text-align: center; width: 300px"><%#Eval("file_intro") %></td>
<td style="text-align: center; width: 110px"><%#Eval("upload_time") %></td>
<td style="text-align: center; width: 100px">
<asp:LinkButton ID="lbtshare" runat="server" CommandArgument='
<%#DataBinder.Eval(Container.DataItem,"fp_id")%>' CommandName="Share"><%#Eval("is_share").ToString() %> </asp:LinkButton></td>
<td style="text-align: center; width: 80px">
<asp:LinkButton ID="lbtCollect" runat="server" CommandArgument=
'<%#DataBinder.Eval(Container.DataItem,"fp_id")%>' CommandName="Collect"><%#Eval("is_collect"). ToString()%></asp:LinkButton></td>
<td style="text-align: center; width: 60px">
<asp:LinkButton ID="lbtDelete" runat="server" CommandArgument='
<%#DataBinder.Eval(Container.DataItem,"fp_id") %>' CommandName="Delete" Text="删除" OnClientClick=" return confirm('确定要删除?')"></asp:LinkButton></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
<table>
<tr>
<td>   </td>
<td>
<asp:LinkButton runat="server" ID="lbtlast" Text="上一页" Visible="false" OnClick="lbtlast_Click"></asp:LinkButton>
</td>
<td>   </td>
<td>
<asp:LinkButton runat="server" ID="lbtnext" Text="下一页" Visible="false" OnClick="lbtnext_Click"></asp:LinkButton>
</td>
</tr>
</table>
<hr />
<footer>
后台逻辑:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using datastruct.App_Code;
using SC.Helper;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using System.IO;
namespace datastruct
{
public partial class lib_flieList : webconfig
{
private static int _pageindex = 0;
private static string sbw = "fp_id is not null and usr_id=@uid or is_share='取消分享'";
private static string _strsearch = "";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
txbx.Attributes.Add("onkeydown", "Enter('button')");
}
}
private void rp_bind(int pageindex)
{
try
{
SqlParameter para = new SqlParameter("@uid", Session["id"].ToString());
CommonHelper com = new CommonHelper();
DataTable dt = new DataTable();
//sb.Append("fp_id is not null");
int RecordCount = com.getDataCount("filepath", sbw, DB_APP,para);
dt = com.getDataList(pageindex, 5, "filepath", "*", "fp_id", sbw, "order by fp_id desc",
DB_APP,para);
file_rp.DataSource = dt;
file_rp.DataBind();
lbtlast.Visible = true;
lbtnext.Visible = true;
if (pageindex < 1)
{
lbtlast.Visible = false;
}
if (RecordCount / 5 == _pageindex)
{
lbtnext.Visible = false;
}
}
catch (Exception ex)
{
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('错误:" + ex.Message + "')", true);
throw;
}
}
protected void file_rp_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (mandName == "Collect")
{
SqlParameter para = new SqlParameter("@id", mandArgument.ToString());
try
{
if (SqlHelper.ExecuteScalar(SqlHelper.GetConnSting(DB_APP), CommandType.Text, "select is_collect from filepath where fp_id=@id", para).ToString() == "未收藏")
{
if (SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(DB_APP), CommandType.Text, "update filepath set is_collect = '已收藏' where fp_id = @id", para) > 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('收藏成功!')", true);
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('收藏失败,稍后再试!')", true);
}
}
else
{
if (SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(DB_APP), CommandType.Text, "update filepath set is_collect = '未收藏' where fp_id = @id", para) > 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('取消收藏成功!')", true);
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('取消收藏失败,稍后再试!')", true);
}
}
}
catch (Exception ex)
{
ClientScript.RegisterStartupScript(this.GetType(), "status", "alert('错误:" + ex.Message + "!')", true);
throw;
}
}
else if (mandName == "Delete")
{
try
{
SqlParameter para = new SqlParameter("@id", mandArgument.ToString());
string filepath = Server.MapPath(SqlHelper.ExecuteScalar(SqlHelper.GetConnSting(DB_APP), CommandType.Text, "select file_path from filepath where fp_id=@id", para).ToString());
if (SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(DB_APP), CommandType.Text, "delete from filepath where fp_id=@id", para) > 0)
{
try
{
if (File.Exists(filepath) ||。