《数据库原理》课程设计-图书管理系统.doc_第1页
《数据库原理》课程设计-图书管理系统.doc_第2页
《数据库原理》课程设计-图书管理系统.doc_第3页
《数据库原理》课程设计-图书管理系统.doc_第4页
《数据库原理》课程设计-图书管理系统.doc_第5页
已阅读5页,还剩57页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

数据库原理课程设计报告题 目: 图书出租管理系统 学生姓名: 学 号: 班 级: 计科081 院 系: 计算机科学与信息学院 专业年级: 计算机科学与技术2008 级 2010 年 12 月 30 日一、需求分析 1.问题描述: 随着网络化时代的到来,图书出租信息的网络化可以大大节约人工和时间。为此可以开发出图书管理系统,广泛的应用于学校和工业、商业、企业、事业和行政等单位。实际上,该系统的实用性还是比较强的。2.系统功能描述(1)系统功能描述一个图书出租管理系统应该提供包括客户信息管理、图书信息管理、出版社信息管理、用户信息管理、租还书、综合查询等功能。1) 客户、图书、用户信息的数据模块提供增加、删除、改变和查询、浏览等基本的数据维护功能。2) 综合查询模块可以通过用户选择的数据表和相应的查询条件来查询相关内容。3) 客户租还书模块是图书出租管理系统的核心功能,实现客户和图书出租的交互。(2)功能模块划分图书出租管理系统的数据库功能主要体现在对各种信息的提供、保存、更新和查询操作上,包括图书信息、用户信息、客户信息和租借信息,各个部分的数据内容又有内在联系。针对该系统的数据特点,可以总结出如下的需求。A、用户和客户具有不同的身份。B、用户信息记录用户资料。C、客户信息记录客户的详细信息。D、图书信息记录图书的名称、出版社等信息。E、租借信息记录客户租借图书的信息。图书出租管理系统应该具有客户信息管理、图书信息管理、租还书和综合查询等功能。根据系统功能的需求分析,我们把该系统的功能划分为5个模块。A、客户信息维护模块B、图书信息维护模块C、用户信息管理模块D、客户租还书管理模块E、综合查询模块图书出租管理系统的功能模块如图所示系统管理员租书还书客户用户信息管理用户图书出租管理系统综合查询客户信息维护客户租还书信息管理图书信息维护其中,客户租还书管理模块包括以下3个子模块:A、租借图书B、归还图书C、查询租借信息客户信息维护模块包括以下5个子模块:A、增加客户信息B、删除客户信息C、修改客户信息D、查询客户信息E、遍历客户信息该模块图如下图所示:客户信息维护模块查询客户信息遍历客户信息删除客户信息修改客户信息增加客户信息同理,如图书信息管理、用户信息管理模块也被类似的分为增加、删除、修改、查询和遍历5个模块。(3)系统流程分析图书出租管理系统的开发首先要设计一个登录系统,用户只有输入了正确的用户名和密码方可进入系统内部。系统流程图如下图所示图书出租管理系统登录判断用户类型系统管理员客户信息维护租书还书客户用户信息管理用户综合查询客户租还书信息管理图书信息维护(4)数据流程图系统管理员用户客户查询用户表图书表客户表租借信息表增加修改删除查询查询(5)系统功能分析和需求总结后,设计如下的数据项和数据结构。A、图书信息,包括图书编号、图书名称、作者等数据项B、租书信息,包括客户编号、图书编号、租借日期等数据项。C、客户信息,包括客户编号、姓名、密码等数据项。D、用户信息,包括用户编号、密码、分类等数据项。3.系统使用权限方面该信息管理系统的角色可以分为3类:(1)普通用户:拥有客户信息维护、图书信息管理以及客户租还书管理、报表显示和综合查询的权限。(2)系统管理员:拥有客户信息维护、图书信息管理、用户信息管理以及客户租还书管理和综合查询权限。但其主要功能还是用户信息管理。(3)客户:租书和还书。二、数据库概念结构设计得到上面的数据项和数据结构后,就可以设计满足需求的各种实体及相互关系,再用实体-关系图,及E-R(Entiry-Relationship)图将这些内容表达出来,为后面的逻辑结构设计打下基础。在这个系统中,所存在的实体有:图书信息实体、租书信息实体、出版社信息实体、客户信息实体和用户信息实体,它们之间的关系如图所示。BookIDBookRemainBookNameBookAmountBookBookSortBookWriterBookPriceBookPublishBookPublishDate图书信息实体E-R图BorrowBookFactReturnDateReaderIDReturnDateBookIDBorrowDate租借书信息关系的属性E-RReaderReaderEmailReaderIDReaderPhoneNoReaderNameReaderBorrowBooksReaderPassword客户信息实体E-R图用户信息实体E-R图UserSortUserPasswordUserUserIDn管理查询与管理租借书书查询与管理用户客户1n实体及其联系的E-R图m1n1n三、逻辑结构设计1.模式设计: (1)关系模式:Book(BookID、BookName、BookWriter、BookPublish、BookPublishDate、BookPrice、BookSort、BookAmount、BookRemain)BorrowBook(ReaderID、BookID、BorrowDate、ReturnDate、FactReturnDate)Reader(ReaderID、ReaderName、ReaderPassword、ReaderPhoneNo、ReaderEmail、ReaderBorrowBooks)User(UserID、UserPassword、UserSort)(2)数字字典:图书表(Book)编号字段名称数据结构说明1BookIDnvarchar(50)图书编号2BookNamenvarchar(50)图书名称3BookWriternvarchar(20)图书作者4BookPublishnvarchar(50)出版社5BookPublishDatedatetime出版日期6BookPricefloat图书定价7BookSortnvarchar(50)图书分类8BookAmountint图书库存数量9BookRemainint现在库存数量租借信息表(BorrowBook)编号字段名称数据结构说明1ReaderIDchar(6)客户编号2BookIDnvarchar(50)图书编号3BorrowDatedatetime租借日期4ReturnDatedatetime应归还日期5FactReturnDatedatetime实际归还日期客户表(Reader)编号字段名称数据结构说明1ReaderIDchar(6)客户编号2ReaderNamevarchar(20)客户姓名3ReaderPasswordvarchar(10)客户密码4ReaderPhoneNovarchar(15)电话号码5ReaderEmailvarchar(50)电子邮箱6ReaderBorrowedBooksint借书数量用户表(User)编号字段名称数据结构说明1UserIDchar(10)用户编号2UserPasswordchar(10)用户密码3UserSortvarchar(10)用户分类在建立完所有数据表后,要根据数据表之间的关系在属性页中添加关系。为Book表和BorrowBook表之间添加FK_BorrowBook_Book关系,为Book表和PublishCompany之间添加FK_Book_PublishCompany关系,为Reader表和BorrowBook表之间添加FK_BorrowBook_Reader关系。同时在两关系中实现表间的级联更新和级联删除。(2)子模式设计:1)视图在图书出租管理系统中,为便于浏览目前客户租借图书的信息,创建了一个Borrow视图来显示租借记录中客户和所租借图书的一些详细信息以便以后综合浏览。该视图涉及到Book表、BorrowBook表和Reader表,三表间的联系及其各自想要显示的字段,如下图所示。a)三表间的联系b)数据字典2)存储过程在图书出租管理系统中,创建实现在客户租还书时对客户表中的客户所借书目和图书表中图书库存量的改变的存储过程和客户借书之前查询客户租借图书数目和图书库存量的存储过程。 图书出租管理系统中,需要创建6个存储过程,分别为:a) ReaderBorrowedNumber 存储过程 该存储过程负责获取客户已经租借的图书数目。其目的是为了在客户租借图书之前判断此客户是否达到借书数目的上限。b) BookNumber 存储过程 此存储过程的功能是根据输入的图书编号得到该图书现在的库存数量。c) BorrowReader 存储过程 当客户租借某种图书后,该存储过程向客户表的客户的目前所借图书一项添加1。d) BorrowBook 存储过程 当客户租借某种图书后,该存储过程向图书表的相应的图书库现存量中减去1。e) ReturnReader存储过程 当客户归还所借的图书时,该存储过程在客户表中把客户所借的图书数量减1。f) ReturnBook存储过程 当客户归还所借的图书时,该存储过程在图书表中相应的图书现存量中增加1。四、数据库的物理设计为了提高在表中搜索元组的速度,于是在各表中分别建立关于主键升序的索引,如下:1.User表的PK_User索引(以UserID的升序建立的)2.Reader表的PK_Reader索引(以ReaderID的升序建立的)3.BorrowBook表的PK_BorrowBook索引(以ReaderID、BookID的升序建立的)4.Book表的PK_Book索引(以BookID的升序建立的)五、数据库设计实现及运行由同组同学完成六、界面与数据库的连接由同组同学完成七、界面的实现(模块中的功能实现)【开发工具:Visual Studio 2000用户登录界面由同组同学完成系统主控界面由同组同学完成用户信息管理界面由同组同学完成由主控界面点击客户信息进入客户信息管理界面点击“添加”,可添加记录,截图如下:点击“修改”,可对记录进行修改,截图如下:点击“删除”,可对记录进行删除,截图如下:代码:namespace Library/ / Reader 的摘要说明。/ public class Reader : System.Windows.Forms.Formprivate System.Windows.Forms.GroupBox groupBox1;private System.Windows.Forms.Label label1;private System.Windows.Forms.Label label2;private System.Windows.Forms.Label label3;private System.Windows.Forms.Label label4;private System.Windows.Forms.Label label5;private System.Data.SqlClient.SqlConnection sqlConnection1;private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;private System.Windows.Forms.Button btnFirst;private System.Windows.Forms.Button btnLast;private System.Windows.Forms.Button btnNext;private System.Windows.Forms.Button btnPrevious;private System.Windows.Forms.Button btnExit;private System.Windows.Forms.Button btnAdd;private System.Windows.Forms.Button btnModify;private System.Windows.Forms.Button btnDelete;private System.Windows.Forms.GroupBox groupBox3;private System.Windows.Forms.Label label7;private System.Windows.Forms.TextBox textPassword;private System.Windows.Forms.Button btnCancel;private System.Windows.Forms.Button btnApply;private System.Windows.Forms.TextBox textBorrowBooks;private System.Windows.Forms.TextBox textEmail;private System.Windows.Forms.TextBox textTelNo;private System.Windows.Forms.TextBox textName;private System.Windows.Forms.TextBox textId;private System.Windows.Forms.Label lblDatasetPosition;private System.Data.SqlClient.SqlCommand sqlSelectCommand1;private System.Data.SqlClient.SqlCommand sqlInsertCommand1;private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;private Library.DataSetReader objDataSetReader;/ / 必需的设计器变量。/ private System.ComponentModel.Container components = null;public Reader()/ Windows 窗体设计器支持所必需的/InitializeComponent();/ TODO: 在InitializeComponent 调用后添加任何构造函数代码/ / 清理所有正在使用的资源。/ protected override void Dispose( bool disposing )if( disposing )if(components != null)components.Dispose();base.Dispose( disposing );#region Windows 窗体设计器生成的代码/ / 设计器支持所需的方法- 不要使用代码编辑器修改/ 此方法的内容。/ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Reader); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.textPassword = new System.Windows.Forms.TextBox(); this.objDataSetReader = new Library.DataSetReader(); this.label7 = new System.Windows.Forms.Label(); this.textEmail = new System.Windows.Forms.TextBox(); this.textName = new System.Windows.Forms.TextBox(); this.textId = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.textTelNo = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.textBorrowBooks = new System.Windows.Forms.TextBox(); this.btnFirst = new System.Windows.Forms.Button(); this.btnLast = new System.Windows.Forms.Button(); this.btnNext = new System.Windows.Forms.Button(); this.btnPrevious = new System.Windows.Forms.Button(); this.lblDatasetPosition = new System.Windows.Forms.Label(); this.btnCancel = new System.Windows.Forms.Button(); this.btnApply = new System.Windows.Forms.Button(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.btnExit = new System.Windows.Forms.Button(); this.btnAdd = new System.Windows.Forms.Button(); this.btnModify = new System.Windows.Forms.Button(); this.btnDelete = new System.Windows.Forms.Button(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox1.SuspendLayout(); (System.ComponentModel.ISupportInitialize)(this.objDataSetReader).BeginInit(); this.groupBox3.SuspendLayout(); this.SuspendLayout(); / / groupBox1 / this.groupBox1.BackColor = System.Drawing.Color.Transparent; this.groupBox1.Controls.Add(this.textPassword); this.groupBox1.Controls.Add(this.label7); this.groupBox1.Controls.Add(this.textEmail); this.groupBox1.Controls.Add(this.textName); this.groupBox1.Controls.Add(this.textId); this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.textTelNo); this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.textBorrowBooks); this.groupBox1.Font = new System.Drawing.Font(宋体, 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)(134); this.groupBox1.Location = new System.Drawing.Point(16, 16); this.groupBox1.Name = groupBox1; this.groupBox1.Size = new System.Drawing.Size(408, 160); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = 客户信息维护; this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter); / / textPassword / this.textPassword.DataBindings.Add(new System.Windows.Forms.Binding(Text, this.objDataSetReader, Reader.ReaderPassword, true); this.textPassword.Location = new System.Drawing.Point(88, 80); this.textPassword.Name = textPassword; this.textPassword.Size = new System.Drawing.Size(100, 23); this.textPassword.TabIndex = 13; / / objDataSetReader / this.objDataSetReader.DataSetName = DataSetReader; this.objDataSetReader.Locale = new System.Globalization.CultureInfo(zh-CN); / / label7 / this.label7.Location = new System.Drawing.Point(16, 88); this.label7.Name = label7; this.label7.Size = new System.Drawing.Size(72, 23); this.label7.TabIndex = 12; this.label7.Text = 客户口令; / / textEmail / this.textEmail.DataBindings.Add(new System.Windows.Forms.Binding(Text, this.objDataSetReader, Reader.ReaderEmail, true); this.textEmail.Location = new System.Drawing.Point(288, 16); this.textEmail.Name = textEmail; this.textEmail.Size = new System.Drawing.Size(100, 23); this.textEmail.TabIndex = 10; / / textName / this.textName.DataBindings.Add(new System.Windows.Forms.Binding(Text, this.objDataSetReader, Reader.ReaderName, true); this.textName.Location = new System.Drawing.Point(88, 48); this.textName.Name = textName; this.textName.Size = new System.Drawing.Size(100, 23); this.textName.TabIndex = 8; / / textId / this.textId.DataBindings.Add(new System.Windows.Forms.Binding(Text, this.objDataSetReader, Reader.ReaderID, true); this.textId.Location = new System.Drawing.Point(88, 16); this.textId.Name = textId; this.textId.Size = new System.Drawing.Size(100, 23); this.textId.TabIndex = 7; / / label4 / this.label4.Location = new System.Drawing.Point(216, 24); this.label4.Name = label4; this.label4.Size = new System.Drawing.Size(72, 23); this.label4.TabIndex = 3; this.label4.Text = 电子邮件; / / label2 / this.label2.Location = new System.Drawing.Point(16, 56); this.label2.Name = label2; this.label2.Size = new System.Drawing.Size(72, 23); this.label2.TabIndex = 1; this.label2.Text = 客户姓名; / / label1 / this.label1.Location = new System.Drawing.Point(16, 24); this.label1.Name = label1; this.label1.Size = new System.Drawing.Size(72, 23); this.label1.TabIndex = 0; this.label1.Text = 客户编号; / / label3 / this.label3.Location = new System.Drawing.Point(216, 56); this.label3.Name = label3; this.label3.Size = new System.Drawing.Size(64, 23); this.label3.TabIndex = 2; this.label3.Text = 联系电话; / / textTelNo / this.textTelNo.DataBindings.Add(new System.Windows.Forms.Binding(Text, this.objDataSetReader, Reader.ReaderPhoneNo, true); this.textTelNo.Location = new System.Drawing.Point(288, 48); this.textTelNo.Name = textTelNo; this.textTelNo.Size = new System.Drawing.Size(100, 23); this.textTelNo.TabIndex = 9; / / label5 / this.label5.Location = new System.Drawing.Point(216, 88); this.label5.Name = label5; this.label5.Size = new System.Drawing.Size(72, 23); this.label5.TabIndex = 4; this.label5.Text = 已租书目; / / textBorrowBooks / this.textBorrowBooks.DataBindings.Add(new System.Windows.Forms.Binding(Text, this.objDataSetReader, Reader.ReaderBorrowedbooks, true); this.textBorrowBooks.Location = new System.Drawing.Point(288, 80); this.textBorrowBooks.Name = textBorrowBooks; this.textBorrowBooks.Size = new System.Drawing.Size(100, 23); this.textBorrowBooks.TabIndex = 11; / / btnFirst / this.btnFirst.BackColor = System.Drawing.Color.Transparent; this.btnFirst.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnFirst.Image = (System.Drawing.Image)(resources.GetObject(btnFirst.Image); this.btnFirst.Location = new System.Drawing.Point(128, 136); this.btnFirst.Name = btnFirst; this.btnFirst.Size = new System.Drawing.Size(32, 24); this.btnFirst.TabIndex = 1; this.btnFirst.UseVisualStyleBackColor = false; this.btnFirst.Click += new System.EventHandler(this.btnFirst_Click); / / btnLast / this.btnLast.BackColor = System.Drawing.Color.Transparent; this.btnLast.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnLast.Image = (System.Drawing.Image)(resources.GetObject(btnLast.Image); this.btnLast.Location = new System.Drawing.Point(272, 136); this.btnLast.Name = btnLast; this.btnLast.Size = new System.Drawing.Size(32, 24); this.btnLast.TabIndex = 2; this.btnLast.UseVisualStyleBackColor = false; this.btnLast.Click += new System.EventHandler(this.btnLast_Click); / / btnNext / this.btnNext.BackColor = System.Drawing.Color.Transparent; this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnNext.Image = (System.Drawing.Image)(resources.GetObject(btnNext.Image); this.btnNext.Location = new S

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论