当前位置:文档之家› 程序设计实训报告

程序设计实训报告

重庆交通大学信息科学与工程院课程设计报告书专业:计算机科学与技术课程设计名称:程序设计实训(一)题目:物资管理系统系统班级:14级计科一班设计者:杜菲学号:631406010121指导教师:李韧完成时间:2015年12月19日同组人员:任中豪,李芸倩,刘兴一.功能概括首先声明,我们将”物资”特定为”图书”,在此基础上实现了物资管理系统。

随着社会的发展,对知识的需求也不断地增长。

在这种形势下,书籍就渐渐地成为人们获取并增长知识的主要途径,而图书馆就自然而然地在人们的生活中占据了一定的位置,如何科学地管理图书馆不但关系到读者求知的方便程度,也关系到图书馆的发展,因此,开发一套完善的图书馆管理系统就成不可少了。

图书馆在正常运行中总是面对大量的读者信息、书籍信息以及两者相互作用产生的借书信息、还书信息。

因此需要对读者资源、书籍资源、借书信息、还书信息进行管理,及时了解各个环节中信息的变更,以此提该高管理效率。

图书管理系统使用便捷,能及时准确的记录用户信息,为用户提供丰富的图书信息。

图书管理系统能够优化图书资源、方便学生借阅。

节省人力资源。

从图书的入库登记到查询浏览,从借书证发放到图书的借阅,形成了一个整体自动化管理模式,从软件工程的角度进行了科学而严谨的阐述。

通过一个图书馆管理信息系统,使图书馆的信息管理工作系统化、规范化、自动化,从而达到提高企业人事管理效率的目的。

该程序的主要功能为:将平台分为用户模块与管理员模块,普通用户在注册,登录后可以在该网页上搜索加盟书店的书籍进行预约,并可以实现电子书的上传与下载;管理员在登录后在普通用户的基础上,还可以进行所属书店的预约查询与确定借阅,并上传书籍信息,拥有店长权限的管理员可以注册自己所属书店的管理员。

二.概述目的复习、领会、巩固和运用软件工程课堂上所学的软件开发方法和知识,综合应用本专业所学习的多门课程,了解软件工具与环境对于项目开发的重要性,并且重点深入掌握好一、两种较新或较流行的软件工具或计算机应用技术。

三.开发环境1、开发环境:Visual Studio 20102、数据库:Sql Server 2008四.流程结构项目的需求分析系统主要有两类用户:管理员和读者。

管理员负责图书的管理和读者的管理及还书处理;读者可以查询图书、借阅及查看所借图书。

系统功能结构图如下:结构示意图四.分工情况李芸倩:用户注册,管理员注册页面。

杜菲:登录,密码修改页面。

刘兴:验证码,数据库,个人信息完善页面。

任中豪:电子书上传与下载,图书预约,图书信息上传,我的预约,确定借阅。

五.主要代码及分析(一)登陆页面页面展示主要代码:ing System;ing System.Collections.Generic;ing System.Linq;ing System.Web;ing System.Web.UI;ing System.Web.UI.WebControls;ing System.Data;ing System.Data.SqlClient;ing System.Web.Security;10.u sing System.Configuration;11.n amespace 物资管理系统.Web12.{13. public partial class Login : System.Web.UI.Page14. {15. protected void Page_Load(object sender, EventArgs e)16. {17. }18. protected void Button1_Click(object sender, EventArgs e)19. {20. string code = TextCode.Text;21. if (Request.Cookies["CheckCode"].Value == code)22. {23. //创建数据库连接24. SqlConnection cno =25. new SqlConnection(@"Data Source=DESKTOP-N08MPTA;26. Initial Catalog=db_getpass;27. Integrated Security=True");28. cno.Open();29. //使用MD5加密30. Stringpass=FormsAuthentication.HashPasswordForStoringInConfigFile31. (TextPass.Text, "MD5");32.//定义命令语句33. //string sqlsel =34. "select count(*) from db_user where username='"35. + TextName.Text + "' and userpass='" + pass + "'";36. string sqlsel = "select count(*) from db_userwhere username=@name and userpass=@pass";37. SqlCommand com = new SqlCommand(sqlsel, cno);38. com .Parameters.Add39. (new SqlParameter ("name",SqlDbType .VarChar ,20));40. com.Parameters["name"].Value = TextName.Text;41. com.Parameters.Add42. (new SqlParameter("pass", SqlDbType.VarChar, 50));43. com.Parameters["pass"].Value = pass;44. if (Convert.ToInt32(com.ExecuteScalar()) > 0)45. {46. Session["username"] =TextName.Text;47. Session["userpass"] = pass;48. sqlsel = "select * from db_user49. where username='" + TextName.Text + "'50. and userpass='" + pass + "'";51. SqlCommand c = new SqlCommand(sqlsel, cno);52. SqlDataReader reader = c.ExecuteReader();53. while (reader.Read())54. {55. Session["score"] =(int)reader["score"];56. }57. reader.Close();58. //转到管理首页Response.Redirect("Admin_Index.Aspx");59. RegisterStartupScript60. ("", "<script>alert('登录成功');61. location='person.aspx'</script>");62. }63. else64. {65. RegisterStartupScript66.("", "<script>alert('用户名或密码输入错误')</script>");67. }68. cno.Close();69. }70. else71. {72. RegisterStartupScript73.("", "<script>alert('验证码输入错误')</script>");74. //Response.Write("<scriptlanguage='javascript'> window.alert('验证码输入错误!');</script >");75. }76. }77. protected void Button3_Click(object sender,EventArgs e)78. {79. TextName.Text = "";80. TextPass.Text = "";81. TextCode.Text = "";82. }83. protected void Button2_Click(object sender, EventArgs e)84. {85. string code = TextCode.Text;86. if (Request.Cookies["CheckCode"].Value ==code)87. {88. SqlConnection cno =89. new SqlConnection(@"DataSource=DESKTOP-N08MPTA;90. Initial Catalog=db_getpass;91. Integrated Security=True");92. cno.Open();93. //使用MD5加密94. string pass =FormsAuthentication.HashPasswordForStoringInConfigFile95.(TextPass.Text, "MD5");96. //定义命令语句97. string sqlsel = "select count(*) from adminwhere adminname='" + TextName.Text + "'and adminpass='" + pass + "'";98. SqlCommand com = new SqlCommand(sqlsel, cno);99. if (Convert.ToInt32(com.ExecuteScalar()) > 0) 100. {101. Session["username"] = Session["adminname"] = TextName.Text;102. Session["userpass"] =Session["adminpass"] = pass;103. sqlsel = "select * from db_user where username='"+ TextName.Text + "' and userpass='" + pass + "'";104. SqlCommand c = new SqlCommand(sqlsel, cno);105. SqlDataReader reader = c.ExecuteReader();106. while (reader.Read())107. {108. Session["score"] = (int)reader["score"];109. }110. reader.Close();111. sqlsel = "select * from admin112. where adminname='" + TextName.Text + "' 113. and adminpass='" + pass + "'"; 114. SqlCommand c1 = new SqlCommand(sqlsel, cno); 115. SqlDataReader reader1 = c1.ExecuteReader(); 116. while (reader1.Read())117. {118. Session["bookstore"] =(string)reader1["bookstore"];119. Session["host"] = (string)reader1["ishost"]; 120. Session["adress"] = (string)reader1["adress"]; 121. }122. reader1.Close();123. RegisterStartupScript124. ("", "<script>alert('登录成功');125.location='person.aspx'</script>");126. }127. else128. {129. RegisterStartupScript130. ("", "<script>alert('用户名或密码输入错误')</script>");131. }132. cno.Close();133. }134. else135. {136. RegisterStartupScript137. ("", "<script>alert('验证码输入错误')</script>");138. //Response.Write139.("<script language='javascript'> window.alert('验证码输入错误!');</script >");140. }141. }142.143. }144.}(二)密码修改页面展示主要代码ing System;ing System.Collections.Generic;ing System.Linq;ing System.Web;ing System.Web.UI;ing System.Web.UI.WebControls;ing System.Data;ing System.Data.SqlClient;ing System.Web.Security;10.u sing System.Configuration;11.n amespace 物资管理系统12.{13. public partial class WebForm3 : System.Web.UI.Page14. {15. protected void Page_Load(object sender, EventArgs e)16. {17. }18. protected void Button2_Click(object sender, EventArgs e)19. {20. TextBox1.Text = null;21. Textpass1.Text = null;22. Textpass2.Text = null;23. }24. protected void Button1_Click(object sender, EventArgs e)25. {26. string pass1 =FormsAuthentication.HashPasswordForStoringInConfigFile27. (TextBox1.Text, "MD5");28. string pass2 =Session["userpass"].ToString();29. SqlCommand cmd = new SqlCommand();30. if (pass1 == pass2)31. {32. string pass=33.F ormsAuthentication.HashPasswordForStoringInConfigFile34.(Textpass1.Text, "MD5");35. string sqlsel =36." update db_user set userpass='"37. + pass + "'where username='"38. + Session["username"].ToString() + "'";39. SqlConnection cno =40. new SqlConnection41. (@"DataSource=DESKTOP-N08MPTA;42. Initial Catalog=db_getpass;43. Integrated Security=True");44. cno.Open();45. mandText = sqlsel;46. cmd.Connection =cno ;47. int i = (int)cmd.ExecuteNonQuery();48. if (i > 0)49. {50. if (Session["adminname"] != null)51. {52. sqlsel =53. "update admin set adminpass='"54. + pass + "'where adminname='"55. + Session["adminname"].ToString() + "'";56. mandText = sqlsel;57. cmd.Connection = cno;58. i = (int)cmd.ExecuteNonQuery();59. }60. Response.Write61. ("<script>alert(\"密码修改成功!,必须重新登录\");62. location='Login.aspx'</script>");63. }64. else65. {66. Response.Write67. ("<script>alert(\"密码修改失败!\");</script>");68. }69. cno.Close();70.71. }72. }73. }74.}六.总结课程设计是培养学生综合运用所学知识,发现,提出,分析和解决实际问题,锻炼实践能力的重要环节,是对学生实际工作能力的具体训练和考察过程.经过几周的设计和开发,图书管理信息系统基本开发完毕。

相关主题