




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、畢業(yè)設(shè)計(jì)_圖書(shū)管理系統(tǒng) 一、數(shù)據(jù)庫(kù)設(shè)計(jì)數(shù)據(jù)庫(kù)設(shè)CREATEDATABASETSGL GO USETSGL GO CREATETABLEBmanage( bId varchar(10)PRIMARYKEY,bNamevarchar(50),-添加圖書(shū)-圖書(shū)編號(hào)-書(shū)名bNumbervarchar(10),-書(shū)數(shù)目) GO bSorevarchar(50)-分類CREATETABLEMadmin( mNamevarchar(10)PRIMARYKEY,mPwdvarchar(25),mAgevarchar(8),mSexvarchar(4),mNumbervarchar(15),mrolevarch
2、ar(8) GO -圖書(shū)員管理-圖書(shū)管理員姓名-圖書(shū)管理員密碼-圖書(shū)管理員年齡-圖書(shū)管理員性別-圖書(shū)管理員電話-圖書(shū)管理員角色CREATETABLEReader( rSnovarchar(10)PRIMARYKEY,rNamevarchar(10),rPwdvarchar(25),rAgevarchar(8),rSexvarchar(4),rStatevarchar(8),rNumbervarchar(15),rEmailvarchar(25),-讀者信息表reader -讀者號(hào)-姓名-密碼-年齡-性別-狀態(tài)-電話號(hào)碼-電子郵件rAdressvarChar(50),-地址) GO rGrade
3、varChar(15),rClassvarchar(15),rRolevarchar(8)-年級(jí)-班級(jí)-角色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)-讀者編號(hào)學(xué)號(hào)-讀者姓名-圖書(shū)編號(hào)-圖
4、書(shū)名稱-借書(shū)時(shí)間-還書(shū)時(shí)間-讀者角色-讀者可借書(shū)數(shù)-過(guò)期罰款設(shè)置-可借書(shū)天數(shù))二、界面截圖及說(shuō)明1)登錄窗口(實(shí)現(xiàn)管理員和館長(zhǎng)的登陸) 2)管理員窗口 3)館長(zhǎng)窗口 4)關(guān)于窗口 5)新增圖書(shū)窗口 6)新增管理員、查找及修改窗口 7)新增讀者、查找及修改窗口 8)圖書(shū)的查找及修改窗口 9)借閱窗口 10)系統(tǒng)設(shè)置窗口 三、主要代碼主要代1)登錄窗口(實(shí)現(xiàn)管理員和館長(zhǎng)的登陸) 登陸檢查: 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("登陸失敗,請(qǐng)重新輸入!"); loginpwd.Focus(); return; else type = dt.Rows0"mRole".ToString().Trim(); if (cboLT.Text.Trim()="館長(zhǎng)" ) if (type = "館長(zhǎng)") this.Hide(); frmManager objManager = newfrmManager(); objManager.Show(); else Mess
9、ageBox.Show("您沒(méi)有權(quán)限!"); loginpwd.Focus(); return; else if (type ="管理員") this.Hide(); frmAdmin objAdmin = newfrmAdmin(); objAdmin.Show(); else MessageBox.Show("您沒(méi)有權(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 新增圖書(shū)ToolStripMenuItem_Click(object sender, EventArgs e) ShowForm(newfrmAddNewBook(); privatevoid 圖書(shū)的查找和修改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)館長(zhǎng)窗口 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)新增圖書(shū)窗口 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("請(qǐng)輸入圖書(shū)編號(hào)!", "輸入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); returnfalse; if (textBox2.Text = "") MessageBox.Show("請(qǐng)輸入圖書(shū)名稱!", "輸入提示", MessageBoxButtons.OK, MessageBoxIco
21、n.Information); textBox2.Focus(); returnfalse; if (textBox3.Text = "") MessageBox.Show("請(qǐng)輸入圖書(shū)數(shù)目!", "輸入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox3.Focus(); returnfalse; if (comboBox1.Text = "") MessageBox.Show("請(qǐng)選擇圖書(shū)類別!", "輸入
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ù)庫(kù)出錯(cuò)
26、!", "操作演示", MessageBoxButtons.OK, MessageBoxIcon.Error); Console.WriteLine(ex.Message); else MessageBox.Show("圖書(shū)編號(hào)已存在!", "操作提示", 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("抱歉,沒(méi)有您要找的用戶!", "結(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("序號(hào)", 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ù)庫(kù),將數(shù)據(jù)讀取出放入MadminData catch (Exception ex) MessageBox.Show("查詢數(shù)據(jù)庫(kù)出錯(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、"請(qǐng)選擇要修改的用戶!"); 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ù)庫(kù)出錯(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("請(qǐng)至少輸入用戶名,密碼和角色!"); 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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 賽馬問(wèn)題測(cè)試題及答案
- 打造未來(lái)城市綠肺共享健康生活
- 賽道醉酒測(cè)試題及答案
- 合同協(xié)議書(shū)字號(hào)
- 承包挖沉淀池合同協(xié)議書(shū)
- 美團(tuán)外賣合同協(xié)議書(shū)模板
- 查閱合同協(xié)議書(shū)
- 維修保養(yǎng)合同協(xié)議書(shū)范本
- 合同協(xié)議書(shū)怎么查找
- 保養(yǎng)合同協(xié)議書(shū)
- 破產(chǎn)法試題及答案
- 憲法衛(wèi)士2023第八屆全國(guó)學(xué)生學(xué)憲法講憲法知識(shí)競(jìng)賽題庫(kù)附答案(300題)
- 靜脈輸液不良反應(yīng)及處理 課件
- 鄉(xiāng)土中國(guó)的性別差異
- 高速鐵路概論單元高速鐵路發(fā)展概況課件
- 北師大版2025三年級(jí)語(yǔ)文下學(xué)期期中課堂知識(shí)檢測(cè)考試
- 2024年甘肅蘭州事業(yè)單位招聘考試真題答案解析
- 2025年廣東省廣州市越秀區(qū)委政法委員會(huì)招聘輔助人員4人歷年高頻重點(diǎn)提升(共500題)附帶答案詳解
- MOOC 頸肩腰腿痛中醫(yī)防治-暨南大學(xué) 中國(guó)大學(xué)慕課答案
- 部編人教版五年級(jí)下冊(cè)語(yǔ)文四字詞填空專項(xiàng)練習(xí)
- 30m獨(dú)立避雷針的安裝作業(yè)指導(dǎo)書(shū)
評(píng)論
0/150
提交評(píng)論