




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、登陸界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace Labrary public partial class FormLogin : Form public FormLogin() InitializeComponent(); / <summary> / 驗(yàn)¨¦證¡
2、è控?件t / </summary> / <returns></returns> private bool ValidControl() if (this.tbID.Text = "") MessageBox.Show("請(qǐng)?zhí)顚懹脩裘?#234;?"); this.tbID.Focus(); return false; if (this.tbID.Text != "admin") if (!UserManage.ObjUser.IsHasID(All.dbo, this.tbID.Tex
3、t) MessageBox.Show("不存在此用戶!ê?"); this.tbID.Text = "" this.tbID.Focus(); return false; if (this.tbID.Text != "admin") UserManage.ObjUser user= new UserManage.ObjUser(this.tbID.Text, All.dbo); if (user.PWD != this.tbPWD.Text) MessageBox.Show("密碼錯(cuò)誤!ê?")
4、; this.tbPWD.Text = "" this.tbPWD.Focus(); return false; else if (this.tbPWD.Text != "123456") MessageBox.Show("密碼錯(cuò)誤! "); this.tbPWD.Text = "" this.tbPWD.Focus(); return false; return true; private void gbtnCancel_Click(object sender, EventArgs e) this.Close()
5、; private void gbtnOK_Click(object sender, EventArgs e) /如¨?果?驗(yàn)¨¦證¡è控?件t通ª¡§過y if (ValidControl() if (this.tbID.Text != "admin") All.userLogin = new UserManage.ObjUser(this.tbID.Text, All.dbo); else All.userLogin = new UserManage.ObjUser(All.dbo); Al
6、l.userLogin.ID = "admin" All.userLogin.Name = "管理員" this.DialogResult = DialogResult.OK; this.Close(); 主界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace Labrar
7、y public partial class FormMain : Form public const int WM_USER = 0x0400; public const int WM_GETBUFFER_LOOP = WM_USER + 2; private RFID_dll.Reader rdr; private RFID_dll.RFID rfid; List<string> rfids = new List<string>(); int directionFlag = 0;/1進(jìn);出? FormInAndOut fiao = new FormInAndOut(
8、); public FormMain() InitializeComponent(); this.rdr = new RFID_dll.Reader(); /this.rfid = new RFID_dll.RFID(rdr); private void FormMain_Load(object sender, EventArgs e) Init(); / <summary> / 初始化 / </summary> private void Init() fiao.StartPosition = FormStartPosition.Manual; /多窗體在不同時(shí)間顯示
9、Screen screens = Screen.AllScreens; if (screens.Length = 2) List<Screen> listScreen = new List<Screen>(); foreach (Screen screen in Screen.AllScreens) if (screen.Primary = false) listScreen.Add(screen); fiao.Location = listScreen0.WorkingArea.Location; SetMenJin("PicIn"); fiao.
10、Show(); /toolStripStatusLabel2顯示登陸用戶名? toolStripStatusLabel2.Text = All.userLogin.Name; this.panel1.BackgroundImage = null; /菜單欄全部顯示º? this.用®?戶¡ì管¨¹理¤¨ªToolStripMenuItem.Visible = true; this.系¦Ì統(tǒng)ª3初?始º?化¡¥CToolStripMenuItem.
11、Visible = true; this.應(yīng)®|用®?模¡ê式º?ToolStripMenuItem.Visible = true; this.圖ª?書º¨¦管¨¹理¤¨ªToolStripMenuItem.Visible = true; this.退ª?辦㨬卡¡§ToolStripMenuItem.Visible = true; this.借¨¨閱?ToolStripMe
12、nuItem.Visible = true; this.門?禁?ToolStripMenuItem.Visible = true; SetPurview(); this.toolStrip1.Visible = false; this.toolStrip2.Visible = false; this.toolStrip3.Visible = false; /rfid.OpenSerial(); /是º?否¤?找¨°到Ì?門?禁?設(shè)¦¨¨備À? /if (rfid.ChangeWorkModel(2) /
13、/ rfid.StartInventory(this.Handle.ToInt32(),2); / / <summary> / 權(quán)限設(shè)置 / </summary> private void SetPurview() if (All.userLogin.ID = "admin") this.應(yīng)®|用®?模¡ê式º?ToolStripMenuItem.Visible = false; else this.用戶管理¨ªToolStripMenuItem.Visible = false;
14、this.系統(tǒng)初始化¡¥CToolStripMenuItem.Visible = false; this.讀書管理¨ªToolStripMenuItem.Visible = false; this.退辦卡¡§ToolStripMenuItem.Visible = false; this.借閱ToolStripMenuItem.Visible = false; this.門禁?ToolStripMenuItem.Visible = false; for (int i = 0; i < All.userLogin.Purview.C
15、ount; i+) string purview = All.userLogin.Purviewi; if (purview = "1") this.圖書管理¨ªToolStripMenuItem.Visible = true; else if (purview = "2") this.辦退卡¡§ToolStripMenuItem.Visible = true; else if (purview = "3") this.借閱?ToolStripMenuItem.Visible = true; e
16、lse if (purview = "4") this.門禁ToolStripMenuItem.Visible = true; private void 用戶管理¨ªToolStripMenuItem_Click(object sender, EventArgs e) UserManage.FormUserList ful = new UserManage.FormUserList(All.conn); ful.ShowDialog(); private void 修改密碼?ToolStripMenuItem_Click(object sender, E
17、ventArgs e) UserManage.FormUserPwd fup = new UserManage.FormUserPwd(All.conn, All.userLogin); fup.ShowDialog(); private void tsbtnBookType_Click(object sender, EventArgs e) FormBookTypeList fbtl = new FormBookTypeList(); fbtl.ShowDialog(); private void tsbtnBookAdd_Click(object sender, EventArgs e)
18、FormBookAdd fba = new FormBookAdd(); fba.ShowDialog(); private void tsbtnBookManage_Click(object sender, EventArgs e) FormBookInfoList fbil = new FormBookInfoList(); fbil.ShowDialog(); private void tsbtnBookStatistics_Click(object sender, EventArgs e) FormBookStatistics fbs = new FormBookStatistics(
19、); fbs.ShowDialog(); private void 退ª?出?XToolStripMenuItem_Click(object sender, EventArgs e) this.Close(); private void tsbtnCardAdd_Click(object sender, EventArgs e) FormCardInfo fci = new FormCardInfo(1, new ObjCardInfo(); fci.ShowDialog(); private void tsbtnCardManage_Click(object sender, Eve
20、ntArgs e) FormCardList fcl = new FormCardList(); fcl.ShowDialog(); private void tsbtnAddTime_Click(object sender, EventArgs e) string rfid = RfidOperate.GetCard(); if (rfid = "") MessageBox.Show("請(qǐng)把借閱卡放到桌面讀寫器上!"); else if (ObjCardInfo.IsHas(rfid) ObjCardInfo oci = new ObjCardInfo
21、(rfid); FormCardInfo fci = new FormCardInfo(5, oci); fci.ShowDialog(); else MessageBox.Show("沒有此借閱卡信息"); private void tsbtnCardDelete_Click(object sender, EventArgs e) string rfid = RfidOperate.GetCard(); if (rfid = "") MessageBox.Show("請(qǐng)把借閱卡到讀寫器上?"); else if (ObjCardIn
22、fo.IsHas(rfid) ObjCardInfo oci = new ObjCardInfo(rfid); int count = oci.NotReturnCount(); if (count = 0) if (MessageBox.Show("是否決定退卡!ê?", "", MessageBoxButtons.YesNo) = DialogResult.Yes) oci.Delete(); MessageBox.Show("退卡成功|!ê?"); else MessageBox.Show(oci.Name
23、+ "還有一本 " + count.ToString() + " 本書未歸還不能退卡?"); else MessageBox.Show("沒有此借閱信息?"); private void tsbtnJie_Click(object sender, EventArgs e) FormBookJie fbj = new FormBookJie(1); fbj.ShowDialog(); private void tsbtnHuan_Click(object sender, EventArgs e) FormBookHuan fbh = n
24、ew FormBookHuan(); fbh.ShowDialog(); private void 圖ª?書º¨¦管¨¹理¤¨ªToolStripMenuItem_Click(object sender, EventArgs e) this.toolStrip1.Visible = true; this.toolStrip2.Visible = false; this.toolStrip3.Visible = false; this.panel1.BackgroundImage = Image.FromF
25、ile(AppDomain.CurrentDomain.BaseDirectory + "pic1.jpg"); private void 退ª?辦㨬卡¡§ToolStripMenuItem_Click(object sender, EventArgs e) this.toolStrip1.Visible = false; this.toolStrip2.Visible = true; this.toolStrip3.Visible = false; this.panel1.BackgroundImage =
26、Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "pic2.jpg"); private void 借¨¨閱?ToolStripMenuItem_Click(object sender, EventArgs e) this.toolStrip1.Visible = false; this.toolStrip2.Visible = false; this.toolStrip3.Visible = true; this.panel1.BackgroundImage = Image.FromFile
27、(AppDomain.CurrentDomain.BaseDirectory + "pic3.jpg"); private void 門?禁?ToolStripMenuItem_Click(object sender, EventArgs e) /MenJinInit(); /this.toolStrip1.Visible = false; /this.toolStrip2.Visible = false; /this.toolStrip3.Visible = false; /this.panel1.BackgroundImage = null; /rfid.OpenSer
28、ial(); /是否找到門禁設(shè)備? /if (rfid.IsOpen) / / rfid.StartInventory(this.Handle.ToInt32(); / private void 注銷²ToolStripMenuItem_Click(object sender, EventArgs e) All.userLogin = null; FormLogin fl = new FormLogin(); if (fl.ShowDialog() != DialogResult.OK) this.Close(); else Init(); private void 幫助¨
29、²ToolStripMenuItem1_Click(object sender, EventArgs e) private void 系統(tǒng)初始化¡¥CToolStripMenuItem_Click(object sender, EventArgs e) if (MessageBox.Show("是否初始化數(shù)據(jù)庫?", "", MessageBoxButtons.YesNo) = DialogResult.Yes) All.dbo.excuteSql("delete from lendtable"); Al
30、l.dbo.excuteSql("delete from bookinfo"); All.dbo.excuteSql("delete from booktype"); All.dbo.excuteSql("delete from librarycard"); All.dbo.excuteSql("delete from usertable"); MessageBox.Show("初始化完成?"); private void 關(guān)于ToolStripMenuItem_Click(object sen
31、der, EventArgs e) FormAbout fa = new FormAbout(); fa.ShowDialog(); protected override void DefWndProc(ref System.Windows.Forms.Message m) if (m.Msg = WM_GETBUFFER_LOOP) /啟動(dòng) if (this.timer1.Tag.ToString() = "0") this.timer1.Start(); this.timer1.Tag = "1" string uid = ""
32、string direction = "" bool personWithMultCard = false; rdr.GetLoopGetBufferData(m, ref uid, ref direction, ref personWithMultCard); if (uid != "0000000000000000") /進(jìn) if (direction = "In") this.directionFlag = 1; this.rfids.Add(uid); /出 if (direction = "Out") t
33、his.directionFlag = 2; this.rfids.Add(uid); if (uid = "FFFFFFFFFFFFFFFF") base.DefWndProc(ref m); private void timer1_Tick(object sender, EventArgs e) if (this.directionFlag = 1) for (int i = 0; i < this.rfids.Count; i+) if (ObjCardInfo.IsHas(this.rfidsi) ObjCardInfo oci = new ObjCardIn
34、fo(this.rfidsi); if (oci.IsOverTime() SetMenJin("PicInOutTime"); MenJinInit(); return; else SetMenJin("PicIn"); MenJinInit(); return; SetMenJin("PicInNoCard"); MenJinInit(); else if (this.directionFlag = 2) for (int i = 0; i < this.rfids.Count; i+) if (ObjBookInfo.Is
35、Has(this.rfidsi) ObjBookInfo obi = new ObjBookInfo(this.rfidsi); if (obi.LendStatus = "為借出?") this.rdr.WarningOutput(false, false, true, false, false); SetMenJin("PicOut"); MenJinInit(); return; MenJinInit(); / <summary> / 門禁初始化 / </summary> private void MenJinInit()
36、this.rfids.Clear(); this.directionFlag = 0; this.timer1.Tag = "0" this.timer1.Stop(); private void SetMenJin(string message) this.fiao.Controls.Clear(); UserControlMenJin ucmj = new UserControlMenJin(message); ucmj.Dock = DockStyle.Fill; this.fiao.Controls.Add(ucmj); private void FormMain_
37、FormClosing(object sender, FormClosingEventArgs e) /this.rfid.StopInventory(); /this.rfid.CloseSerial(); 圖書統(tǒng)計(jì)using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace Labrary public partial
38、class FormBookStatistics : Form private int boolShelf; public FormBookStatistics() InitializeComponent(); BindTreeView(); this.boolShelf = 0; BindListView("select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo"); this.cboBookLendStatus.SelectedIndex = 0; private void BindT
39、reeView() this.treeView1.Nodes.Clear(); TreeNode nodeRoot = new TreeNode(); nodeRoot.Text = "全部書架¹" this.treeView1.Nodes.Add(nodeRoot); for (int i = 0; i < 4; i+) TreeNode nodeChild = new TreeNode(); if (i = 0) nodeChild.Text = "第一書架¹" if (i = 1) nodeChild.Text = "第二書架¨¹" if
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 康復(fù)醫(yī)療器械行業(yè)細(xì)分領(lǐng)域發(fā)展動(dòng)態(tài)與2025年投資策略研究報(bào)告
- 新能源汽車的合作伙伴選擇試題及答案
- 物流園區(qū)倉儲(chǔ)設(shè)施智能化物流系統(tǒng)設(shè)計(jì)創(chuàng)新與優(yōu)化評(píng)估報(bào)告
- 期中試題規(guī)律題及答案
- 開展教育教學(xué)反思的必要性試題及答案
- 殺嬰心理測試題及答案
- 構(gòu)建能力框架的2025大學(xué)物理試題答案
- 畜牧中職面試題及答案
- 罕見病藥物研發(fā)激勵(lì)政策在2025年產(chǎn)業(yè)中的實(shí)踐與探索報(bào)告
- 供應(yīng)鏈金融在中小企業(yè)融資中的金融科技與金融服務(wù)創(chuàng)新報(bào)告
- 聯(lián)想EAP案例分析
- 社會(huì)工作介入老年社區(qū)教育的探索
- 國開電大-工程數(shù)學(xué)(本)-工程數(shù)學(xué)第4次作業(yè)-形考答案
- 高考倒計(jì)時(shí)30天沖刺家長會(huì)課件
- 施工項(xiàng)目現(xiàn)金流預(yù)算管理培訓(xùn)課件
- 時(shí)行疾病(中醫(yī)兒科學(xué)課件)
- 街道計(jì)生辦主任先進(jìn)事跡材料-巾幗弄潮顯風(fēng)流
- GB/T 32616-2016紡織品色牢度試驗(yàn)試樣變色的儀器評(píng)級(jí)方法
- 部編版小學(xué)語文三年級(jí)下冊第七單元整體解讀《奇妙的世界》課件
- 管道支吊架培訓(xùn)教材課件
- 2、工程工質(zhì)量保證體系框圖
評(píng)論
0/150
提交評(píng)論