资源描述
图书馆管理系统管理员功能模块
资料仅供参考
图书管理系统管理员功能点图
一、 引言
对于图书馆来说,如何简化图书流通的操作流程,提高图书管理的工作效率是关键因素。因此,需要引入图书馆管理系统来实现图书馆的现代化管理。作为一个图书馆管理系统,首先,必须要有友好的、美观的操作界面,人机对话操作方式简单。其次,图书信息和读者信息分类管理,能实现综合查询。再次,对图书借阅信息,图书借阅排行榜信息实现全程数据跟踪,保证数据的真实性和及时性。最后,能实现及时的提醒用户归还即将到期的图书,做到图书借阅管理流程规范且流畅。
更具图书管日常图书管理的需求和图书借阅的管理流程,如下图,图书馆管理系统功能模块主要包括系统设置、读者管理功能、图书管理功能、图书借阅功能和相关的查询功能。其中管理员功能模块如下图:
管理员功能模块
1.2 图书管理系统的可行性分析
本次课程设计题目:“图书管理系统的开发”主要目的是利用数据库软件编制一个管理软件,用以实现图书、读者以及日常工作等多项管理。同时对整个系统的分析、设计过程给出一个完整论证。图书管理系统是一种基于集中统一规划的数据库数据管理新模式。在对图书、读者的管理,其实是对图书、读者数据的管理。本系统的建成无疑会为管理者对图书管理系统提供极大的帮助。本系统的设计主要从以下几方面做起:系统业务流程分析、系统的功能设计、系统的数据库结构设计等。作这些工作需对数据库知识有足够认识,并深入的了解c#的使用和管理系统的相关知识。在信息时代的今天,人类需要对在政治、经济、军事、文化、科研、教育等领域产生的大量信息进行管理,并对数据进行加工处理,数据库技术则是信息管理与数据处理的先进技术。随着信息量的不断增加,作为计算机的三大主要应用(科学计算、过程控制和数据处理)之一的数据处理,已迅速上升为计算机应用的主要方面,数据库技术则成为人们日常生活中处理数据不可缺少的有力工具,而且现代的信息管理系统几乎都以数据库技术作为核心。
现在大多数的图书管理方式为手工处理,重复劳动多,劳动强度大,而且容易出错,新系统的使用能否能够很好的解决这些问题要看系统的可行性,可行性研究的目的是用最小的代价在尽可能短的时间内确定问题是否能够解决。系统的可行性分析有以下几个方面:
(1)技术可行性:处理速度快、准确经过权限的设置,数据的安全性好、方便查询、借阅管理等。
(2)经济可行性:系统建设不需要很大的投入、可缩减人力投入。
(3)运行上可行性:本系统作为一个小型的图书馆信息管理系统,所耗费的
资源非常的小。
(4)从各种社会因素可行性分析:可降低工作人员工作强度,提高效率,会
得到学校工作人员的一致同意的。
综上所述经过可行性分析认为新系统的开发方案切实可行,可进行开发。
1.3 系统开发运行环境
系统开发环境:Microsoft Visual Studio
系统开发语言:c#
运行平台:Windows 8
数据库:sql
二、 图书管理系统模块分析
2.1管理员数据流图
(1)图书档案管理系统为用户提供图书档案信息其数据流图如图2-1所示。
图2-1 图书档案管理数据流图
(2)读者档案系统用于记录读者的详细信息其数据流图如图2-2所示。
图2-2 读者档案管理数据流图
2.2管理员用例图
2.2.1 管理员用例图
2.3 管理员E-R图
管理员总体E-R图
三、 管理员各功能及实现
3.1管理员登录代码
protected void Button1_Click(object sender, EventArgs e)
{
/*取得帐号密码信息*/
string userName = this.txtName.Text;
string password = this.txtPwd.Text;
string identify = this.Identify.SelectedValue;
if ("管理员" == identify)
{
AdminModel adminModel = new AdminModel();
adminModel.AdminUsername = userName;
adminModel.AdminPassword = password;
AdminLogic adminLogic = new AdminLogic();
/*如果管理员帐号信息正确*/
if (adminLogic.IsExistAdminInfo(adminModel))
{
Session["adminFlag"] = true;
Session["adminUsername"] = userName;
Response.Redirect("Admin/index.aspx");
}
/*如果管理员帐号信息不正确*/
else
{
Response.Write("<script>alert('" + adminLogic.ErrMessage + "');</script>");
}
}
else
{
ReaderModel readerModel = new ReaderModel();
readerModel.ReaderId = userName;
readerModel.ReaderPassword = password;
ReaderLogic readerLogic = new ReaderLogic();
/*如果读者帐号信息正确*/
if (readerLogic.IsExistReaderInfo(readerModel))
{
Session["readerFlag"] = true;
Session["readerId"] = userName;
Response.Redirect("Reader/index.aspx");
}
/*如果读者帐号信息不正确*/
else
{
Response.Write("<script>alert('" + readerLogic.ErrMessage + "');</script>");
}
}
}
}
3.2管理员图书管理部分核心代码
protected void BindData()
{
string keyword = this.Keyword.Text;
int diskTypeId = Int32.Parse(this.DiskType.SelectedValue);
string isRecommend = this.IsRecommend.SelectedValue;
/*调用业务层进行查询*/
this.GridView1.DataSourceID = "";
this.GridView1.DataSource = (new DiskLogic()).QueryDiskInfo(keyword, diskTypeId, isRecommend);
this.GridView1.DataBind();
}
protected void Btn_Query_Click(object sender, EventArgs e)
{
/*取得查询的各个参数*/
string keyword = this.Keyword.Text;
int diskTypeId = Int32.Parse(this.DiskType.SelectedValue);
string isRecommend = this.IsRecommend.SelectedValue;
/*调用业务层进行查询*/
this.GridView1.DataSourceID = "";
this.GridView1.DataSource = (new DiskLogic()).QueryDiskInfo(keyword, diskTypeId, isRecommend);
this.GridView1.DataBind();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
/*取得查询的各个参数*/
string keyword = this.Keyword.Text;
int diskTypeId = Int32.Parse(this.DiskType.SelectedValue);
string isRecommend = this.IsRecommend.SelectedValue;
/*调用业务层得到查询的结果数据集*/
DataSet ds = new DataSet();
ds = (new DiskLogic()).QueryDiskInfo(keyword, diskTypeId, isRecommend);
/*将查询结果集绑定到gridview控件上*/
this.GridView1.DataSourceID = null;
this.GridView1.DataSource = ds;
this.GridView1.PageIndex = e.NewPageIndex; ;
this.GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标选择某行时变颜色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00ffee';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
}
}
3.3添加图书类型部分核心代码
protected void Btn_Add_Click(object sender, EventArgs e)
{
DiskTypeModel diskTypeModel = new DiskTypeModel();
diskTypeModel.DiskTypeName = this.DiskTypeName.Text;
DiskTypeLogic diskTypeLogic = new DiskTypeLogic();
if (diskTypeLogic.InsertDiskTypeInfo(diskTypeModel))
{
Response.Write("<script>alert('图书类型信息添加成功!');location.href='diskTypeAdd.aspx';</script>");
}
else
{
Response.Write("<script>alert('" + diskTypeLogic.ErrMessage + "');</script>");
}
}
3.4读者类型添加管理核心代码
protected void Btn_Add_Click(object sender, EventArgs e)
{
/*建立读者类型对象模型并传入界面上的各个参数*/
ReaderTypeModel readerModel = new ReaderTypeModel();
readerModel.ReaderTypeName = this.ReaderTypeName.Text;
readerModel.LoanNum = Int32.Parse(this.LoanNum.Text);
readerModel.LoanDays = Int32.Parse(this.LoanDays.Text);
readerModel.ContinueDays = Int32.Parse(this.ContinueDays.Text);
readerModel.ReserverNum = Int32.Parse(this.ReserveNum.Text);
/*调用业务层进行添加*/
ReaderTypeLogic readerTypeLogic = new ReaderTypeLogic();
if (readerTypeLogic.AddNewReaderType(readerModel))
{
Response.Write("<script>alert('读者类别信息添加成功!');location.href='readerTypeManage.aspx';</script>");
}
else
{
Response.Write("<script>alert('" + readerTypeLogic.ErrMessage + "');</script>");
}
3.5 读者信息添加核心代码
protected void Btn_Upload_Click(object sender, EventArgs e)
{
/*如果上传了文件*/
if (this.ReaderPhotoUpload.PostedFile.ContentLength > 0)
{
/*验证上传的文件格式,只能为gif和jpeg格式*/
string mimeType = this.ReaderPhotoUpload.PostedFile.ContentType;
if (String.Compare(mimeType, "image/gif", true) == 0 || String.Compare(mimeType, "image/pjpeg", true) == 0)
{
//this.DeviceImagePath.Text = "上传文件中....";
string extFileString = System.IO.Path.GetExtension(this.ReaderPhotoUpload.PostedFile.FileName); /*获取文件扩展名*/
string saveFileName = this.MakeFileName(extFileString); /*根据扩展名生成文件名*/
string imagePath = "ReaderPhoto\\" + saveFileName;/*图片路径*/
this.ReaderPhotoUpload.PostedFile.SaveAs(Server.MapPath(imagePath));
this.ReaderPhoto.ImageUrl = imagePath;
this.ReaderPhotoUrl.Text = imagePath;
}
else
{
Response.Write("<script>alert('上传文件格式不正确!');</script>");
}
}
}
/*根据当前系统时间生成一个文件名*/
private string MakeFileName(string exeFileString)
{
System.DateTime now = System.DateTime.Now;
int year = now.Year;
int month = now.Month;
int day = now.Day;
int hour = now.Hour;
int minute = now.Minute;
int second = now.Second;
string yearString = year.ToString();
string monthString = month < 10 ? ("0" + month) : month.ToString();
string dayString = day < 10 ? ("0" + day) : day.ToString();
string hourString = hour < 10 ? ("0" + hour) : hour.ToString();
string minuteString = minute < 10 ? ("0" + minute) : minute.ToString();
string secondString = second < 10 ? ("0" + second) : second.ToString();
/*根据当前时间的年月日时分秒生成文件名*/
string fileName = yearString + monthString + dayString + hourString + minuteString + secondString + exeFileString;
return fileName;
}
protected void Btn_Add_Click(object sender, EventArgs e)
{
/*建立读者对象模型,将读者的各个信息传入模型的对应属性中*/
ReaderModel readerModel = new ReaderModel();
readerModel.ReaderId = this.ReaderId.Text;
readerModel.ReaderPassword = this.ReaderPassword.Text;
readerModel.ReaderName = this.ReaderName.Text;
readerModel.ReaderSex = this.ReaderSex.SelectedValue;
if (this.ReaderBirthday.Text != "")
readerModel.ReaderBirthday = Convert.ToDateTime(this.ReaderBirthday.Text);
readerModel.ReaderTypeId = Int32.Parse(this.ReaderType.SelectedValue);
readerModel.ReaderPhone = this.ReaderPhone.Text;
readerModel.ReaderEmail = this.ReaderEmail.Text;
readerModel.ReaderAddress = this.ReaderAddress.Text;
readerModel.ReaderPhotoUrl = this.ReaderPhotoUrl.Text;
readerModel.ReaderMemo = this.ReaderMemo.Text;
/*调用业务层执行新读者信息的添加*/
ReaderLogic readerLogic = new ReaderLogic();
if (readerLogic.AddNewReaderInfo(readerModel))
{
Response.Write("<script>alert('读者信息添加成功!');location.href='readerAdd.aspx';</script>");
}
else
Response.Write("<script>alert('" + readerLogic.ErrMessage + "');</script>");
}
protected void Btn_Cancle_Click(object sender, EventArgs e)
{
Response.Write("<script>location.href='index.aspx';</script>");
}
3.6 图书借阅部分代码
protected void Btn_Add_Click(object sender, EventArgs e)
{
string readerId = this.ReaderId.Text;
string diskIndex = this.DiskIndex.Text;
DiskLogic diskLogic = new DiskLogic();
DiskModel diskModel = diskLogic.GetDiskInfo(diskIndex);
LoanLogic loanLogic = new LoanLogic();
if (loanLogic.AddNewLoanInfo(diskIndex, readerId, Session["adminUsername"].ToString()))
{
diskLogic.UpdateDiskLoanNum(diskModel.Id);
(new ReaderLogic()).UpdateReaderLoanNum(readerId);
this.Result.Text = "读者:" + ReaderLogic.GetReaderNameById(readerId) + "借阅图书:" + DiskLogic.GetDiskNameById(diskModel.Id) + " 成功!";
}
else
this.Result.Text = loanLogic.ErrMessage;
this.ReaderId.Text = "";
this.DiskIndex.Text = "";
}
3.7图书归还部分代码
protected void Btn_Add_Click(object sender, EventArgs e)
{
string readerId = this.ReaderId.Text;
string diskIndex = this.DiskIndex.Text;
DiskLogic diskLogic = new DiskLogic();
DiskModel diskModel = diskLogic.GetDiskInfo(diskIndex);
LoanLogic loanLogic = new LoanLogic();
if (loanLogic.ReturnDisk(diskModel.Id,readerId,Session["adminUsername"].ToString()))
this.Result.Text = "读者:" + ReaderLogic.GetReaderNameById(readerId) + "归还图书:" + diskModel.DiskName + " 成功!";
else
this.Result.Text = loanLogic.ErrMessage;
this.ReaderId.Text = "";
this.DiskIndex.Text = "";
}
3.8图书预约代码
protected void Btn_Query_Click(object sender, EventArgs e)
{
ArrayList reserveInfoList = ReserveLogic.QueryReserveInfo(this.ReaderId.Text,this.DiskIndex.Text);
ShowReserveInfoList(reserveInfoList);
}
private void ShowReserveInfoList(ArrayList reserveInfoList)
{
if (reserveInfoList.Count == 0)
this.Result.Text = "<tr><td colspan=5 align=center><font color=red>没有图书预约信息</font></td></tr>";
else
{
this.Result.Text = "";
for (int i = 0; i < reserveInfoList.Count; i++)
{
ReserveModel reserveModel = (ReserveModel)reserveInfoList[i];
int diskId = reserveModel.DiskId;
DiskLogic diskLogic = new DiskLogic();
DiskModel diskModel = diskLogic.GetDiskInfo(diskId);
this.Result.Text += "<tr><td><font color=red>" + reserveModel.ReserveId + "</font></td>";
this.Result.Text += "<td><font color=red>" + reserveModel.ReaderId + "</font></td>";
this.Result.Text += "<td><font color=red>" + ReaderLogic.GetReaderNameById(reserveModel.ReaderId) + "</font></td>";
this.Result.Text += "<td><font color=red>" + diskModel.DiskIndex + "</font></td>";
this.Result.Text += "<td><font color=red>" + diskModel.DiskName + "</font></td>";
this.Result.Text += "<td><font color=red>" + reserveModel.ReserveTime.ToLongDateString() + " " + reserveModel.ReserveTime.ToLongTimeString() + "</font></td>";
this.Result.Text += "<td><font color=red><a href=diskReserveHandle.aspx?reserveId=" + reserveModel.ReserveId + ">图书借阅</a></font></td></tr>";
}
}
}
3.9用户修改权限部分核心代码
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标选择某行时变颜色
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00ffee';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
/*获取当前记录的管理员账号名然后获取权限信息*/
string adminUsername = this.GridView1.DataKeys[e.Row.RowIndex].Value.ToString();
AdminLogic adminLogic = new AdminLogic();
AdminModel adminModel = adminLogic.GetAdmin(adminUsername);
Literal DiskType = (Literal)e.Row.Cells[1].FindControl("DiskType");
DiskType.Text = adminModel.DiskTypeFlag == 1 ? "YES" : "NO";
Literal Disk = (Literal)e.Row.Cells[2].FindControl("Disk");
Disk.Text = adminModel.DiskFlag == 1 ? "YES" : "NO";
Literal ReaderType = (Literal)e.Row.Cells[3].FindControl("ReaderType");
ReaderType.Text = adminModel.ReaderTypeFlag == 1 ? "YES" : "NO";
Literal Reader = (Literal)e.Row.Cells[4].FindControl("Reader");
Reader.Text = adminModel.ReaderFlag == 1 ? "YES" : "NO";
Literal Lend = (Literal)e
展开阅读全文