




已閱讀5頁(yè),還剩13頁(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)介
namespace BookManage public partial class frmLogin : Form public frmLogin() InitializeComponent(); private void btnLogin_Click(object sender, EventArgs e) /驗(yàn)證通過(guò) if (Validate() string state = this.cboUserType.Text; int num; if (state.Equals(管理員)/判斷用戶(hù)角色 num = 1; else if (state.Equals(后臺(tái)管理) num = 2; else num = 3; /定義查詢(xún)語(yǔ)句 string sql = string.Format(select * from userinfo where uname=0and upwd=1 and ustate=2, this.txName.Text.Trim(),this.txtPwd.Text.Trim(),num); DataSet ds = DataAccess.GetDataSetBySql(sql); if (ds.Tables0.Rows.Count 0) MessageBox.Show(登錄成功); Constans.UserBookID = ds.Tables0.Rows0UBookID.ToString(); Constans.UserName = ds.Tables0.Rows0UName.ToString(); Constans.UserState = ds.Tables0.Rows0UState.ToString(); if(num=1) frmMain.result = DialogResult.OK; this.Hide(); frmMain main = new frmMain(); main.ShowDialog(); else if (num = 2) frmBookInStore store = new frmBookInStore(); store.ShowDialog(); else frmBookJY jy = new frmBookJY(); jy.ShowDialog(); else MessageBox.Show(用戶(hù)名或密碼錯(cuò)誤); private void frmLogin_Load(object sender, EventArgs e) this.cboUserType.SelectedIndex = 0; /驗(yàn)證方法 private bool Vaildate() if (this.txName.Text != string.Empty & this.txtPwd.Text != string.Empty) return true; else MessageBox.Show(用戶(hù)名或密碼不能為空); return false; private void btnCancle_Click(object sender, EventArgs e) this.Close(); namespace BookManage public partial class frmMain : Form public static DialogResult result; public frmMain() InitializeComponent(); /查詢(xún)子窗體是否存在 public bool checkchildfrm(string childfrmname) foreach (Form childFrm in this.MdiChildren) if (childFrm.Name = childfrmname) if (childFrm.WindowState = FormWindowState.Minimized) childFrm.WindowState = FormWindowState.Normal; childFrm.Activate(); return true; return false; /用戶(hù)登錄菜單的事件處理 private void 用戶(hù)登錄ToolStripMenuItem_Click(object sender, EventArgs e) /檢測(cè)該窗口是否處于打開(kāi)狀態(tài) if (this.checkchildfrm(frmLogin) = true) return; /窗口已經(jīng)打開(kāi),返回 frmLogin user = new frmLogin();/實(shí)例化登錄窗體 user.ShowDialog(); /登錄窗體以模式對(duì)話(huà)框的方式的打開(kāi) /判斷是否登錄成功,登錄成功則啟用相應(yīng)的菜單和按鈕 if (result = DialogResult.OK) this.tsbtnAddBook.Enabled = true; this.mnuUpdateBook.Enabled = true; this.mnuAddBook.Enabled = true; /登錄按鈕事件處理 private void tsbtnLogin_Click(object sender, EventArgs e) if (this.checkchildfrm(frmLogin) = true) return; frmLogin user = new frmLogin(); user.ShowDialog(); if (result = DialogResult.OK) this.tsbtnAddBook.Enabled = true; this.mnuUpdateBook.Enabled = true; this.mnuAddBook.Enabled = true; /圖書(shū)查詢(xún)按鈕Click事件處理 private void tsbtnSearch_Click(object sender, EventArgs e) frmBookSearch frmbs = new frmBookSearch(); frmbs.ShowDialog(); /圖書(shū)檢索菜單Click事件處理 private void 圖書(shū)檢索ToolStripMenuItem_Click(object sender, EventArgs e) frmBookSearch frmbs = new frmBookSearch(); frmbs.ShowDialog(); /圖書(shū)入庫(kù)菜單Click事件處理 private void 圖書(shū)入庫(kù)ToolStripMenuItem1_Click(object sender, EventArgs e) frmBookInStore bookinstore = new frmBookInStore(); bookinstore.ShowDialog(); /圖書(shū)入庫(kù)按鈕Click事件處理 private void tsbtnAddBook_Click(object sender, EventArgs e) frmTsgx tsgx = new frmTsgx(); tsgx.ShowDialog(); /圖書(shū)更新菜單Click事件處理 private void 圖書(shū)修改ToolStripMenuItem_Click(object sender, EventArgs e) frmTsgx tsgx = new frmTsgx(); tsgx.ShowDialog(); /圖書(shū)借閱按鈕事件處理 private void tsbtnIssue_Click(object sender, EventArgs e) frmBookJY bookjy = new frmBookJY(); bookjy.ShowDialog(); private void tsbtnExit_Click(object sender, EventArgs e) Application.Exit(); private void 退出ToolStripMenuItem1_Click(object sender, EventArgs e) Application.Exit(); private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) Application.Exit(); /窗體載入時(shí)事件處理 private void FrmMain_Load(object sender, EventArgs e) /this.tsbtnAddBook.Enabled = false; /this.mnuAddBook.Enabled = false; /this.mnuUpdateBook.Enabled = false; /在關(guān)閉主窗體的同時(shí),關(guān)閉整個(gè)系統(tǒng) private void frmMain_FormClosed(object sender, FormClosedEventArgs e) Application.Exit(); private void 圖書(shū)借閱ToolStripMenuItem_Click(object sender, EventArgs e) frmBookJY bookJy = new frmBookJY(); bookJy.ShowDialog(); private void 圖書(shū)歸還ToolStripMenuItem_Click(object sender, EventArgs e) frmBookReturn frmreturn = new frmBookReturn(); frmreturn.ShowDialog(); private void 注冊(cè)ToolStripMenuItem_Click(object sender, EventArgs e) frmUserZC zc = new frmUserZC(); zc.ShowDialog(); namespace BookManage public partial class frmBookInStore : Form public frmBookInStore() InitializeComponent(); private void BookInStore_Load(object sender, EventArgs e) DataSet Myds = DataAccess.GetDataSetBySql(select * from BookInfo); DataTable table = Myds.Tables0; this.dataGridView1.DataSource = table; private void btnExit_Click(object sender, EventArgs e) this.Close(); private void btnInsert_Click(object sender, EventArgs e) string bookname = this.txtBookName.Text; string booktype = this.txtBookType.Text; string author = this.txtAuthor.Text; string cbs = this.txtCBS.Text;/出版商 int kc =Convert.ToInt32( this.txtKC.Text);/庫(kù)存 int kjysl =Convert.ToInt32( this.txtKJY.Text);/可借閱數(shù)量 string sql = string.Format(insert into BookInfo values(0,1,2,3,4,5), booktype,bookname, author, cbs, kc, kjysl); if (DataAccess.UpdateDataTable(sql) MessageBox.Show(添加成功!, 提示); else MessageBox.Show(添加失?。?提示,MessageBoxButtons.OK); DataSet Myds = DataAccess.GetDataSetBySql(select * from BookInfo); DataTable table=Myds.Tables0; this.dataGridView1.DataSource = table; public bool Validate() return true; namespace BookManage public partial class frmTsgx : Form public frmTsgx() InitializeComponent(); private void btnClose_Click(object sender, EventArgs e) this.Close(); private void frmTsgx_Load(object sender, EventArgs e) DataSet Myds = DataAccess.GetDataSetBySql(select * from BookInfo); DataTable table = Myds.Tables0; dataGridView1.DataSource = table; private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) int index = dataGridView1.CurrentCell.RowIndex; this.textBox1.Text = this.dataGridView1.Rowsindex.Cells0.Value.ToString().Trim();/圖書(shū)編號(hào) this.textBox2.Text = this.dataGridView1.Rowsindex.Cells2.Value.ToString().Trim();/圖書(shū)名稱(chēng) this.textBox3.Text = this.dataGridView1.Rowsindex.Cells1.Value.ToString().Trim();/圖書(shū)類(lèi)型 this.textBox4.Text = this.dataGridView1.Rowsindex.Cells3.Value.ToString().Trim();/圖書(shū)作者 this.textBox5.Text = this.dataGridView1.Rowsindex.Cells4.Value.ToString().Trim();/出版商 this.textBox6.Text = this.dataGridView1.Rowsindex.Cells5.Value.ToString().Trim();/庫(kù)存 this.textBox7.Text = this.dataGridView1.Rowsindex.Cells6.Value.ToString().Trim();/可借閱的數(shù)量 private void btnUpdate_Click(object sender, EventArgs e) string bookname = textBox2.Text.ToString().Trim(); string booktype = textBox3.Text.ToString().Trim(); string bookauthor = textBox4.Text.ToString().Trim(); string bookpublish = textBox5.Text.ToString().Trim(); int bookkc = Convert.ToInt32(textBox6.Text.Trim(); int bookjysl = Convert.ToInt32(textBox7.Text.Trim(); string sql = string.Format(update BookInfo set BookName=0,BookType=1,BookAuthor=2,BookPublish=3,BookKC=4,BookJYSL=5 where BookID=6,bookname,booktype,bookauthor,bookpublish,bookkc,bookjysl,Convert.ToInt32(textBox1.Text); if (DataAccess.UpdateDataTable(sql) MessageBox.Show(更新成功!, 提示, MessageBoxButtons.OK); else MessageBox.Show(更新失??!,提示,MessageBoxButtons.OK); private void btnSaveEdit_Click(object sender, EventArgs e) string sql = select * from BookInfo; DataSet ds = DataAccess.GetDataSetBySql(sql); DialogResult result = MessageBox.Show(您確實(shí)要將修改保存到數(shù)據(jù)庫(kù)中嗎?,操作提示,MessageBoxButtons.OKCancel,MessageBoxIcon.Question); if(result=DialogResult.OK) DataAccess.UpdateDataSet(ds,sql); MessageBox.Show(保存成功!); dataGridView1.DataSource = DataAccess.GetDataSetBySql(sql).Tables0; namespace BookManage public partial class frmBookSearch : Form public frmBookSearch() InitializeComponent(); private void btnClose_Click(object sender, EventArgs e) this.Close(); private void btnSearch_Click(object sender, EventArgs e) /string cbo1 = this.cboBookType.Text; string booktype = this.cboType2.Text; string bookname = this.txtBookName.Text; string sql=select * from BookInfo where BookType=+booktype+and BookName like %+bookname+%; DataSet Myds = DataAccess.GetDataSetBySql(sql); DataTable table = Myds.Tables0; this.dataGridView1.DataSource = table; private void frmBookSearch_Load(object sender, EventArgs e) DataSet Myds = DataAccess.GetDataSetBySql(select distinct BookType from BookInfo); DataTable table = Myds.Tables0; for (int i = 0; i table.Rows.Count; i+) /this.cboBookType.Items.Add(table.Rowsi0.ToString().Trim(); this.cboType2.Items.Add(table.Rowsi0.ToString().Trim(); / this.cboBookType.SelectedIndex = 0; this.cboType2.SelectedIndex = 0; namespace BookManage public partial class frmBookReturn : Form public frmBookReturn() InitializeComponent(); private void button2_Click(object sender, EventArgs e) this.Close(); private void btnSearch_Click(object sender, EventArgs e) string userbookid = textBox1.Text; string sql=string.Format(select * from IssueInfo where UserBookID=0,userbookid); DataSet Myds = DataAccess.GetDataSetBySql(sql); DataTable table = Myds.Tables0; dataGridView1.DataSource = table; private void button1_Click(object sender, EventArgs e) DateTime time = Convert.ToDateTime(this.textBox9.Text); string bo = boBox2.Text.ToString(); string sql =string.Format( update IssueInfo set ghDateTime=0,Bool=1 where IssID=2,time,bo,Convert.ToInt32(textBox15.Text); if (DataAccess.UpdateDataTable(sql) MessageBox.Show(還書(shū)成功!, 提示, MessageBoxButtons.OK); string sql2 = string.Format(update BookInfo set BookKC=BookKC+1 where BookID=0,Convert.ToInt32( this.textBox14.Text.ToString().Trim(); string sq = string.Format(update UserIssue set BookKC=BookKC-1 where UserBookID=0, this.textBox15.Text.ToString(); DataAccess.UpdateDataTable(sql2); DataAccess.UpdateDataTable(sq); else MessageBox.Show(還書(shū)失?。?提示,MessageBoxButtons.OK); private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) int index = dataGridView1.CurrentCell.RowIndex; this.textBox15.Text = this.dataGridView1.Rowsindex.Cells0.Value.ToString().Trim();/借閱編號(hào) this.textBox14.Text = this.dataGridView1.Rowsindex.Cells1.Value.ToString().Trim();/借書(shū)證號(hào) this.textBox13.Text = this.dataGridView1.Rowsindex.Cells2.Value.ToString().Trim();/用戶(hù)名 this.textBox12.Text = this.dataGridView1.Rowsindex.Cells3.Value.ToString().Trim();/圖書(shū)編號(hào) this.textBox11.Text = this.dataGridView1.Rowsindex.Cells4.Value.ToString().Trim();/圖書(shū)名 this.textBox10.Text = this.dataGridView1.Rowsindex.Cells5.Value.ToString().Trim();/借閱時(shí)間 this.textBox9.Text = this.dataGridView1.Rowsindex.Cells6.Value.ToString().Trim();/歸還時(shí)間 private void frmBookReturn_Load(object sender, EventArgs e) boBox2.SelectedIndex = 0; namespace BookManage public partial class frmBookJY : Form DataSet da = new DataSet(); public frmBookJY() InitializeComponent(); private void btnExit_Click(object sender, EventArgs e) this.Close(); private void frmBookJY_Load(object sender, EventArgs e) textBox1.Text = Constans.UserBookID; textBox2.Text = Constans.UserName; DataSet Myds = DataAccess.GetDataSetBySql(select * from IssueInfo); DataTable table = Myds.Tables0; dataGridView1.DataSource = table; da = DataAccess.GetDataSetBySql(select * from BookInfo); boBox1.DataSource = da.Tables0; boBox1.DisplayMember = BookName; boBox1.ValueMember = BookID; boBox2.DataSource = da.Tables0; boBox2.DisplayMember = BookID; boBox2.ValueMember = BookID; private void btnJY_Click(object sender, EventArgs e) string userbookid = textBox1.Text.ToString(); string username = textBox2.Text.ToString(); string bookname = comboBox1.Text.ToString(); string
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025海運(yùn)運(yùn)輸合同范本
- 2025翻譯服務(wù)的合同范本
- 2025標(biāo)準(zhǔn)資產(chǎn)管理合同范本
- 2025年國(guó)內(nèi)貿(mào)易公司與外籍船員雇傭合同
- 2025年公司與個(gè)人借款合同范本標(biāo)準(zhǔn)版
- 5.2 做自強(qiáng)不惜的中國(guó)人 課件 2024-2025學(xué)年統(tǒng)編版道德與法治七年級(jí)下冊(cè)
- 《課堂互動(dòng)》課件
- 《當(dāng)代臨床輸血技術(shù)》課件
- (63)-考點(diǎn)63 課外-名著閱讀
- (10)-專(zhuān)題10 議論文閱讀
- 【圖文】GB8624-2012建筑材料及制品燃燒性能分級(jí)(精)
- 科姆龍變頻器說(shuō)明書(shū)kv2000
- 缺血性腦卒中患者血壓管理之路
- 小學(xué)生讀書(shū)知識(shí)競(jìng)賽試題
- 藍(lán)色簡(jiǎn)約法律通用PPT模板
- 遼寧工程技術(shù)大學(xué)開(kāi)題報(bào)告示例
- 旅行社掛靠協(xié)議(樣板)
- 皮爾遜Ⅲ型曲線(xiàn)模比系數(shù)計(jì)算表(共享版)
- 房屋租賃合以裝修費(fèi)抵租金
- Z5140型立式鉆床說(shuō)明書(shū)
- 100以?xún)?nèi)加法口訣表
評(píng)論
0/150
提交評(píng)論