




已阅读5页,还剩42页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
毕业设计_图书管理系统 一、数据库设计数据库设CREATEDATABASETSGL GO USETSGL GO CREATETABLEBmanage( bId varchar(10)PRIMARYKEY,bNamevarchar(50),-添加图书-图书编号-书名bNumbervarchar(10),-书数目) GO bSorevarchar(50)-分类CREATETABLEMadmin( mNamevarchar(10)PRIMARYKEY,mPwdvarchar(25),mAgevarchar(8),mSexvarchar(4),mNumbervarchar(15),mrolevarchar(8) GO -图书员管理-图书管理员姓名-图书管理员密码-图书管理员年龄-图书管理员性别-图书管理员电话-图书管理员角色CREATETABLEReader( rSnovarchar(10)PRIMARYKEY,rNamevarchar(10),rPwdvarchar(25),rAgevarchar(8),rSexvarchar(4),rStatevarchar(8),rNumbervarchar(15),rEmailvarchar(25),-读者信息表reader -读者号-姓名-密码-年龄-性别-状态-电话号码-电子邮件rAdressvarChar(50),-地址) GO rGradevarChar(15),rClassvarchar(15),rRolevarchar(8)-年级-班级-角色CREATETABLERrecord( rSnovarchar(10)PRIMARYKEY,rNamevarChar(10),bId varchar(10),bNamevarChar(50),bTimevarchar(10),bBackTimevarchar(10) GO CREATETABLESysSet( rRolevarchar(8)PRIMARYKEY,rStatevarchar(8),Finefloat(25),rDayvarchar(8)-读者编号学号-读者姓名-图书编号-图书名称-借书时间-还书时间-读者角色-读者可借书数-过期罚款设置-可借书天数)二、界面截图及说明1)登录窗口(实现管理员和馆长的登陆) 2)管理员窗口 3)馆长窗口 4)关于窗口 5)新增图书窗口 6)新增管理员、查找及修改窗口 7)新增读者、查找及修改窗口 8)图书的查找及修改窗口 9)借阅窗口 10)系统设置窗口 三、主要代码主要代1)登录窗口(实现管理员和馆长的登陆) 登陆检查: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using prjTSGL.ClassLib.DBAccess; namespace prjTSGL.ClassLib.Logic classclsLoginCheck publicstaticDataTable CheckLogin(string UserId, string PWD) string SQLstmt = select mName,mPwd,mRole from Madmin where mName= + UserId + and mPwd= + PWD + ; DataTable dt = clsGlobalVar.GetDataTable(SQLstmt); return dt; 登陆: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using prjTSGL.ClassLib.Logic; namespace prjTSGL.TSGL_UI publicpartialclassfrmLogin : Form public frmLogin() InitializeComponent(); privatevoid btnLogin_Click(object sender, EventArgs e) string strUserID = loginid.Text.Trim(); string strPWD = loginpwd.Text.Trim(); string type = ; try DataTable dt = clsLoginCheck.CheckLogin(strUserID, strPWD); if (dt.Rows.Count = 0) MessageBox.Show(登陆失败,请重新输入!); loginpwd.Focus(); return; else type = dt.Rows0mRole.ToString().Trim(); if (cboLT.Text.Trim()=馆长 ) if (type = 馆长) this.Hide(); frmManager objManager = newfrmManager(); objManager.Show(); else MessageBox.Show(您没有权限!); loginpwd.Focus(); return; else if (type =管理员) this.Hide(); frmAdmin objAdmin = newfrmAdmin(); objAdmin.Show(); else MessageBox.Show(您没有权限!); loginpwd.Focus(); return; catch (Exception ex) throw ex; privatevoid btnExit_Click(object sender, EventArgs e) this.Close(); 2)管理员窗口 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace prjTSGL.TSGL_UI publicpartialclassfrmAdmin : Form public frmAdmin() InitializeComponent(); privatevoid ShowForm(Form frmToShow) this.Cursor = Cursors.WaitCursor; foreach (Form frmChild inthis.MdiChildren) if (frmChild.GetType() = frmToShow.GetType() frmToShow.Dispose(); frmChild.Activate(); this.Cursor = Cursors.Default; return; frmToShow.MdiParent = this; frmToShow.Show(); this.Cursor = Cursors.Default; privatevoid 读者信息修改ToolStripMenuItem_Click(object sender, EventArgs e) ShowForm(newfrmUpdateReader(); privatevoid 新增图书ToolStripMenuItem_Click(object sender, EventArgs e) ShowForm(newfrmAddNewBook(); privatevoid 图书的查找和修改ToolStripMenuItem_Click(object sender, EventArgs e) ShowForm(newfrmUpdateBook(); privatevoid 流通管理ToolStripMenuItem_Click(object sender, EventArgs e) ShowForm(newfrmBorrow(); privatevoid 帮助ToolStripMenuItem_Click(object sender, EventArgs e) ShowForm(newfrmAbout(); privatevoid 退出ToolStripMenuItem_Click(object sender, EventArgs e) Application.Exit(); 3)馆长窗口 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace prjTSGL.TSGL_UI publicpartialclassfrmManager : Form public frmManager() InitializeComponent(); privatevoid ShowForm(Form frmToShow) this.Cursor = Cursors.WaitCursor; foreach (Form frmChild inthis.MdiChildren) if (frmChild.GetType() = frmToShow.GetType() frmToShow.Dispose(); frmChild.Activate(); this.Cursor = Cursors.Default; return; frmToShow.MdiParent = this; frmToShow.Show(); this.Cursor = Cursors.Default; privatevoid frmManager_FormClosed(object sender, FormClosedEventArgs e) Application.Exit(); privatevoid 管理员信息管理ToolStripMenuItem_Click_1(object sender, EventArgs e) ShowForm(newfrmSelectAdmin(); privatevoid 系统设置ToolStripMenuItem_Click_1(object sender, EventArgs e) ShowForm(newfrmSys(); privatevoid 关于ToolStripMenuItem_Click(object sender, EventArgs e) ShowForm(newfrmAbout(); privatevoid 退出ToolStripMenuItem_Click_1(object sender, EventArgs e) Application.Exit(); 4)关于窗口 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace prjTSGL.TSGL_UI publicpartialclassfrmAbout : Form public frmAbout() InitializeComponent(); privatevoid button1_Click(object sender, EventArgs e) this.Close(); 5)新增图书窗口 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using prjTSGL.ClassLib.DBAccess; namespace prjTSGL.TSGL_UI publicpartialclassfrmAddNewBook : Form public frmAddNewBook() InitializeComponent(); privatebool ValidatInput() if (textBox1.Text = ) MessageBox.Show(请输入图书编号!, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); returnfalse; if (textBox2.Text = ) MessageBox.Show(请输入图书名称!, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); textBox2.Focus(); returnfalse; if (textBox3.Text = ) MessageBox.Show(请输入图书数目!, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); textBox3.Focus(); returnfalse; if (comboBox1.Text = ) MessageBox.Show(请选择图书类别!, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); textBox3.Focus(); returnfalse; returntrue; privatevoid btnOK_Click_1(object sender, EventArgs e) if (ValidatInput() /string id = textBox1.Text; /string name = textBox2.Text; /string Number = textBox3.Text; /string sore = comboBox1.Text; string sql = SELECT *FROM Bmanage WHERE bId= + textBox1.Text.Trim() + ; DataTable dt = clsGlobalVar.GetDataTable(sql); if (dt.Rows.Count = 0) string SQL = insert into Bmanage(bId,bName,bNumber,bSore)values( + textBox1.Text.Trim() + , + textBox2.Text.Trim() + , + textBox3.Text.Trim() + ,+ comboBox1.Text.Trim() + ); try bool result = clsGlobalVar.ExecSQL(SQL); if (result) MessageBox.Show(添加成功!, 操作提示, MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Text = ; textBox2.Text = ; textBox3.Text = ; comboBox1.Text = ; textBox1.Focus(); else MessageBox.Show(添加失败!, 操作提示, MessageBoxButtons.OK, MessageBoxIcon.Error); catch (Exception ex) MessageBox.Show(操作数据库出错!, 操作演示, MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.Message); else MessageBox.Show(图书编号已存在!, 操作提示, MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); privatevoid btnCancel_Click(object sender, EventArgs e) this.Close(); 6)新增管理员、查找及修改窗口 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using prjTSGL.ClassLib.DBAccess; namespace prjTSGL.TSGL_UI publicpartialclassfrmSelectAdmin : Form public frmSelectAdmin() InitializeComponent(); string name = ; string SQL = ; string PWD = ; string Age = ; string Sex = ; string Tel = ; string Role = ; privatevoid SelectAdmin() string strfilter = ; string SQL = select mName AS 用户名,mPwd AS 密码,mAge AS 年龄 ,mSex AS 性别,mNumber AS 电话,mRole AS 角色 from Madmin ; if (txtName.Text = ) strfilter = ; else strfilter = where mName= + txtName.Text.Trim() + ; try DataTable dt = clsGlobalVar.GetDataTable(SQL + strfilter); int intIndex = 0; if (dt.Rows.Count = 0) MessageBox.Show(抱歉,没有您要找的用户!, 结果提示, MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Text = ; txtPWD.Text = ; txtAge.Text = ; cboSex.Text = ; txtTel.Text = ; cboRole.Text = ; else LV.Columns.Clear(); LV.Items.Clear(); LV.Columns.Add(序号, 100, HorizontalAlignment.Center); for (int intJ = 0; intJ dt.Columns.Count; intJ+) LV.Columns.Add(dt.ColumnsintJ.ColumnName, 200, HorizontalAlignment.Center); for (int intI = 0; intI dt.Rows.Count; intI+) intIndex = intI + 1; LV.Items.Add(intIndex.ToString(); LV.ItemsintI.SubItems.Add(dt.RowsintI用户名.ToString().Trim(); LV.ItemsintI.SubItems.Add(dt.RowsintI密码.ToString().Trim(); LV.ItemsintI.SubItems.Add(dt.RowsintI年龄.ToString().Trim(); LV.ItemsintI.SubItems.Add(dt.RowsintI性别.ToString().Trim(); LV.ItemsintI.SubItems.Add(dt.RowsintI电话.ToString().Trim(); LV.ItemsintI.SubItems.Add(dt.RowsintI角色.ToString().Trim(); /连接数据库,将数据读取出放入MadminData catch (Exception ex) MessageBox.Show(查询数据库出错!, 提示, MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.Message); privatevoid btnSearch_Click(object sender, EventArgs e) SelectAdmin();/调用函数 /实现修改功能 privatevoid btnUpdata_Click(object sender, EventArgs e) if (txtName.Text = | cboRole.Text=) MessageBox.Show(请选择要修改的用户!); else SQL = UPDATE Madmin SET mName= + txtName.Text.Trim() + ,mPwd= + txtPWD.Text.Trim() + ,mAge= + txtAge.Text.Trim() + ,mSex= + cboSex.Text.Trim() + ,mNumber= + txtTel.Text.Trim() + ,mRole= + cboRole.Text.Trim() + where mName= + name + AND mPwd= + PWD + AND mAge= + Age + AND mSex= + Sex + AND mNumber= + Tel + AND mRole= + Role + ; try bool result = clsGlobalVar.ExecSQL(SQL); if (result) /txtName.Text = ; txtPWD.Text = ; txtAge.Text = ; cboSex.Text = ; txtTel.Text = ; cboRole.Text = ; MessageBox.Show(修改已成功); SelectAdmin(); else MessageBox.Show(更新失败!, 操作提示, MessageBoxButtons.OK, MessageBoxIcon.Error); catch (Exception ex) MessageBox.Show(操作数据库出错!, 操作演示, MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.Message); privatevoid btnExit_Click(object sender, EventArgs e) this.Close(); privatevoid LV_SelectedIndexChanged_1(object sender, EventArgs e) txtName.Text = LV.FocusedItem.SubItems1.Text.Trim(); txtPWD.Text = LV.FocusedItem.SubItems2.Text.Trim(); txtAge.Text = LV.FocusedItem.SubItems3.Text.Trim(); cboSex.Text = LV.FocusedItem.SubItems4.Text.Trim(); txtTel.Text = LV.FocusedItem.SubItems5.Text.Trim(); cboRole.Text = LV.FocusedItem.SubItems6.Text.Trim(); name = LV.FocusedItem.SubItems1.Text.Trim(); PWD = LV.FocusedItem.SubItems2.Text.Trim(); Age = LV.FocusedItem.SubItems3.Text.Trim(); Sex = LV.FocusedItem.SubItems4.Text.Trim(); Tel = LV.FocusedItem.SubItems5.Text.Trim(); Role = LV.FocusedItem.SubItems6.Text.Trim(); privatevoid frmSelectAdmin_Load(object sender, EventArgs e) this.btnSearch_Click(sender, e); privatevoid btnAdd_Click(object sender, EventArgs e) if (txtName.Text = | txtPWD.Text = | txtAge.Text = |cboSex.Text = | txtTel.Text= |cboRole.Text = ) MessageBox.Show(请至少输入用户名,密码和角色!); else SQL = SELECT mName,mPwd,mAge ,mSex,mNumber,mRole from Madmin WHERE mName= + txtName.Text.Trim() + ; DataTable dt = clsGlobalVar.GetDataTable(SQL); if (dt.Rows.Count = 0) SQL
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025版企业税收筹划与财务优化咨询合同
- 2025年度大学生创新创业实习基地合作协议
- 2025版石子买卖合同标准文本
- 2025版挖掘机运输与现场安装指导合同
- 2025版智能热水器远程监控与紧急维修合同
- 河北省安平县2025年上半年事业单位公开遴选试题含答案分析
- 2025版砂石厂爆破施工安全培训与考核合同
- 2025创业项目网络直播带货渠道合作协议
- 2025年度道路照明施工总价合同模板
- 2025年智能物流仓储系统供货与运营管理协议
- 2025云南师范大学辅导员考试题库
- BEC商务英语(中级)阅读模拟试卷11(共405题)
- 会计师事务所公司质量控制制度范本
- 实习生劳务合作合同6篇
- 语文课堂教学目标设计“四出发”
- 2025《义务教育信息科技课程标准(2022年版)》测试题库及答案(共4套)
- 2025年度建筑劳务木工班组施工合作协议
- 《环境保护法》知识参考试题库200题(含答案)
- 食堂食材配送采购投标方案(技术标)
- 护理情景模拟演练脚本
- 矿业行业智能化矿山建设与运营方案
评论
0/150
提交评论