图书馆管理系统管理员功能模块Word文档格式.docx
《图书馆管理系统管理员功能模块Word文档格式.docx》由会员分享,可在线阅读,更多相关《图书馆管理系统管理员功能模块Word文档格式.docx(19页珍藏版)》请在冰豆网上搜索。
(1)技术可行性:
处理速度快、准确通过权限的设置,数据的安全性好、方便查询、借阅管理等。
(2)经济可行性:
系统建设不需要很大的投入、可缩减人力投入。
(3)运行上可行性:
本系统作为一个小型的图书馆信息管理系统,所耗费的
资源非常的小。
(4)从各种社会因素可行性分析:
可降低工作人员工作强度,提高效率,会
得到学校工作人员的一致同意的。
综上所述通过可行性分析认为新系统的开发方案切实可行,可进行开发。
1.3系统开发运行环境
系统开发环境:
MicrosoftVisualStudio2010
系统开发语言:
c#
运行平台:
Windows8
数据库:
sql2012
二、图书管理系统模块分析
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管理员登录代码
protectedvoidButton1_Click(objectsender,EventArgse)
{
/*取得帐号密码信息*/
stringuserName=this.txtName.Text;
stringpassword=this.txtPwd.Text;
stringidentify=this.Identify.SelectedValue;
if("
管理员"
==identify)
AdminModeladminModel=newAdminModel();
adminModel.AdminUsername=userName;
adminModel.AdminPassword=password;
AdminLogicadminLogic=newAdminLogic();
/*如果管理员帐号信息正确*/
if(adminLogic.IsExistAdminInfo(adminModel))
Session["
adminFlag"
]=true;
adminUsername"
]=userName;
Response.Redirect("
Admin/index.aspx"
);
}
/*如果管理员帐号信息不正确*/
else
Response.Write("
<
script>
alert('
"
+adminLogic.ErrMessage+"
'
/script>
ReaderModelreaderModel=newReaderModel();
readerModel.ReaderId=userName;
readerModel.ReaderPassword=password;
ReaderLogicreaderLogic=newReaderLogic();
/*如果读者帐号信息正确*/
if(readerLogic.IsExistReaderInfo(readerModel))
readerFlag"
readerId"
Reader/index.aspx"
/*如果读者帐号信息不正确*/
+readerLogic.ErrMessage+"
}
3.2管理员图书管理部分核心代码
protectedvoidBindData()
stringkeyword=this.Keyword.Text;
intdiskTypeId=Int32.Parse(this.DiskType.SelectedValue);
stringisRecommend=this.IsRecommend.SelectedValue;
/*调用业务层进行查询*/
this.GridView1.DataSourceID="
;
this.GridView1.DataSource=(newDiskLogic()).QueryDiskInfo(keyword,diskTypeId,isRecommend);
this.GridView1.DataBind();
protectedvoidBtn_Query_Click(objectsender,EventArgse)
/*取得查询的各个参数*/
protectedvoidGridView1_PageIndexChanging(objectsender,GridViewPageEventArgse)
/*调用业务层得到查询的结果数据集*/
DataSetds=newDataSet();
ds=(newDiskLogic()).QueryDiskInfo(keyword,diskTypeId,isRecommend);
/*将查询结果集绑定到gridview控件上*/
this.GridView1.DataSourceID=null;
this.GridView1.DataSource=ds;
this.GridView1.PageIndex=e.NewPageIndex;
;
protectedvoidGridView1_RowDataBound(objectsender,GridViewRowEventArgse)
if(e.Row.RowType==DataControlRowType.DataRow)
//当鼠标选择某行时变颜色
e.Row.Attributes.Add("
onmouseover"
"
c=this.style.backgroundColor;
this.style.backgroundColor='
#00ffee'
onmouseout"
this.style.backgroundColor=c;
3.3添加图书类型部分核心代码
protectedvoidBtn_Add_Click(objectsender,EventArgse)
DiskTypeModeldiskTypeModel=newDiskTypeModel();
diskTypeModel.DiskTypeName=this.DiskTypeName.Text;
DiskTypeLogicdiskTypeLogic=newDiskTypeLogic();
if(diskTypeLogic.InsertDiskTypeInfo(diskTypeModel))
图书类型信息添加成功!
location.href='
diskTypeAdd.aspx'
+diskTypeLogic.ErrMessage+"
3.4读者类型添加管理核心代码
/*建立读者类型对象模型并传入界面上的各个参数*/
ReaderTypeModelreaderModel=newReaderTypeModel();
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);
/*调用业务层进行添加*/
ReaderTypeLogicreaderTypeLogic=newReaderTypeLogic();
if(readerTypeLogic.AddNewReaderType(readerModel))
读者类别信息添加成功!
readerTypeManage.aspx'
+readerTypeLogic.ErrMessage+"
3.5读者信息添加核心代码
protectedvoidBtn_Upload_Click(objectsender,EventArgse)
/*如果上传了文件*/
if(this.ReaderPhotoUpload.PostedFile.ContentLength>
0)
/*验证上传的文件格式,只能为gif和jpeg格式*/
stringmimeType=this.ReaderPhotoUpload.PostedFile.ContentType;
if(String.Compare(mimeType,"
image/gif"
true)==0||String.Compare(mimeType,"
image/pjpeg"
true)==0)
//this.DeviceImagePath.Text="
上传文件中...."
stringextFileString=System.IO.Path.GetExtension(this.ReaderPhotoUpload.PostedFile.FileName);
/*获取文件扩展名*/
stringsaveFileName=this.MakeFileName(extFileString);
/*根据扩展名生成文件名*/
stringimagePath="
ReaderPhoto\\"
+saveFileName;
/*图片路径*/
this.ReaderPhotoUpload.PostedFile.SaveAs(Server.MapPath(imagePath));
this.ReaderPhoto.ImageUrl=imagePath;
this.ReaderPhotoUrl.Text=imagePath;
上传文件格式不正确!
/*根据当前系统时间生成一个文件名*/
privatestringMakeFileName(stringexeFileString)
System.DateTimenow=System.DateTime.Now;
intyear=now.Year;
intmonth=now.Month;
intday=now.Day;
inthour=now.Hour;
intminute=now.Minute;
intsecond=now.Second;
stringyearString=year.ToString();
stringmonthString=month<
10?
("
0"
+month):
month.ToString();
stringdayString=day<
+day):
day.ToString();
stringhourString=hour<
+hour):
hour.ToString();
stringminuteString=minute<
+minute):
minute.ToString();
stringsecondString=second<
+second):
second.ToString();
/*根据当前时间的年月日时分秒生成文件名*/
stringfileName=yearString+monthString+dayString+hourString+minuteString+secondString+exeFileString;
returnfileName;
protectedvoidBtn_Add_Click(objectsender,EventArgse)
/*建立读者对象模型,将读者的各个信息传入模型的对应属性中*/
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;
/*调用业务层执行新读者信息的添加*/
if(readerLogic.AddNewReaderInfo(readerModel))
读者信息添加成功!
readerAdd.aspx'
protectedvoidBtn_Cancle_Click(objectsender,EventArgse)
index.aspx'
3.6图书借阅部分代码
stringreaderId=this.ReaderId.Text;
stringdiskIndex=this.DiskIndex.Text;
DiskLogicdiskLogic=newDiskLogic();
DiskModeldiskModel=diskLogic.GetDiskInfo(diskIndex);
LoanLogicloanLogic=newLoanLogic();
if(loanLogic.AddNewLoanInfo(diskIndex,readerId,Session["
].ToString()))
diskLogic.UpdateDiskLoanNum(diskModel.Id);
(newReaderLogic()).UpdateReaderLoanNum(readerId);
this.Result.Text="
读者:
+ReaderLogic.GetReaderNameById(readerId)+"
借阅图书:
+DiskLogic.GetDiskNameById(diskModel.Id)+"
成功!
this.Result.Text=loanLogic.ErrMessage;
this.ReaderId.Text="
this.DiskIndex.Text="
3.7图书归还部分代码
if(loanLogic.ReturnDisk(diskModel.Id,readerId,Session["
归还图书:
+diskModel.DiskName+"
3.8图书预约代码
protectedvoidBtn_Query_Click(o