课程设计(论文)-ASP.NET图书管理系统.doc

上传人:韩长文 文档编号:3971862 上传时间:2019-10-11 格式:DOC 页数:19 大小:3.70MB
返回 下载 相关 举报
课程设计(论文)-ASP.NET图书管理系统.doc_第1页
第1页 / 共19页
课程设计(论文)-ASP.NET图书管理系统.doc_第2页
第2页 / 共19页
课程设计(论文)-ASP.NET图书管理系统.doc_第3页
第3页 / 共19页
课程设计(论文)-ASP.NET图书管理系统.doc_第4页
第4页 / 共19页
课程设计(论文)-ASP.NET图书管理系统.doc_第5页
第5页 / 共19页
点击查看更多>>
资源描述

《课程设计(论文)-ASP.NET图书管理系统.doc》由会员分享,可在线阅读,更多相关《课程设计(论文)-ASP.NET图书管理系统.doc(19页珍藏版)》请在三一文库上搜索。

1、 课 程 设 计 报 告课程设计名称:图书管理系统系 : 三系 学生姓名: 班 级: 学 号: 成 绩: 指导教师: 开课时间: 学年 学期 目 录第一章 前言3第二章 系统总体分析与设计32.1、需求分析32.2 功能需求32.2.1 新书入库42.2.2 借书42.2.3 还书42.2.4 图书查询42.3、结构设计52.4数据库设计5第三章 界面设计73.1 导航页面73.2 登录页面(LOGIN.ASPX)83.3 图书管理页面(book.aspx)93.4图书查询模块(booksearch.aspx)113.5 读者管理模块(Reader.aspx)123.6 借书管理(Borrow

2、Book.aspx)143.7 还书管理模块(ReturnBook.aspx)153.8好书推荐栏163.8.1 ASP.NET基础教程模块(B00k01.aspx)16第四章 数据入库174.1读者信息表174.2管理员表174.3还书记录表174.4借阅表184.5图书借出表184.6图书信息表18第五章 总结18第六章 参考文献19第一章 前言随着互联网的全面普及,基于互联网的电子商务也应运而生,并在近年来获得了巨大的发展,成为一种全新的商务模式,被许多经济专家认为是新的经济增长点。这种电子商务模式对管理水平、信息传递技术都提出了更高的要求,其中安全体系的构建又显得尤为重要。如何建立一个

3、安全、便捷的电于商务应用环境,对信息提供足够的保护,是商家和用户都十分关注的话题。第二章 系统总体分析与设计2.1、需求分析依照项目功能,需要建立的表有图书信息,类别,出版社信息,用户信息四大类。1、系统功能的基本要求:(1)图书信息的输入,包括图书的书名、出版号、价格、分类、作者、简介、出版社、出版日期、编号、数量等。(2)图书各种信息的修改与更新;(3)对于入库、借出、归还、报废、丢失等信息的记录、;(4)按照一定的条件,查询、统计符合条件的图书信息;至少应该包括每本图书按书名详细信息的查询、按借出归还状态查询、按作者查询、按出版社查询等,至少应该包括按分类、数量、价格等统计图书信息;(5

4、)对查询、统计的结果打印输出。2.2 功能需求本系统有新书入库、借书、还书、图书查询四大功能,共8项子功能。2.2.1 新书入库2.2.2 借书(1) 检查读者有效性(2) 检查读者资格(3)办理借书2.2.3 还书(1)办理还书(2)办理罚款2.2.4 图书查询(1)查询要求分类(2)查询读者(3)查询借书2.3、结构设计高校图书管理系统检查有效性图书管理图书查询读者管理系统维护新书入库修改读者增加读者还书借书查询读者删除读者查询借书用户管理日志管理基础信息管理查询分类数据导入导出2.4数据库设计采用的数据库是SQL SERVER2008 ,建立的图书管理系统数据库,该数据库下包含的几个表。

5、管理员表读者信息表还书记录表借阅表图书借出表图书信息表第三章 界面设计3.1 导航页面图一、导航页面3.2 登录页面(LOGIN.ASPX) 图二、登录页面登录按钮代码实现protected void Button1_Click(object sender, EventArgs e)/登录 string connstr = ConfigurationManager.ConnectionStrings图书管理系统ConnectionString.ConnectionString; SqlConnection conn = new SqlConnection(connstr); if (DropD

6、ownList1.Text = =请选择登录类别=) Response.Write(alert(请选择登录类别); return; if (DropDownList1.Text = 读者) string query = string.Format(select *from 读者信息表 where 借书证号=0 and 密码=1, TextBox2.Text.Trim(), TextBox3.Text.Trim(); SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); object ob = cmd.ExecuteScalar()

7、; if (ob = null) Response.Write(alert(借书证号和密码不符); return; else SessionLoginName = ob.ToString(); Response.Redirect(booksearch.aspx); conn.Close(); if (DropDownList1.Text = 管理员) string query = string.Format(select *from 管理员表 where 角色名=0 and 密码=1, TextBox2.Text.Trim(), TextBox3.Text.Trim(); SqlCommand

8、 cmd = new SqlCommand(query, conn); conn.Open(); object ob = cmd.ExecuteScalar(); if (ob = null) Response.Write(alert(角色名和密码不符); return; else SessionLoginName = ob.ToString(); Response.Redirect(booksearch.aspx); conn.Close(); 3.3 图书管理页面(book.aspx) 图三、图书管理页面主要代码实现(添加,删除) protected void Button1_Click(

9、object sender, EventArgs e)/图书添加 if (TextBox1.Text = | TextBox2.Text = | TextBox3.Text = | TextBox4.Text = | TextBox5.Text = | TextBox6.Text = | TextBox8.Text = | TextBox9.Text = ) Response.Write(alert(请输入完整); return; string sqlstr; SqlConnection conn = new SqlConnection(connstr); if (!string.IsNull

10、OrEmpty(FileUpload1.FileName) sqlstr = insert into 图书信息表(ISBN,书名,作译者,出版社,出版年月,价格,复本量,库存量,分类号,内容提要,封面照片)values( + TextBox1.Text.Trim() + , + TextBox2.Text.Trim() + , + TextBox3.Text.Trim() + , + TextBox4.Text.Trim() + , + TextBox5.Text.Trim() + , + TextBox6.Text.Trim() + , + TextBox9.Text.Trim() + ,

11、+ TextBox9.Text.Trim() + , + TextBox8.Text.Trim() + , + TextBox7.Text.Trim() + ,Photo); else sqlstr = insert into 图书信息表(ISBN,书名,作译者,出版社,出版年月,价格,复本量,库存量,分类号,内容提要,封面照片)values( + TextBox1.Text.Trim() + , + TextBox2.Text.Trim() + , + TextBox3.Text.Trim() + , + TextBox4.Text.Trim() + , + TextBox5.Text.Tr

12、im() + , + TextBox6.Text.Trim() + , + TextBox9.Text.Trim() + , + TextBox9.Text.Trim() + , + TextBox8.Text.Trim() + , + TextBox7.Text.Trim() + ); SqlCommand cmd = new SqlCommand(sqlstr,conn); if (!string.IsNullOrEmpty(FileUpload1.FileName) cmd.Parameters.Add(Photo,SqlDbType.VarBinary); cmd.Parameters

13、Photo.Value = FileUpload1.FileBytes; conn.Open(); cmd.ExecuteNonQuery(); protected void Button2_Click(object sender, EventArgs e)/图书删除 if (TextBox1.Text = ) Response.Write(alert(请输入ISBN); return; SqlConnection conn = new SqlConnection(connstr); string sqlStr = Delete from 图书信息表 whereISBN=+TextBox1.T

14、ext.Trim()+; SqlCommand cmd = new SqlCommand(sqlStr,conn); conn.Open(); int a = cmd.ExecuteNonQuery(); if (a 1) Response.Write(alert(数据库中没有此图书!); else Response.Write(alert(删除成功!); conn.Close(); 3.4图书查询模块(booksearch.aspx) 图四、图书查询页面查询按钮主要代码:protected void Button1_Click(object sender, EventArgs e)/查询 s

15、tring connStr = ConfigurationManager.ConnectionStrings图书管理系统ConnectionString.ConnectionString; SqlConnection conn = new SqlConnection(connStr); string query=select * from 图书信息表 where ISBN LIKE %+TextBox1.Text.Trim()+% and 书名 LIKE%+TextBox2.Text.Trim()+%; SqlCommand cmd = new SqlCommand(query,conn);

16、conn.Open(); SqlDataAdapter sda = new SqlDataAdapter(query, conn); DataSet ds = new DataSet();/定义一个数据集 sda.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); conn.Close(); 3.5 读者管理模块(Reader.aspx) 图五、读者管理页面主要代码(修改和查询按钮) protected void Button3_Click(object sender, EventArgs e)/修改 if (TextBox1.

17、Text = ) Response.Write(alert(请输入借书证号); return; SqlConnection conn = new SqlConnection(connstr); string sqlstr = update 读者信息表 set; if(TextBox2.Text.Trim()!=) sqlstr += 姓名= + TextBox2.Text.Trim() + ,; if (TextBox3.Text.Trim().ToString() != ) sqlstr += 出生时间= + TextBox3.Text.Trim() + ,; if (TextBox4.Te

18、xt.Trim()!= ) sqlstr += 密码= + TextBox4.Text.Trim() + ,; if (TextBox6.Text.Trim().ToString() != ) sqlstr += 备注= + TextBox6.Text.Trim() + ,; if (!string.IsNullOrEmpty(FileUpload1.FileName) sqlstr += 照片=Photo,; if (TextBox5.Text.Trim()!= ) sqlstr += 联系方式=Photo,; sqlstr += 专业= + DropDownList1.SelectedVa

19、lue + , + 性别= + RadioButtonList1.SelectedValue + ; sqlstr += where 借书证号= + TextBox1.Text.Trim() + ; SqlCommand cmd = new SqlCommand(sqlstr,conn); cmd.Parameters.Add(Photo,SqlDbType.VarBinary); cmd.ParametersPhoto.Value = FileUpload1.FileBytes; cmd.Parameters.Add(Addr, SqlDbType.Xml).Value = TextBox5

20、.Text.Trim(); conn.Open(); int yxh = cmd.ExecuteNonQuery(); if (yxh != 1) Response.Write(alert(数据库中无此读者); conn.Close(); protected void Button4_Click(object sender, EventArgs e)/查询 if (TextBox1.Text = ) Response.Write(alert(请输入借书证号); return; SqlConnection conn = new SqlConnection(connstr); string sql

21、strSelect = select密码,姓名,性别,出生时间,专业,借书量,照片,备注,联系方式,dbo.L_count1( + TextBox1.Text.Trim() + ) AS 借书次数 from 读者信息表 where 借书证号= + TextBox1.Text.Trim() + ; SqlCommand cmd = new SqlCommand(sqlstrSelect ,conn); conn.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read() TextBox2.Text = dr姓名.ToString()

22、; TextBox3.Text = dr出生时间.ToString(); TextBox4.Text = dr密码.ToString(); TextBox5.Text = dr联系方式.ToString(); TextBox6.Text = dr备注.ToString(); DropDownList1.Text=dr专业.ToString(); RadioButtonList1.Text=dr性别.ToString(); Label9.Text=dr借书量.ToString()+本; / Image1.ImageUrl = /Default2.aspx?id= + TextBox1.Text.

23、Trim() + &type=学生; Label12.Text = dr借书次数.ToString() + 次; Image1.ImageUrl = /Default2.aspx?id= + TextBox1.Text.Trim() + &type=学生; conn.Close(); 3.6 借书管理(BorrowBook.aspx) 图六、借书管理页面借书按钮主要代码:protected void Button1_Click(object sender, EventArgs e)/借书 string connstr = ConfigurationManager.ConnectionStrin

24、gs图书管理系统ConnectionString.ConnectionString; SqlConnection conn = new SqlConnection(connstr); SqlCommand cmd = new SqlCommand(Book_Borrow,conn); cmd.CommandType = CommandType.StoredProcedure; SqlParameter inReaderID = new SqlParameter(in_ReaderID,SqlDbType.Char,18); inReaderID.Direction = ParameterDir

25、ection.Input; inReaderID.Value = TextBox3.Text.Trim(); cmd.Parameters.Add(inReaderID); SqlParameter inISBN = new SqlParameter(in_ISBN,SqlDbType.Char,18); inISBN.Direction = ParameterDirection.Input; inISBN.Value = TextBox1.Text.Trim(); cmd.Parameters.Add(inISBN); SqlParameter inBookID = new SqlParam

26、eter(in_BookID, SqlDbType.Char, 10); inBookID.Direction = ParameterDirection.Input; inBookID.Value = TextBox2.Text.Trim(); cmd.Parameters.Add(inBookID); SqlParameter outReturn = new SqlParameter(out_str,SqlDbType.Char,30); outReturn.Direction = ParameterDirection.Input; cmd.Parameters.Add(outReturn)

27、; try conn.Open(); cmd.ExecuteNonQuery(); Response.Write(alert( + outReturn.Value.ToString() + ); SqlDataSource1.SelectCommand = select 姓名,ISBN,书名,出版社,价格,图书ID,结束时间 from RBL where 借书证号= + TextBox3.Text.Trim() + ; GridView1.DataBind(); catch Response.Write(alert(借书出错); finally conn.Close(); 3.7 还书管理模块

28、(ReturnBook.aspx) 图七、还书管理页面还书按钮主要代码:protected void Button1_Click(object sender, EventArgs e) string connStr = ConfigurationManager.ConnectionStrings图书管理系统ConnectionString.ConnectionString; SqlConnection conn = new SqlConnection(connStr); string query = delete from 借阅表 where 图书ID=+TextBox1.Text.Trim(

29、)+; SqlCommand cmd = new SqlCommand(query,conn); try conn.Open(); int i = cmd.ExecuteNonQuery(); if (i = 1) Response.Write(alert(还书成功); else Response.Write(alert(还书操作失败!没有此图书ID!); SqlDataSource1.SelectCommand = select 姓名,ISBN,书名,出版社,价格,图书ID,借书时间 from RBL where 借书证号 in (select 借书证号 from 还书记录表 where 图

30、书ID= + TextBox1.Text.Trim() + and 还书时间 in (select 还书时间 from 还书记录表); GridView1.DataBind(); finally conn.Close(); 3.8好书推荐栏3.8.1 ASP.NET基础教程模块(B00k01.aspx)第四章 数据入库4.1读者信息表4.2管理员表4.3还书记录表4.4借阅表4.5图书借出表4.6图书信息表第五章 总结通过这次的课程设计让我对于asp.Net的部分知识有了一定的认识和提高,例如关于和数据库的连接,关于sql语句和对于一些事件的处理。而且通过此次课程设计提高了自己的动手能力和独立

31、完成作业的能力,在此课程设计中, 我知道了该如何用来开发一个系统,及其相关的事件处理,和相应的页面布局。对于本系统,巧妙地运用ASP与SQL SERVER数据库的完美结合是开发成功的必要条件。我认为这个在图书管理系统中的采用用户控件的设计,比较具有新意,为其他网页的设计做了铺垫。简单明了,是本站的最大特点,但程序仍有不完整之处,那就是安全性的问题。 在整个的设计中我还有更深的体会,那就是想要开发一个好的程序,并不能太注重编码的设计,而使在于系统总体设计和如何分析系统并建立系统模型。严格按照软件工程一个软件设计步骤进行设计。当然也不是说编码的设计不重要,想要编好程序也应该具有良好的编码风格,这样在设计中才会得心应手。设计中还要博众家之长,在遇到困难时要多向老师和同学请教,毕竟一个人的知识有限,还要充分利用网上资源,从多渠道获取知识,多看看别人对程序的设计思想,会对自己有很大的帮助。第六章 参考文献1 华夏、陈新宇、ASP.NET案例开发教程.北京科海电子出版社,2010年9月2 陈广、林风. C#精编教程. 清华大学出版社,2007年1月3 红石丹. ASP.NET范列开发大全. 清华大学出版社,2010年1月4 黄明、梁旭、周绍斌. CSS设计教程. 电子工业出版社,2009年6月

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1