RFID圖書管理系統(tǒng)程序源代碼_第1頁
RFID圖書管理系統(tǒng)程序源代碼_第2頁
RFID圖書管理系統(tǒng)程序源代碼_第3頁
RFID圖書管理系統(tǒng)程序源代碼_第4頁
RFID圖書管理系統(tǒng)程序源代碼_第5頁
已閱讀5頁,還剩48頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、登陸界面usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;namespaceLabrarypublicpartialclassFormLogin:FormpublicFormLogin()InitializeComponent();/<summary>/</summary>/<returns></retu

2、rns>privateboolValidControl()if(this.tbID.Text=""MessageBoxShow("請?zhí)顚懹脩裘?!e?!);this.tbID.Focus();returnfalse;if(this.tbID.Text!="admin")if(!UserManage.ObjUser.IsHasID(All.dbo,this.tbID.Text)MessageBoxShow("不存在此用戶!e?");this.tbID.Text=""this.tbID.Focus();r

3、eturnfalse;if(this.tbID.Text!="admin")UserManage.ObjUseruser=newUserManage.ObjUser(this.tbID.Text,All.dbo);if(user.PWD!=this.tbPWD.Text)MessageBoxShow("密碼錯誤!e?');this.tbPWD.Text=""this.tbPWD.Focus();returnfalse;elseif(this.tbPWD.Text!="123456")MessageBox.Show(&

4、quot;密碼錯誤!");this.tbPWD.Text=""this.tbPWD.Focus();returnfalse;returntrue;privatevoidgbtnCancel_Click(objectsender,EventArgse)this.Close();privatevoidgbtnOK_Click(objectsender,EventArgse)/如一?果?驗一|證?6控件t通a?§過丫if(ValidControl()if(this.tbID.Text!="admin")All.userLogin=newUs

5、erManage.ObjUser(this.tbID.Text,All.dbo);elseAll.userLogin=newUserManage.ObjUser(All.dbo);All.userLogin.ID="admin"All.userLogin.Name="管理員"this.DialogResult=DialogResult.OK;this.Close();主界面usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usin

6、gSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;namespaceLabrarypublic partial classFormMain : FormpublicconstintWM_USER = 0x0400;publicconstintWM_GETBUFFER_LOOP = WM_USER + 2;privateRFIDdll.Reader rdr;privateRFID_dll.RFID rfid;List <string > rfids = new List <string >();int d

7、irectionFlag = 0;/1 進;出 ?FormInAndOut fiao = new FormInAndOut();public FormMain()InitializeComponent();this.rdr=newRFID_dll.Reader();/this.rfid=newRFID_dll.RFID(rdr);privatevoidFormMain_Load(objectsender,EventArgse)Init();/<summary>/初始化/</summary>privatevoidInit()fiao.StartPosition=FormS

8、tartPosition.Manual;/多窗體在不同時間顯示Screenscreens=Screen.AllScreens;if(screens.Length=2)List<Screen>listScreen=newList<Screen>();foreach(ScreenscreeninScreen.AllScreens)if(screen.Primary=false)listScreen.Add(screen);fiao.Location=listScreen0.WorkingArea.Location;SetMenJin("PicIn");f

9、iao.Show();/toolStripStatusLabel2顯示登陸用戶名?toolStripStatusLabel2.Text=All.userLogin.Name;this.panel1.BackgroundImage=null;/菜單欄全部顯示o?this.用?戶?i管一1理。一aToolStripMenuItem.Visible=true;this.系|i統(tǒng)a3初?始。?化?¥CToolStripMenuItem.Visible=true;this.應?|用????6由?ToolStripMenuItem.Visible=true;this.圖a?書。一|管一1理。一aT

10、oolStripMenuItem.Visible=true;this.退a?辦?一?卡?§ToolStripMenuItem.Visible=true;true ;this.門?禁?ToolStripMenuItem.Visible=SetPurview();this.toolStrip1.Visible=false;this.toolStrip2.Visible=false;this.toolStrip3.Visible=false;/rfid.OpenSerial();/是o?否。?找,一至1Ji?門?禁?設|,備d?/if(rfid.ChangeWorkModel(2)/rfi

11、d.StartInventory(this.Handle.ToInt32(),2);/<summary>/權限設置/</summary>privatevoidSetPurview()if(All.userLogin.ID="admin")elsethis.用戶管理一aToolStripMenuItem.Visible=false;this.系統(tǒng)初始化?¥CToolStripMenuItem.Visible=false;this.讀書管理一aToolStripMenuItem.Visible=false;this.退辦卡?§Tool

12、StripMenuItem.Visible=false;this.借閱ToolStripMenuItem.Visible=false;this.門禁?ToolStripMenuItem.Visible=false;for(inti=0;i<All.userLogin.Purview.Count;i+)stringpurview=All.userLogin.Purviewi;if(purview="1")this.圖書管理一aToolStripMenuItem.Visible=true;elseif(purview="2")this.辦退卡?

13、7;ToolStripMenuItem.Visible=true;elseif(purview="3")true ;this.借閱?ToolStripMenuItem.Visible=elseif(purview="4")this.門禁ToolStripMenuItem.Visible=true;privatevoid用戶管理一aToolStripMenuItem_Click(objectsender,EventArgse)UserManage.FormUserListful=newUserManage.FormUserList(All.conn);fu

14、l.ShowDialog();privatevoid修改密碼?ToolStripMenuItem_Click(objectsender,EventArgse)UserManage.FormUserPwdfup=newUserManage.FormUserPwd(All.conn,All.userLogin);fup.ShowDialog();privatevoidtsbtnBookType_Click(objectsender,EventArgse)FormBookTypeListfbtl=newFormBookTypeList();fbtl.ShowDialog();privatevoidt

15、sbtnBookAdd_Click(objectsender,EventArgse)FormBookAddfba=newFormBookAdd();fba.ShowDialog();privatevoidtsbtnBookManage_Click(objectsender,EventArgse)FormBookInfoListfbil=newFormBookInfoList();fbil.ShowDialog();privatevoidtsbtnBookStatistics_Click(objectsender,EventArgse)FormBookStatisticsfbs=newFormB

16、ookStatistics();fbs.ShowDialog();privatevoid退a?出?XToolStripMenuItem_Click(objectsender,EventArgse)this.Close();privatevoidtsbtnCardAdd_Click(objectsender,EventArgse)FormCardInfofci=newFormCardInfo(1,newObjCardInfo();fci.ShowDialog();privatevoidtsbtnCardManage_Click(objectsender,EventArgse)FormCardLi

17、stfcl=newFormCardList();fcl.ShowDialog();privatevoidtsbtnAddTime_Click(objectsender,EventArgse)stringrfid=RfidOperate.GetCard();if(rfid="")MessageBox.Show("請把借閱卡放到桌面讀寫器上!");elseif(ObjCardInfo.IsHas(rfid)ObjCardInfooci=newObjCardInfo(rfid);FormCardInfofci=newFormCardInfo(5,oci);fc

18、i.ShowDialog();elseMessageBoxShow("沒有此借閱卡信息");privatevoidtsbtnCardDelete_Click(objectsender,EventArgse)stringrfid=RfidOperate.GetCard();if(rfid="")MessageBox.Show("請把借閱卡到讀寫器上?");elseif(ObjCardInfo.IsHas(rfid)ObjCardInfooci=newObjCardInfo(rfid);intcount=oci.NotReturnCoun

19、t();if(count=0)if(MessageBoxShow("是否決定退卡!e?","",MessageBoxButtons.YesNo)=DialogResult.Yes)oci.Delete();MessageBoxShow("退卡成功|!e?);elseMessageBox.Show(oci.Name+"還有一本"+count.ToString()+"本書未歸還不能退卡?");elseMessageBoxShow("沒有止匕借閱信息?");privatevoidtsbtnJ

20、ie_Click(objectsender,EventArgse)FormBookJiefbj=newFormBookJie(1);fbj.ShowDialog();privatevoidtsbtnHuan_Click(objectsender,EventArgse)FormBookHuanfbh=newFormBookHuan();fbh.ShowDialog();privatevoid圖a?書。"|管一1理。一aToolStripMenuItem_Click(objectsender,EventArgse)this.toolStrip1.Visible=true;this.too

21、lStrip2.Visible=false;this.toolStrip3.Visible=false;this.panel1.BackgroundImage=Image.FromFile(AppDomain.CurrentDomain.BaseDirectory+"pic1.jpg");privatevoid退a?辦?一?卡?§ToolStripMenuItem_Click(objectsender,EventArgse)this.toolStrip1.Visible=false;this.toolStrip2.Visible=true;this.toolStr

22、ip3.Visible=false;this.panel1.BackgroundImage="pic2.jpg");Image.FromFile(AppDomain.CurrentDomain.BaseDirectory+this.toolStrip1.Visible=false;this.toolStrip2.Visible=false;this.toolStrip3.Visible=true;this.panel1.BackgroundImage=Image.FromFile(AppDomain.CurrentDomain.BaseDirectory+"pic

23、3.jpg");privatevoid門?禁?ToolStripMenuItem_Click(objectsender,EventArgse)/MenJinInit();/this.toolStrip1.Visible=false;/this.toolStrip2.Visible=false;/this.toolStrip3.Visible=false;/this.panel1.BackgroundImage=null;/rfid.OpenSerial();/是否找到門禁設備?/if(rfid.IsOpen)/rfid.StartInventory(this.Handle.ToInt

24、32();/privatevoid注銷2ToolStripMenuItem_Click(objectsender,EventArgse)All.userLogin=null;FormLoginfl=newFormLogin();if(fl.ShowDialog()!=DialogResult.OK)this.Close();elseInit();privatevoid幫助一2ToolStripMenuItem1_Click(objectsender,EventArgse)privatevoid系統(tǒng)初始化?¥CToolStripMenuItem_Click(objectsender,E

25、ventArgse)if(MessageBox.Show("是否初始化數(shù)據(jù)庫?","",MessageBoxButtons.YesNo)=DialogResult.Yes)All .dbo.excuteSql(All .dbo.excuteSql(All .dbo.excuteSql(All .dbo.excuteSql(All .dbo.excuteSql("delete from lendtable" );"delete from bookinfo");"delete from booktype&qu

26、ot;);"delete from librarycard" );"delete from usertable" );MessageBox.Show("初始化完成?");privatevoid關于ToolStripMenuItem_Click(objectsender,EventArgse)FormAboutfa=newFormAbout();fa.ShowDialog();protectedoverridevoidDefWndProc(refSystem.Windows.Forms.Messagem)if(m.Msg=WM_GETB

27、UFFER_LOOP)/啟動if(this.timer1.Tag.ToString()="0")this.timer1.Start();this.timer1.Tag="1"stringuid=stringdirection=boolpersonWithMultCard=false;rdr.GetLoopGetBufferData(m,ref uid, ref direction, refpersonWithMultCard);if(uid !="0000000000000000")/if(direction = "In&q

28、uot; )this.directionFlag=1;this.rfids.Add(uid);/if(direction="Out")this.directionFlag=2;this.rfids.Add(uid);if(uid="FFFFFFFFFFFFFFFF)"base.DefWndProc(refm);privatevoidtimer1_Tick(objectsender,EventArgse)if(this.directionFlag=1)for(inti=0;i<this.rfids.Count;i+)if(ObjCardInfo.Is

29、Has(this.rfidsi)ObjCardInfooci=newObjCardInfo(this.rfidsi);if(oci.IsOverTime()SetMenJin("PicInOutTime");MenJinInit();return;elseSetMenJin("PicIn");MenJinInit();return;SetMenJin("PicInNoCard");MenJinInit();elseif(this.directionFlag=2)for(inti=0;i<this.rfids.Count;i+)i

30、f(ObjBookInfo.IsHas(this.rfidsi)ObjBookInfoobi=newObjBookInfo(this.rfidsi);if(obi.LendStatus="為借出?")this.rdr.WarningOutput(false,false,true,false,false);SetMenJin("PicOut");MenJinInit();return;MenJinInit();/<summary>/門禁初始化/</summary>privatevoidMenJinInit()this.rfids.C

31、lear();this.directionFlag=0;this.timer1.Tag="0"this.timer1.Stop();privatevoidSetMenJin(stringmessage)this.fiao.Controls.Clear();UserControlMenJinucmj=newUserControlMenJin(message);ucmj.Dock=DockStyle.Fill;this.fiao.Controls.Add(ucmj);privatevoidFormMain_FormClosing(objectsender,FormClosing

32、EventArgse)/this.rfid.StopInventory();/this.rfid.CloseSerial();圖書統(tǒng)計usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;namespaceLabrarypublicpartialclassFormBookStatistics:FormprivateintboolShelf;publi

33、cFormBookStatistics()InitializeComponent();BindTreeView();this.boolShelf=0;BindListView("selectRFID,BookType_ID,Name,Author,LendStatus,BookShelffromBookInfo");this.cboBookLendStatus.SelectedIndex=0;privatevoidBindTreeView()this.treeView1.Nodes.Clear();TreeNodenodeRoot=newTreeNode();nodeRoo

34、t.Text="全部書架1"this.treeView1.Nodes.Add(nodeRoot);for(inti=0;i<4;i+)TreeNodenodeChild=newTreeNode();if(i=0)nodeChild.Text=if(i=1)nodeChild.Text=if(i=2)nodeChild.Text=if(i=3)nodeChild.Text="第一書架1"”第二書架.1"”第三書架.1""第四書架1"nodeRoot.Nodes.Add(nodeChild);nodeRoot.E

35、xpand();privatevoidBindListView(stringsql)this.listView1.Items.Clear();this.listView1.Columns.Clear();string口headerText=newstring口"標簽,100”,”所屬分類。一。,100”,"書名,150",”作者,80”,”借閱狀態(tài),80”,”所在書架,80”;for(inti=0;i<headerText.Length;i+)ColumnHeaderheader=newColumnHeader();stringheaderName=head

36、erTexti.Split()0;intheaderWidth=Convert.ToInt32(headerTexti.Split()1);header.Text=headerName;header.Width=headerWidth;this.listView1.Columns.Add(header);DataTabledtb=All.dbo.getDataTable(sql);for(inti=0;i<dtb.Rows.Count;i+)ObjBookInfobookInfo=newObjBookInfo(dtb.Rowsi"RFID".ToString();Li

37、stViewItemitem=newListViewItem(newstringbookInfo.RFID,bookInfo.BookType.Name,bookInfo.Name,bookInfo.Author,bookInfo.LendStatus,bookInfo.BookShelf);this.listView1.Items.Add(item);ListViewItemitemCount=newListViewItem(newstring口"統(tǒng)a3計?","","""","",dtb.R

38、ows.Count.ToString()+"本a?");this.listView1.Items.Add(itemCount);privatevoidtreeView1_NodeMouseClick(objectsender,TreeNodeMouseClickEventArgse)if(e.Node.Text="全部書架1")this.boolShelf=0;BindListView(string .Format( "select);RFID,BookType_ID,Name,Author,LendStatus,BookShelffromBo

39、okInfo"if(e.Node.Text="第一書架,1”)this.boolShelf=1;BindListView(string.Format("selectRFID,BookType_ID,Name,Author,LendStatus,BookShelffromBookInfowhereBookShelf='1'");if(e.Node.Text="第二書架.1”)this.boolShelf=2;BindListView(string.Format("selectRFID,BookType_ID,Name,A

40、uthor,LendStatus,BookShelffromBookInfowhereBookShelf='2'");if(e.Node.Text="第三書架,1”)this.boolShelf=3;BindListView(string.Format("selectRFID,BookType_ID,Name,Author,LendStatus,BookShelffromBookInfowhereBookShelf='3'");if(e.Node.Text="第四書架-1")this.boolShelf

41、=4;BindListView(string.Format("selectRFID,BookType_ID,Name,Author,LendStatus,BookShelffromBookInfowhereBookShelf='4'");privatevoidtoolStripComboBox1_SelectedIndexChanged(objectsender,EventArgse)if(this.boolShelf=0)if(this.cboBookLendStatus.SelectedIndex=0)BindListView(string.Format

42、("selectRFID,BookType_ID,Name,Author,LendStatus,BookShelffromBookInfo");if(this.cboBookLendStatus.SelectedIndex=1)BindListView(string.Format("selectRFID,BookType_ID,Name,Author,LendStatus,BookShelffromBookInfowhereLendStatus='1'");if(this.cboBookLendStatus.SelectedIndex=2

43、)BindListView(string.Format("selectRFID,BookType_ID,Name,Author,LendStatus,BookShelffromBookInfowhereLendStatus='0'");if(this.boolShelf>0)if(this.cboBookLendStatus.SelectedIndex=0)BindListView(string.Format("selectRFID,BookType_ID,Name,Author,LendStatus,BookShelffromBookInf

44、owhereBookShelf='0'",this.boolShelf.ToString();if(this.cboBookLendStatus.SelectedIndex=1)BindListView(string.Format("selectRFID,BookType_ID,Name,Author,LendStatus,BookShelffromBookInfowhereBookShelf='0'andLendStatus='1'",this.boolShelf.ToString();if(this.cboBoo

45、kLendStatus.SelectedIndex=2)BindListView(string.Format("selectRFID,BookType_ID,Name,Author,LendStatus,BookShelffromBookInfowhereBookShelf='0'andLendStatus='0'",this.boolShelf.ToString();借閱卡管理usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.

46、Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;namespaceLabrarypublicpartialclassFormCardList:FormpublicFormCardList()InitializeComponent();SetListView();privatevoidSetListView()this.listView1.Items.Clear();List<ObjCardInfo>listCard=ObjCardInfo.GetAllCard();for(inti=0;i<

47、;listCard.Count;i+)ObjCardInfooci=listCardi;ListViewItemitem=newListViewItem(oci.Rfid);item.Tag=oci;ListViewItem.ListViewSubItemsubitem1=newListViewItem.ListViewSubItem();subitem1.Text=oci.Name;item.SubItems.Add(subitem1);ListViewItem.ListViewSubItemsubitem2=newListViewItem.ListViewSubItem();subitem

48、2.Text=oci.Sex;item.SubItems.Add(subitem2);ListViewItem.ListViewSubItemsubitem3=new,yyyy 年. 0 MM ?dd 日 一 ?");ListViewItem.ListViewSubItem();subitem3.Text=oci.Brithday.ToString(item.SubItems.Add(subitem3);ListViewItem.ListViewSubItemsubitem4=newListViewItem.ListViewSubItem();subitem4.Text=0ci.SI

49、D;item.SubItems.Add(subitem4);ListViewItem.ListViewSubItemsubitem5=newListViewItem.ListViewSubItem();subitem5.Text=0ci.StartTime.T0String();item.SubItems.Add(subitem5);ListViewItem.ListViewSubItemsubitem6=newListViewItem.ListViewSubItem();subitem6.Text=oci.EndTime.ToString();item.SubItems.Add(subite

50、m6);ListViewItem.ListViewSubItemsubitem7=newListViewItem.ListViewSubItem();subitem7.Text=oci.User.Name;item.SubItems.Add(subitem7);this.listView1.Items.Add(item);privatevoidSetListView(List<ObjCardInfo>listCard)this.listView1.Items.Clear();for(inti=0;i<listCard.Count;i+)ObjCardInfooci=listC

51、ardi;ListViewItemitem=newListViewItem(oci.Rfid);item.Tag=oci;ListViewItem.ListViewSubItemsubitem1=newListViewItem.ListViewSubItem();subitem1.Text=oci.Name;item.SubItems.Add(subitem1);ListViewItem.ListViewSubItemsubitem2=newListViewItem.ListViewSubItem();subitem2.Text=oci.Sex;item.SubItems.Add(subite

52、m2);ListViewItem . ListViewSubItemsubitem3 =newListViewItem.ListViewSubItem();"yyyy 年. 0 MM ?dd 日?”);subitem3.Text=oci.Brithday.ToString(item.SubItems.Add(subitem3);ListViewItem . ListViewSubItemsubitem4 =newListViewItem.ListViewSubItem();subitem4.Text=0ci.SID;item.SubItems.Add(subitem4);ListVi

53、ewItem . ListViewSubItemsubitem5 =newListViewItem.ListViewSubItem();subitem5.Text=0ci.StartTime.T0String();item.SubItems.Add(subitem5);ListViewItem.ListViewSubItemsubitem6=newListViewItem.ListViewSubItem();subitem6.Text=oci.EndTime.ToString();item.SubItems.Add(subitem6);ListViewItem.ListViewSubItems

54、ubitem7=newListViewItem.ListViewSubItem();subitem7.Text=oci.User.Name;item.SubItems.Add(subitem7);this.listView1.Items.Add(item);privatevoidtsbtnExit_Click(objectsender,EventArgse)this.Close();privatevoidtsbtnInsert_Click(objectsender,EventArgse)FormCardInfofci=newFormCardInfo(1,newObjCardInfo();if(

55、fci.ShowDialog()=DialogResult.OK)SetListView();IsEnabled(false);privatevoidIsEnabled(boolEnabled)/this.tsbtnAddTime.Enabled=Enabled;this.tsbtnUpdate.Enabled=Enabled;this.tsbtnDelete.Enabled=Enabled;this.tsbtnRecord.Enabled=Enabled;privatevoidlistView1_SelectedIndexChanged(objectsender,EventArgse)if(this.listView1.SelectedItems.Count>0)IsEnabled(true);elseI

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論