




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、畢業(yè)設(shè)計(jì)_圖書管理系統(tǒng) 一、數(shù)據(jù)庫設(shè)計(jì)數(shù)據(jù)庫設(shè)CREATEDATABASETSGL GO USETSGL GO CREATETABLEBmanage( bId varchar(10)PRIMARYKEY,bNamevarchar(50),-添加圖書-圖書編號-書名bNumbervarchar(10),-書數(shù)目) GO bSorevarchar(50)-分類CREATETABLEMadmin( mNamevarchar(10)PRIMARYKEY,mPwdvarchar(25),mAgevarchar(8),mSexvarchar(4),mNumbervarchar(15),mrolevarch
2、ar(8) GO -圖書員管理-圖書管理員姓名-圖書管理員密碼-圖書管理員年齡-圖書管理員性別-圖書管理員電話-圖書管理員角色CREATETABLEReader( rSnovarchar(10)PRIMARYKEY,rNamevarchar(10),rPwdvarchar(25),rAgevarchar(8),rSexvarchar(4),rStatevarchar(8),rNumbervarchar(15),rEmailvarchar(25),-讀者信息表reader -讀者號-姓名-密碼-年齡-性別-狀態(tài)-電話號碼-電子郵件rAdressvarChar(50),-地址) GO rGrade
3、varChar(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)-讀者編號學(xué)號-讀者姓名-圖書編號-圖
4、書名稱-借書時(shí)間-還書時(shí)間-讀者角色-讀者可借書數(shù)-過期罰款設(shè)置-可借書天數(shù))二、界面截圖及說明1)登錄窗口(實(shí)現(xiàn)管理員和館長的登陸) 2)管理員窗口 3)館長窗口 4)關(guān)于窗口 5)新增圖書窗口 6)新增管理員、查找及修改窗口 7)新增讀者、查找及修改窗口 8)圖書的查找及修改窗口 9)借閱窗口 10)系統(tǒng)設(shè)置窗口 三、主要代碼主要代1)登錄窗口(實(shí)現(xiàn)管理員和館長的登陸) 登陸檢查: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data;
5、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 + "'" D
6、ataTable 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.TSG
7、L_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, strPW
8、D); if (dt.Rows.Count = 0) MessageBox.Show("登陸失敗,請重新輸入!"); loginpwd.Focus(); return; else type = dt.Rows0"mRole".ToString().Trim(); if (cboLT.Text.Trim()="館長" ) if (type = "館長") this.Hide(); frmManager objManager = newfrmManager(); objManager.Show(); else Mess
9、ageBox.Show("您沒有權(quán)限!"); loginpwd.Focus(); return; else if (type ="管理員") this.Hide(); frmAdmin objAdmin = newfrmAdmin(); objAdmin.Show(); else MessageBox.Show("您沒有權(quán)限!"); loginpwd.Focus(); return; catch (Exception ex) throw ex; privatevoid btnExit_Click(object sender, Even
10、tArgs 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() Initial
11、izeComponent(); 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()
12、; 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
13、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();
14、 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(); pri
15、vatevoid 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 = Cur
16、sors.Default; privatevoid frmManager_FormClosed(object sender, FormClosedEventArgs e) Application.Exit(); privatevoid 管理員信息管理ToolStripMenuItem_Click_1(object sender, EventArgs e) ShowForm(newfrmSelectAdmin(); privatevoid 系統(tǒng)設(shè)置ToolStripMenuItem_Click_1(object sender, EventArgs e) ShowForm(newfrmSys();
17、 privatevoid 關(guān)于ToolStripMenuItem_Click(object sender, EventArgs e) ShowForm(newfrmAbout(); privatevoid 退出ToolStripMenuItem_Click_1(object sender, EventArgs e) Application.Exit(); 4)關(guān)于窗口 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawi
18、ng; 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; usin
19、g 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
20、() if (textBox1.Text = "") MessageBox.Show("請輸入圖書編號!", "輸入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); returnfalse; if (textBox2.Text = "") MessageBox.Show("請輸入圖書名稱!", "輸入提示", MessageBoxButtons.OK, MessageBoxIco
21、n.Information); textBox2.Focus(); returnfalse; if (textBox3.Text = "") MessageBox.Show("請輸入圖書數(shù)目!", "輸入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox3.Focus(); returnfalse; if (comboBox1.Text = "") MessageBox.Show("請選擇圖書類別!", "輸入
22、提示", 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; st
23、ring 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() + " ','&
24、quot; + textBox2.Text.Trim() + " ','" + textBox3.Text.Trim() + " ','"+ comboBox1.Text.Trim() + " ')" try bool result = clsGlobalVar.ExecSQL(SQL); if (result) MessageBox.Show("添加成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.In
25、formation); textBox1.Text = "" textBox2.Text = "" textBox3.Text = "" comboBox1.Text = "" textBox1.Focus(); else MessageBox.Show("添加失??!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); catch (Exception ex) MessageBox.Show("操作數(shù)據(jù)庫出錯(cuò)
26、!", "操作演示", 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(
27、); 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 : For
28、m public frmSelectAdmin() InitializeComponent(); string name = "" string SQL = "" string PWD = "" string Age = "" string Sex = "" string Tel = "" string Role = "" privatevoid SelectAdmin() string strfilter = "" string SQ
29、L = "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
30、(SQL + strfilter); int intIndex = 0; if (dt.Rows.Count = 0) MessageBox.Show("抱歉,沒有您要找的用戶!", "結(jié)果提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Text = "" txtPWD.Text = "" txtAge.Text = "" cboSex.Text = "" txtTel.Text = "
31、" 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 <
32、; 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.Item
33、sintI.SubItems.Add(dt.RowsintI"性別".ToString().Trim(); LV.ItemsintI.SubItems.Add(dt.RowsintI"電話".ToString().Trim(); LV.ItemsintI.SubItems.Add(dt.RowsintI"角色".ToString().Trim(); /連接數(shù)據(jù)庫,將數(shù)據(jù)讀取出放入MadminData catch (Exception ex) MessageBox.Show("查詢數(shù)據(jù)庫出錯(cuò)!", "提示&
34、quot;, MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.Message); privatevoid btnSearch_Click(object sender, EventArgs e) SelectAdmin();/調(diào)用函數(shù) /實(shí)現(xiàn)修改功能 privatevoid btnUpdata_Click(object sender, EventArgs e) if (txtName.Text = "" | cboRole.Text="") MessageBox.Show(
35、"請選擇要修改的用戶!"); else SQL = "UPDATE Madmin SET mName='" + txtName.Text.Trim() + "',mPwd='" + txtPWD.Text.Trim() + "',mAge='" + txtAge.Text.Trim() + "',mSex='" + cboSex.Text.Trim() + "',mNumber='" + txtTel.T
36、ext.Trim() + "',mRole='" + cboRole.Text.Trim() + "' where mName='" + name + "'AND mPwd='" + PWD + "'AND mAge='" + Age + "'AND mSex='" + Sex + "'AND mNumber='" + Tel + "'AND mRole='
37、;" + Role + "'" try bool result = clsGlobalVar.ExecSQL(SQL); if (result) /txtName.Text = "" txtPWD.Text = "" txtAge.Text = "" cboSex.Text = "" txtTel.Text = "" cboRole.Text = "" MessageBox.Show("修改已成功"); SelectA
38、dmin(); else MessageBox.Show("更新失??!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); catch (Exception ex) MessageBox.Show("操作數(shù)據(jù)庫出錯(cuò)!", "操作演示", MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.Message); privatevoid btnExit_Click(object sen
39、der, 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.T
40、rim(); 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.Fo
41、cusedItem.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 =
42、 "" |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 = c
43、lsGlobalVar.GetDataTable(SQL); if (dt.Rows.Count = 0) SQL = "INSERT INTO Madmin VALUES ('" + txtName.Text.Trim() + "','" + txtPWD.Text.Trim() + "','" + txtAge.Text.Trim() + "','" + cboSex.Text.Trim() + "','" + txtTel.Text.Trim() + "','" + cboRole.Text.Trim() + "
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 工作務(wù)實(shí)活動方案
- 小學(xué)閱讀評比活動方案
- 山西開學(xué)第一課活動方案
- 工地宣講活動方案
- 少兒戶外詩歌會活動方案
- 展廳游戲活動方案
- 工會國慶朗誦活動方案
- 小店電信活動方案
- 少先隊(duì)義賣活動方案
- 小學(xué)課程育人活動方案
- MAM6090空壓 機(jī)微電腦控制器說明書
- 北師大版八年級數(shù)學(xué)下冊??碱}專練專題18平行四邊形中的周長和面積問題(原卷版+解析)
- 探監(jiān)證明樣本范文(篇一)
- 2023-2024學(xué)年年北京市懷柔區(qū)八年級初二(下)期末道德與法治試卷(含答案)
- 山東省濟(jì)寧市曲阜市2023-2024學(xué)年七年級下學(xué)期期末數(shù)學(xué)試題
- 2024年廣西中考地理+生物試題
- 瑜伽教練聘用勞動合同
- 校本課題研究活動記錄
- 體育指導(dǎo)員協(xié)會籌備
- 馬克思主義基本原理-2023版-課后習(xí)題答案
- MOOC 光纖通信-南京郵電大學(xué) 中國大學(xué)慕課答案
評論
0/150
提交評論