圖書(shū)管理系統(tǒng)系統(tǒng)設(shè)計(jì)含代碼_第1頁(yè)
圖書(shū)管理系統(tǒng)系統(tǒng)設(shè)計(jì)含代碼_第2頁(yè)
圖書(shū)管理系統(tǒng)系統(tǒng)設(shè)計(jì)含代碼_第3頁(yè)
圖書(shū)管理系統(tǒng)系統(tǒng)設(shè)計(jì)含代碼_第4頁(yè)
圖書(shū)管理系統(tǒng)系統(tǒng)設(shè)計(jì)含代碼_第5頁(yè)
已閱讀5頁(yè),還剩33頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、圖書(shū)管理系統(tǒng)設(shè)計(jì)報(bào)告學(xué)院:國(guó)土資源工程學(xué)院專(zhuān)業(yè): 測(cè) 繪 工 程成員:*指導(dǎo)教師:黃云鎧日期: 2014年11月5日1系統(tǒng)設(shè)計(jì)1.1 設(shè)計(jì)目標(biāo)本系統(tǒng)是針對(duì)圖書(shū)管理工作過(guò)程進(jìn)行設(shè)計(jì)的,主要實(shí)現(xiàn)如下目標(biāo):注冊(cè)用戶(hù)可以登錄此系統(tǒng);非注冊(cè)用戶(hù)注冊(cè)后可以使用本系統(tǒng);讀者可以查詢(xún)、借閱、歸還圖書(shū)等; 管理員可以對(duì)讀者、圖書(shū)進(jìn)行管理。概念結(jié)構(gòu)設(shè)計(jì)將從需求分析中得到的數(shù)據(jù)信息抽象為概念模型,經(jīng)分析可得到數(shù)據(jù)庫(kù)的E-R模型。如圖所示。 圖書(shū)名稱(chēng)作者編號(hào)出版日期價(jià)格種類(lèi)出版社圖1-1 圖書(shū)實(shí)體ER圖密碼 讀者姓名編號(hào)專(zhuān)業(yè)借閱時(shí)間借書(shū)量年齡性別圖1-2 實(shí)體讀者ER圖用戶(hù)密碼類(lèi)型編號(hào)圖1- 3 用戶(hù)實(shí)體ER圖項(xiàng)目規(guī)

2、劃圖書(shū)管理系統(tǒng)是一個(gè)典型的數(shù)據(jù)庫(kù)應(yīng)用程序,由應(yīng)用程序和后臺(tái)數(shù)據(jù)庫(kù)兩部分構(gòu)成。(1)應(yīng)用程序應(yīng)用程序主要包括登錄,注冊(cè),用戶(hù)信息,讀者信息,圖書(shū)信息管理,借閱圖書(shū),綜合查詢(xún),出版社信息等幾個(gè)部分組成。(2)數(shù)據(jù)庫(kù) 數(shù)據(jù)庫(kù)負(fù)責(zé)對(duì)圖書(shū)信息,用戶(hù)信息等數(shù)據(jù)的管理。2 數(shù)據(jù)庫(kù)設(shè)計(jì)說(shuō)明書(shū)21 數(shù)據(jù)庫(kù)表結(jié)構(gòu)2.1.1 圖書(shū)表book2.1.2 借閱信息表borrow用戶(hù)信息表Reader2.1.4 用戶(hù)信息權(quán)限表right用戶(hù)賬號(hào)表user2.1.6 管理員賬號(hào)表usererheper2.2數(shù)據(jù)關(guān)系圖2.3圖書(shū)管理系統(tǒng)暫有數(shù)據(jù)(模擬運(yùn)行)學(xué)工號(hào):2014701020 姓名:邢吉昌密碼:111學(xué)工號(hào):2014

3、701021 姓名:豬八戒密碼:333學(xué)工號(hào):2014701022 姓名:孫悟空密碼:444編號(hào)作者書(shū)名出版社出版日期價(jià)格 書(shū)類(lèi)H319584781MARK C#入門(mén)經(jīng)典 清華大學(xué)出版社 2011/4/5 21.56 計(jì)算機(jī)H319584782 哪吒和猴子的那些事天庭文印2010/1/2 216.5 情感H319584783二郎神 我也可以鬧天宮天庭文印2009/8/1 29.32 技術(shù)3 程序功能的實(shí)現(xiàn)3.1登陸界面已注冊(cè)用戶(hù)登錄時(shí),用戶(hù)類(lèi)別選擇普通用戶(hù)或管理員,不選擇會(huì)出現(xiàn)提示主要代碼如下:using System;using System.Collections.Generic;usin

4、g System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace WindowsFormsApplication1publicpartialclassLoginForm : Form publicstring password;privateint ErrorTimes;string User, Pwd;bool flagshow =

5、false;privatebool yanzhengshuru() password = textBox3.Text;if(Typename.Text.Trim()=) MessageBox.Show(請(qǐng)選擇登錄類(lèi)型,登錄提示,MessageBoxButtons.OK,MessageBoxIcon.Information); Typename.Focus();returnfalse; elseif(loginid.Text.Trim()=) MessageBox.Show(請(qǐng)輸入用戶(hù)名, 登錄提示,MessageBoxButtons.OK, MessageBoxIcon.Information

6、); loginid.Focus();returnfalse; elseif (password = ) MessageBox.Show(請(qǐng)輸入密碼, 登錄提示,MessageBoxButtons.OK, MessageBoxIcon.Information); textBox3.Focus();returnfalse; else returntrue; public LoginForm() InitializeComponent(); privatevoid cancelbtn_Click(object sender, EventArgs e) Application.Exit(); pri

7、vatevoid LoginForm_Load(object sender, EventArgs e) privatevoid LoginForm_Closing(object sender, FormClosingEventArgs e) Application.Exit(); privatevoid loginbtn_Click(object sender, EventArgs e) if (yanzhengshuru() if (Typename.Text.Trim() = 管理員) SqlConnection conConnection = newSqlConnection(Data

8、Source=.sqlexpress;Initial Catalog=學(xué)生管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection.Open();string cmd = select AdminID,AdminPass from userhelper ;SqlCommand com = newSqlCommand(cmd, conConnection);SqlDataReader reader = com.ExecuteReader();while (reader.Read() User = readerAdminID.ToString(); Pwd =

9、readerAdminPass.ToString();if (User.Trim() = loginid.Text & Pwd.Trim() = textBox3.Text) flagshow = true; reader.Close(); conConnection.Close();if (flagshow = true) this.Hide();admin f1 = newadmin (); f1.ShowDialog(); else if (Typename.Text.Trim() = 普通用戶(hù)) SqlConnection conConnection1 = newSqlConnecti

10、on(Data Source=.sqlexpress;Initial Catalog=學(xué)生管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection1.Open();string cnd = select ReaderID,ReaderPassword from reader ;SqlCommand cnm = newSqlCommand(cnd, conConnection1);SqlDataReader reader1 = cnm.ExecuteReader();while (reader1.Read() User = reader1ReaderID.To

11、String(); Pwd = reader1ReaderPassword.ToString();if (User.Trim() = loginid.Text & Pwd.Trim() = textBox3.Text) flagshow = true; reader1.Close(); conConnection1.Close();if (flagshow = true) this.Hide();讀者查閱 f1 = new讀者查閱(); f1.ShowDialog(); else MessageBox.Show(用戶(hù)名不存在或密碼錯(cuò)誤!, 提示); ErrorTimes+;if (ErrorT

12、imes = 3) MessageBox.Show(登錄次數(shù)過(guò)多,程序?qū)㈥P(guān)閉);/Application.Exit();return; privatevoid label1_Click(object sender, EventArgs e) privatevoid label2_Click(object sender, EventArgs e) privatevoid label3_Click(object sender, EventArgs e) privatevoid button1_Click(object sender, EventArgs e) this.Hide();注冊(cè) f1 =

13、 new注冊(cè)(); f1.ShowDialog(); privatevoid usercomboBox_SelectedIndexChanged(object sender, EventArgs e) privatevoid useracctxt_TextChanged(object sender, EventArgs e) privatevoid textBox3_TextChanged(object sender, EventArgs e) 3.2登陸界面如果學(xué)號(hào)已經(jīng)存在,則會(huì)出現(xiàn)“*用戶(hù)名已經(jīng)存在,請(qǐng)重新輸入”的提示,當(dāng)重新輸入密碼時(shí),如果兩次密碼不相同,則會(huì)出現(xiàn)“*請(qǐng)注意,兩次密碼不一

14、樣”的提示主要代碼如下: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 System.Data.SqlClient;namespace WindowsFormsApplication1publicpartialclass注冊(cè) : Form public 注冊(cè)() Initialize

15、Component(); publicbool UserFlag;privatevoid textBox3_TextChanged(object sender, EventArgs e) if (textBox2.Text.Trim() != textBox3.Text.Trim() label6.Visible = true; else label8.Visible = true; label6.Visible = false; privatevoid 注冊(cè)_Load(object sender, EventArgs e) privatevoid textBox1_TextChanged(o

16、bject sender, EventArgs e) SqlConnection conConnection = newSqlConnection(Data Source=.sqlexpress;Initial Catalog=學(xué)生管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection.Open();string cmd = select ReaderID from reader ;SqlCommand com = newSqlCommand(cmd ,conConnection );SqlDataReader readerUser = com.Execu

17、teReader();while (readerUser.Read () if(textBox1.Text =readerUserReaderID.ToString().Trim() label7.Visible = true; UserFlag = true;return; elseif (textBox1.Text != readerUserReaderID.ToString().Trim() label7.Visible = false; label9.Visible = true; UserFlag = false; privatevoid button1_Click(object s

18、ender, EventArgs e) int index = textBox4.Text.IndexOf();if (index 1) label10.Visible = true; label10.Text = 郵箱格式不正確,請(qǐng)重新輸入; else label10.Visible = true; label10.Text = 郵箱格式正確; if(UserFlag=true ) MessageBox.Show(用戶(hù)已經(jīng)存在,請(qǐng)重新輸入!);return; if (UserFlag=false) SqlConnection conConnection = newSqlConnection(

19、Data Source=.sqlexpress;Initial Catalog=學(xué)生管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection.Open();string cmd = insert into reader(ReaderID,ReaderPassword,ReaderEmall) values (+textBox1.Text+,+textBox2.Text+,+textBox4.Text+);SqlCommand com = newSqlCommand(cmd,conConnection ); com.ExecuteNonQuery(); con

20、Connection.Close();MessageBox.Show(注冊(cè)成功!點(diǎn)擊確定,返回登錄界面。,提示);this.Close();LoginForm f2 = newLoginForm(); 3.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 Win

21、dowsFormsApplication1publicpartialclassadmin : Form public admin() InitializeComponent(); privatevoid 查看用戶(hù)信息ToolStripMenuItem_Click(object sender, EventArgs e) 權(quán)限設(shè)置 f8 = new權(quán)限設(shè)置(); f8.ShowDialog(); privatevoid 查看用戶(hù)信息ToolStripMenuItem1_Click(object sender, EventArgs e) 用戶(hù)信息 fi = new用戶(hù)信息(); fi.ShowDia

22、log(); privatevoid 新增用戶(hù)ToolStripMenuItem1_Click(object sender, EventArgs e) 新增用戶(hù) f2 = new新增用戶(hù)(); f2.ShowDialog(); privatevoid 刪除用戶(hù)ToolStripMenuItem1_Click(object sender, EventArgs e) 用戶(hù)信息 f3 = new用戶(hù)信息(); f3.button2.Visible = true; f3.ShowDialog(); privatevoid 錄入書(shū)籍ToolStripMenuItem_Click(object sende

23、r, EventArgs e) 書(shū)籍信息 f5 = new書(shū)籍信息(); f5.ShowDialog(); privatevoid 刪除書(shū)籍ToolStripMenuItem_Click(object sender, EventArgs e) 刪除書(shū)籍 f6 = new刪除書(shū)籍(); f6.ShowDialog(); privatevoid 還書(shū)處理ToolStripMenuItem_Click(object sender, EventArgs e) 還書(shū)處理 f9 = new還書(shū)處理(); f9.ShowDialog(); privatevoid admin_Load(object send

24、er, EventArgs e) privatevoid 借閱處理ToolStripMenuItem_Click(object sender, EventArgs e) 借閱處理 f10 = new借閱處理(); f10.ShowDialog(); 3管理用戶(hù)下共有三個(gè)子菜單3新增用戶(hù)界面主要代碼如下:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text

25、;using System.Windows.Forms;using System.Data.SqlClient;namespace WindowsFormsApplication1publicpartialclass新增用戶(hù) : Form public 新增用戶(hù)() InitializeComponent(); privatevoid button1_Click(object sender, EventArgs e) SqlConnection conConnection = newSqlConnection(Data Source=.sqlexpress;Initial Catalog=學(xué)生

26、管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection.Open();string cmd = insert into reader(ReaderID,ReaderName,ReaderPassword,ReaderSex,ReaderAge,ReaderDept,ReaderZhuanYe,MaxNumber,ReaderEmall) values ( + textBox1.Text + , + + textBox2.Text + , + + textBox3.Text + , + + textBox4.Text + , + + textBox5.Tex

27、t + , + + textBox6.Text + , + + textBox7.Text + , + + textBox8.Text + , + + textBox9.Text + );SqlCommand com = newSqlCommand(cmd, conConnection); com.ExecuteNonQuery(); conConnection.Close();MessageBox.Show(添加成功!點(diǎn)擊確定,返回登錄界面。, 提示);this.Close(); 3輸入學(xué)號(hào)即可查詢(xún)用戶(hù)信息,如圖,點(diǎn)擊刪除即刪除該用戶(hù)主要代碼如下:using System;using Sys

28、tem.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace WindowsFormsApplication1publicpartialclass用戶(hù)信息 : Form bool UserFlag;public 用戶(hù)信息() InitializeComponent(); pri

29、vatevoid button1_Click(object sender, EventArgs e) if(UserFlag=false ) MessageBox.Show(不存在該用戶(hù),請(qǐng)核對(duì)后再輸入,警告);return; if (UserFlag = true) SqlConnection conConnection = newSqlConnection(Data Source=.sqlexpress;Initial Catalog=學(xué)生管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection.Open();string cmd = select *

30、from reader;SqlCommand com=newSqlCommand (cmd,conConnection); com.CommandText = select * from reader;SqlDataReader dr = com.ExecuteReader();while (dr.Read() label11.Visible = true; textBox2.Text = drReaderName.ToString().Trim(); textBox3.Text = drReaderPassword.ToString().Trim(); textBox4.Text = drR

31、eaderSex.ToString().Trim(); textBox5.Text = drReaderAge.ToString().Trim(); textBox6.Text = drReaderDept.ToString().Trim(); textBox7.Text = drReaderZhuanYe.ToString().Trim(); textBox8.Text = drMaxNumber.ToString().Trim(); textBox9.Text = drReaderEmall.ToString().Trim(); conConnection.Close(); private

32、void textBox1_TextChanged(object sender, EventArgs e) SqlConnection conConnection = newSqlConnection(Data Source=.sqlexpress;Initial Catalog=學(xué)生管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection.Open();string cmd = select ReaderID from reader ;SqlCommand com = newSqlCommand(cmd, conConnection);SqlDataRea

33、der readerUser = com.ExecuteReader();while (readerUser.Read() if (textBox1.Text = readerUserReaderID.ToString().Trim() UserFlag = true;return; elseif (textBox1.Text != readerUserReaderID.ToString().Trim() UserFlag = false; privatevoid button2_Click(object sender, EventArgs e) SqlConnection conConnec

34、tion = newSqlConnection(Data Source=.sqlexpress;Initial Catalog=學(xué)生管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection.Open();string cmd = delete from reader where ReaderID= + textBox1.Text.Replace(, ) + ;SqlCommand com = newSqlCommand(cmd, conConnection); com.ExecuteNonQuery(); conConnection.Close();Mess

35、ageBox.Show(是否確認(rèn)刪除, 提示); 查看用戶(hù)信息界面該界面與刪除用戶(hù)界面代碼基本相似,主要是將查詢(xún)按鈕隱藏,故代碼不再列出3圖書(shū)查詢(xún)下共有2個(gè)子菜單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;using System.Data.SqlClient

36、;namespace WindowsFormsApplication1publicpartialclass書(shū)籍信息 : Form public 書(shū)籍信息() InitializeComponent(); privatevoid button1_Click(object sender, EventArgs e) SqlConnection conConnection = newSqlConnection(Data Source=.sqlexpress;Initial Catalog=學(xué)生管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection.Open();s

37、tring cmd = insert into book (BookID,BookWrite,BookName,BookPublish,BookPublishDate,BookPrice,BookSort) values ( + textBox1.Text + , + + textBox2.Text + , + + textBox3.Text + , + + textBox4.Text + , + + textBox5.Text + , + + textBox6.Text + , + + textBox7.Text + );SqlCommand com = newSqlCommand(cmd,

38、 conConnection); com.ExecuteNonQuery(); conConnection.Close();MessageBox.Show(錄入成功, 提示); textBox1.Text = ; textBox2.Text = ; textBox3.Text = ; textBox4.Text = ; textBox5.Text = ; textBox6.Text = ; textBox7.Text = ; 3刪除書(shū)籍之前如需確認(rèn)是否是所需刪除的書(shū)籍,以防刪除錯(cuò)誤,可以先將所需刪除的書(shū)籍的書(shū)名輸入,點(diǎn)擊檢索后會(huì)出現(xiàn)該書(shū)的詳細(xì)信息,若確認(rèn)無(wú)誤后點(diǎn)擊刪除即可刪除該書(shū)主要代碼如下:

39、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 System.Data.SqlClient;namespace WindowsFormsApplication1publicpartialclass刪除書(shū)籍 : Form bool UserFlag;public 刪除書(shū)籍() Init

40、ializeComponent(); privatevoid button1_Click(object sender, EventArgs e) if (UserFlag = false) MessageBox.Show(不存在此書(shū),請(qǐng)核對(duì)后再輸入, 警告);return; if (UserFlag = true) SqlConnection conConnection = newSqlConnection(Data Source=.sqlexpress;Initial Catalog=學(xué)生管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection.Open(

41、);string cmd = select * from book;SqlCommand com = newSqlCommand(cmd, conConnection); com.CommandText = select * from book;SqlDataReader dr = com.ExecuteReader();while (dr.Read() textBox1.Text = drBookID.ToString().Trim(); textBox2.Text = drBookWrite.ToString().Trim(); textBox4.Text = drBookPublish.

42、ToString().Trim(); textBox5.Text = drBookPublishDate.ToString().Trim(); textBox6.Text = drBookPrice.ToString().Trim(); textBox7.Text = drBookSort.ToString().Trim(); conConnection.Close(); privatevoid textBox3_TextChanged(object sender, EventArgs e) SqlConnection conConnection = newSqlConnection(Data

43、 Source=.sqlexpress;Initial Catalog=學(xué)生管理數(shù)據(jù)庫(kù);Integrated Security=True); conConnection.Open();string cmd = select BookName from book ;SqlCommand com = newSqlCommand(cmd, conConnection);SqlDataReader readerUser = com.ExecuteReader();while (readerUser.Read() if (textBox1.Text = readerUserBookName.ToString().Trim() UserFlag = true;return; elseif (textBox1.Text != readerUserBookName.ToString().Trim() UserFlag = false; private

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 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ì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論