RFID图书管理系统程序源代码.pdf

上传人:wj151****6093 文档编号:72020127 上传时间:2023-02-08 格式:PDF 页数:46 大小:786.73KB
返回 下载 相关 举报
RFID图书管理系统程序源代码.pdf_第1页
第1页 / 共46页
RFID图书管理系统程序源代码.pdf_第2页
第2页 / 共46页
点击查看更多>>
资源描述

《RFID图书管理系统程序源代码.pdf》由会员分享,可在线阅读,更多相关《RFID图书管理系统程序源代码.pdf(46页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、登陆界面登陆界面using System;using System。Collections。Generic;using System.ComponentModel;using System。Data;using System。Drawing;using System。Text;using System.Windows。Forms;namespace LabrarypublicpartialclassFormLogin:Form public FormLogin()InitializeComponent();/验证控?件t/returnsprivatebool ValidControl()if(

2、this。tbID.Text=)MessageBox。Show(请填写用户名!?);this.tbID.Focus();returnfalse;if(this。tbID.Text!=”admin”)if(!UserManage.ObjUser。IsHasID(All。dbo,this。tbID。Text)MessageBox。Show(”不存在此用户!?”);this.tbID。Text=;this。tbID.Focus();returnfalse;if(this.tbID.Text!=admin)UserManage.ObjUser user=newUserManage。ObjUser(th

3、is。tbID。Text,All.dbo);if(user.PWD!=this.tbPWD.Text)MessageBox。Show(”密码错误!?”);this。tbPWD.Text=”;this.tbPWD.Focus();returnfalse;elseif(this.tbPWD.Text!=123456”)MessageBox。Show(密码错误!);this。tbPWD。Text=”;this.tbPWD.Focus();returnfalse;returntrue;privatevoid gbtnCancel_Click(object sender,EventArgs e)this

4、.Close();privatevoid gbtnOK_Click(object sender,EventArgs e)/如?果?验证控?件t通过yif(ValidControl()if(this.tbID.Text!=”admin)All。userLogin=newUserManage。ObjUser(this.tbID.Text,All.dbo);else All.userLogin=newUserManage.ObjUser(All。dbo);All.userLogin。ID=admin;All。userLogin。Name=”管理员”;this。DialogResult=DialogR

5、esult.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 LabrarypublicpartialclassFormMain:Formpublicconstint WM_USER=0 x0400;publicconstint WM_GETBUFFER_LOOP=WM

6、_USER+2;private RFID_dll。Reader rdr;private RFID_dll。RFID rfid;Liststring rfids=newList();int directionFlag=0;/1进;出?FormInAndOut fiao=newFormInAndOut();public FormMain()InitializeComponent();this。rdr=new RFID_dll。Reader();/this.rfid=new RFID_dll。RFID(rdr);privatevoid FormMain_Load(object sender,Even

7、tArgs e)Init();/初始化/summaryprivatevoid Init()fiao.StartPosition=FormStartPosition。Manual;/多窗体在不同时间显示Screen screens=Screen。AllScreens;if(screens。Length=2)ListScreen listScreen=newListScreen();foreach(Screen screen inScreen。AllScreens)if(screen。Primary=false)listScreen。Add(screen);fiao.Location=listSc

8、reen0.WorkingArea.Location;SetMenJin(”PicIn);fiao.Show();/toolStripStatusLabel2显示登陆用户名?toolStripStatusLabel2。Text=All.userLogin。Name;this.panel1。BackgroundImage=null;/菜单栏全部显示?this.用?户管理ToolStripMenuItem。Visible=true;this.系统3初?始?化CToolStripMenuItem.Visible=true;this.应用?模式?ToolStripMenuItem.Visible=tr

9、ue;this.图?书管理ToolStripMenuItem.Visible=true;this。退?办卡ToolStripMenuItem。Visible=true;this.借阅?ToolStripMenuItem。Visible=true;this。门?禁?ToolStripMenuItem.Visible=true;SetPurview();this。toolStrip1.Visible=false;this。toolStrip2.Visible=false;this。toolStrip3.Visible=false;/rfid。OpenSerial();/是?否?找到?门?禁?设备?

10、/if(rfid.ChangeWorkModel(2))/rfid.StartInventory(this。Handle.ToInt32(),2);/权限设置/summaryprivatevoid SetPurview()if(All.userLogin.ID=admin”)this。应用?模式?ToolStripMenuItem。Visible=false;else this.用户管理ToolStripMenuItem.Visible=false;this。系统初始化CToolStripMenuItem.Visible=false;this.读书管理ToolStripMenuItem.Vis

11、ible=false;this.退办卡ToolStripMenuItem。Visible=false;this.借阅ToolStripMenuItem。Visible=false;this。门禁?ToolStripMenuItem.Visible=false;for(int i=0;i All.userLogin.Purview。Count;i+)string purview=All。userLogin.Purviewi;if(purview=”1”)this.图书管理ToolStripMenuItem.Visible=true;elseif(purview=”2)this.办退卡ToolSt

12、ripMenuItem.Visible=true;elseif(purview=3”)this.借阅?ToolStripMenuItem。Visible=true;elseif(purview=”4”)this.门禁ToolStripMenuItem。Visible=true;privatevoid用户管理ToolStripMenuItem_Click(object sender,EventArgs e)UserManage。FormUserList ful=newUserManage.FormUserList(All.conn);ful。ShowDialog();privatevoid修改密

13、码?ToolStripMenuItem_Click(object sender,EventArgs e)UserManage。FormUserPwd fup=newUserManage。FormUserPwd(All.conn,All。userLogin);fup。ShowDialog();privatevoid tsbtnBookType_Click(object sender,EventArgs e)FormBookTypeList fbtl=newFormBookTypeList();fbtl。ShowDialog();privatevoid tsbtnBookAdd_Click(obj

14、ect sender,EventArgs e)FormBookAdd fba=newFormBookAdd();fba。ShowDialog();privatevoid tsbtnBookManage_Click(object sender,EventArgs e)FormBookInfoList fbil=newFormBookInfoList();fbil.ShowDialog();privatevoid tsbtnBookStatistics_Click(object sender,EventArgs e)FormBookStatistics fbs=newFormBookStatist

15、ics();fbs。ShowDialog();privatevoid退?出?XToolStripMenuItem_Click(object sender,EventArgs e)this.Close();privatevoid tsbtnCardAdd_Click(object sender,EventArgs e)FormCardInfo fci=newFormCardInfo(1,newObjCardInfo();fci.ShowDialog();privatevoid tsbtnCardManage_Click(object sender,EventArgs e)FormCardList

16、 fcl=newFormCardList();fcl.ShowDialog();privatevoid tsbtnAddTime_Click(object sender,EventArgs e)string rfid=RfidOperate.GetCard();if(rfid=”)MessageBox。Show(请把借阅卡放到桌面读写器上!);else if(ObjCardInfo.IsHas(rfid))ObjCardInfo oci=newObjCardInfo(rfid);FormCardInfo fci=newFormCardInfo(5,oci);fci。ShowDialog();e

17、lseMessageBox.Show(”没有此借阅卡信息”);privatevoid tsbtnCardDelete_Click(object sender,EventArgs e)string rfid=RfidOperate.GetCard();if(rfid=”)MessageBox.Show(请把借阅卡到读写器上?”);elseif(ObjCardInfo。IsHas(rfid))ObjCardInfo oci=newObjCardInfo(rfid);int count=oci.NotReturnCount();if(count=0)if(MessageBox.Show(是否决定退卡

18、!?”,”,MessageBoxButtons.YesNo)=DialogResult。Yes)oci.Delete();MessageBox.Show(退卡成功|!?);elseMessageBox。Show(oci.Name+”还有一本”+count.ToString()+”本书未归还不能退卡?”);else MessageBox。Show(没有此借阅信息?”);privatevoid tsbtnJie_Click(object sender,EventArgs e)FormBookJie fbj=newFormBookJie(1);fbj。ShowDialog();privatevoid

19、 tsbtnHuan_Click(object sender,EventArgs e)FormBookHuan fbh=newFormBookHuan();fbh。ShowDialog();privatevoid图?书管 理ToolStripMenuItem_Click(object sender,EventArgs e)this.toolStrip1.Visible=true;this.toolStrip2。Visible=false;this。toolStrip3.Visible=false;this。panel1.BackgroundImage=Image。FromFile(AppDom

20、ain.CurrentDomain.BaseDirectory+pic1。jpg”);privatevoid退?办卡ToolStripMenuItem_Click(object sender,EventArgs e)this。toolStrip1。Visible=false;this.toolStrip2.Visible=true;this.toolStrip3。Visible=false;this。panel1.BackgroundImage=Image.FromFile(AppDomain.CurrentDomain.BaseDirectory+pic2.jpg);privatevoid借

21、阅?ToolStripMenuItem_Click(object sender,EventArgs e)this。toolStrip1.Visible=false;this。toolStrip2。Visible=false;this.toolStrip3。Visible=true;this.panel1。BackgroundImage=Image。FromFile(AppDomain.CurrentDomain.BaseDirectory+pic3。jpg”);privatevoid门?禁?ToolStripMenuItem_Click(object sender,EventArgs e)/M

22、enJinInit();/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.ToInt32());/privatevoid注销ToolStripMenuItem_Click(object sender,EventArgs e)All。user

23、Login=null;FormLogin fl=newFormLogin();if(fl.ShowDialog()!=DialogResult。OK)this.Close();else Init();privatevoid帮助ToolStripMenuItem1_Click(object sender,EventArgs e)privatevoid系统初始化CToolStripMenuItem_Click(object sender,EventArgs e)if(MessageBox.Show(”是否初始化数据库?”,”,MessageBoxButtons。YesNo)=DialogResul

24、t.Yes)All。dbo.excuteSql(delete from lendtable);All.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(”初始化完成?);privatevoid关于ToolStripMenuItem_Click(object sender,EventArgs

25、e)FormAbout fa=newFormAbout();fa.ShowDialog();protectedoverridevoid DefWndProc(ref System。Windows。Forms.Message m)if(m。Msg=WM_GETBUFFER_LOOP)/启动if(this.timer1。Tag.ToString()=”0”)this.timer1.Start();this。timer1.Tag=”1”;string uid=;string direction=”;bool personWithMultCard=false;rdr。GetLoopGetBufferD

26、ata(m,ref uid,ref direction,if(uid!=0000000000000000”)/进if(direction=”In”)this.directionFlag=1;this。rfids。Add(uid);/出if(direction=”Out”)this.directionFlag=2;this。rfids.Add(uid);if(uid=”FFFFFFFFFFFFFFFF)base。DefWndProc(ref m);ref personWithMultCard);privatevoid timer1_Tick(object sender,EventArgs e)i

27、f(this.directionFlag=1)for(int i=0;i this.rfids。Count;i+)if(ObjCardInfo.IsHas(this.rfidsi))ObjCardInfo oci=newObjCardInfo(this。rfidsi);if(oci。IsOverTime()SetMenJin(PicInOutTime”);MenJinInit();return;else SetMenJin(”PicIn”);MenJinInit();return;SetMenJin(”PicInNoCard);MenJinInit();elseif(this。directio

28、nFlag=2)for(int i=0;i this.rfids。Count;i+)if(ObjBookInfo。IsHas(this.rfidsi)ObjBookInfo obi=newObjBookInfo(this.rfidsi);if(obi。LendStatus=为借出?)this.rdr。WarningOutput(false,false,true,false,false);SetMenJin(”PicOut);MenJinInit();return;MenJinInit();/门禁初始化/privatevoid MenJinInit()this。rfids.Clear();thi

29、s。directionFlag=0;this。timer1。Tag=”0”;this。timer1.Stop();privatevoid SetMenJin(string message)this。fiao。Controls.Clear();UserControlMenJin ucmj=newUserControlMenJin(message);ucmj。Dock=DockStyle.Fill;this。fiao.Controls。Add(ucmj);privatevoid FormMain_FormClosing(object sender,FormClosingEventArgs e)/t

30、his。rfid.StopInventory();/this.rfid.CloseSerial();图书统计图书统计using System;using System。Collections.Generic;using System.ComponentModel;using System。Data;using System.Drawing;using System。Text;using System。Windows.Forms;namespace LabrarypublicpartialclassFormBookStatistics:Form privateint boolShelf;publ

31、ic FormBookStatistics()InitializeComponent();BindTreeView();this。boolShelf=0;BindListView(select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo”);this.cboBookLendStatus。SelectedIndex=0;privatevoid BindTreeView()this.treeView1.Nodes.Clear();TreeNode nodeRoot=newTreeNode();nodeRoot。Te

32、xt=全部书架;this。treeView1.Nodes.Add(nodeRoot);for(int i=0;i 4;i+)TreeNode nodeChild=newTreeNode();if(i=0)nodeChild。Text=第一书架”;if(i=1)nodeChild.Text=第二书架”;if(i=2)nodeChild。Text=第三书架;if(i=3)nodeChild。Text=”第四书架;nodeRoot。Nodes。Add(nodeChild);nodeRoot。Expand();privatevoid BindListView(string sql)this.listV

33、iew1。Items.Clear();this.listView1。Columns.Clear();string headerText=newstring 标签,100,所属分类,100,”书名,150,作者,80,借阅状态,80,”所在书架,80”;for(int i=0;i headerText.Length;i+)ColumnHeader header=newColumnHeader();string headerName=headerTexti.Split(,)0;int headerWidth=Convert.ToInt32(headerTexti。Split(,)1);header

34、.Text=headerName;header.Width=headerWidth;this。listView1。Columns.Add(header);DataTable dtb=All。dbo.getDataTable(sql);for(int i=0;i 0)if(this。cboBookLendStatus。SelectedIndex=0)BindListView(string.Format(”select RFID,BookType_ID,Name,Author,LendStatus,BookShelffrom BookInfo where BookShelf=0”,this.boo

35、lShelf。ToString();if(this。cboBookLendStatus.SelectedIndex=1)BindListView(string.Format(select RFID,BookType_ID,Name,Author,LendStatus,BookShelffrom BookInfo where BookShelf=0 and LendStatus=1”,this。boolShelf。ToString();if(this.cboBookLendStatus.SelectedIndex=2)BindListView(string.Format(select RFID,

36、BookType_ID,Name,Author,LendStatus,BookShelffrom BookInfo where BookShelf=0 and LendStatus=0,this。boolShelf。ToString()));借阅卡管理借阅卡管理using System;using System。Collections。Generic;using System。ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace L

37、abrarypublicpartialclassFormCardList:Formpublic FormCardList()InitializeComponent();SetListView();privatevoid SetListView()this.listView1。Items。Clear();ListObjCardInfo listCard=ObjCardInfo.GetAllCard();for(int i=0;i listCard)this.listView1.Items.Clear();for(int i=0;i listCard.Count;i+)ObjCardInfo oc

38、i=listCardi;ListViewItem item=newListViewItem(oci。Rfid);item.Tag=oci;ListViewItem.ListViewSubItem subitem1=newListViewItem。ListViewSubItem();subitem1.Text=oci。Name;item.SubItems。Add(subitem1);ListViewItem。ListViewSubItem subitem2=newListViewItem。ListViewSubItem();subitem2.Text=oci.Sex;item.SubItems。

39、Add(subitem2);ListViewItem。ListViewSubItem subitem3=newListViewItem。ListViewSubItem();subitem3.Text=oci.Brithday.ToString(yyyy年MM月?dd日?);item。SubItems.Add(subitem3);ListViewItem.ListViewSubItem subitem4=newListViewItem。ListViewSubItem();subitem4.Text=oci。SID;item。SubItems。Add(subitem4);ListViewItem。

40、ListViewSubItem subitem5=newListViewItem.ListViewSubItem();subitem5。Text=oci。StartTime。ToString();item.SubItems.Add(subitem5);ListViewItem.ListViewSubItem subitem6=newListViewItem.ListViewSubItem();subitem6。Text=oci.EndTime。ToString();item.SubItems。Add(subitem6);ListViewItem.ListViewSubItem subitem7

41、=newListViewItem.ListViewSubItem();subitem7.Text=oci.User.Name;item。SubItems。Add(subitem7);this。listView1.Items.Add(item);privatevoid tsbtnExit_Click(object sender,EventArgs e)this.Close();privatevoid tsbtnInsert_Click(object sender,EventArgs e)FormCardInfo fci=newFormCardInfo(1,newObjCardInfo());if

42、(fci.ShowDialog()=DialogResult。OK)SetListView();IsEnabled(false);privatevoid IsEnabled(bool Enabled)/this.tsbtnAddTime。Enabled=Enabled;this。tsbtnUpdate.Enabled=Enabled;this.tsbtnDelete.Enabled=Enabled;this。tsbtnRecord.Enabled=Enabled;privatevoid listView1_SelectedIndexChanged(object sender,EventArgs

43、 e)if(this。listView1。SelectedItems。Count 0)IsEnabled(true);else IsEnabled(false);privatevoid tsbtnAddTime_Click(object sender,EventArgs e)if(this。listView1。SelectedItems。Count 0)ObjCardInfo oci=this.listView1。SelectedItems0。Tag asObjCardInfo;FormCardInfo fci=newFormCardInfo(5,oci);if(fci。ShowDialog(

44、)=DialogResult。OK)SetListView();IsEnabled(false);privatevoid tsbtnUpdate_Click(object sender,EventArgs e)if(this。listView1。SelectedItems.Count 0)ObjCardInfo oci=this。listView1.SelectedItems0。Tag asObjCardInfo;FormCardInfo fci=newFormCardInfo(3,oci);if(fci。ShowDialog()=DialogResult。OK)SetListView();I

45、sEnabled(false);privatevoid tsbtnQuery_Click(object sender,EventArgs e)if(this。tstbTj。Text!=”)if(IsNumber())string sql=string。Format(select rfid from librarycard where rfid like%0by endtime asc,this.tstbTj。Text);SetListView(ObjCardInfo。GetAllCard(sql));elseorderstring sql=string.Format(select rfid f

46、rom librarycard wherename like 0 orderby endtime asc”,this。tstbTj.Text);SetListView(ObjCardInfo。GetAllCard(sql));elseSetListView();privatebool IsNumber()try Convert。ToInt64(this。tstbTj。Text);returntrue;catchreturnfalse;privatevoid tsbtnRecord_Click(object sender,EventArgs e)if(this。listView1。Selecte

47、dItems。Count 0)FormCardRecord fcr=newFormCardRecord(this.listView1。SelectedItems0。TagasObjCardInfo);fcr。ShowDialog();privatevoid tsbtnDelete_Click(object sender,EventArgs e)if(this.listView1。SelectedItems。Count 0)ObjCardInfo oci=this。listView1。SelectedItems0.Tag asObjCardInfo;int count=oci。NotReturn

48、Count();if(count=0)if(MessageBox.Show(是非决定退卡?,”,MessageBoxButtons。YesNo)=DialogResult。Yes)oci.Delete();SetListView();IsEnabled(false);else MessageBox.Show(oci。Name+还1有D”+count。ToString()+本书未换不能退卡!?”);借阅卡信息借阅卡信息using System;using System.Collections.Generic;using System.ComponentModel;using System。Dat

49、a;using System。Drawing;using System.Text;using System。Windows。Forms;namespace LabrarypublicpartialclassFormCardInfo:Form ObjCardInfo oci;int flag;public FormCardInfo()InitializeComponent();public FormCardInfo(int flag,ObjCardInfo oci)InitializeComponent();this。oci=oci;this.flag=flag;SetControl();Ini

50、t();privatevoid Init()/续期if(this.flag=5)this。gbtnReadCard。Enabled=false;this。tbName.Enabled=false;this.rbtn0.Enabled=false;this.rbtn1.Enabled=false;this.dtpBrithday.Enabled=false;this。tbSID.Enabled=false;this。dtpStartTime。Enabled=false;privatevoid SetControl()this。tbRFID.Text=this。oci.Rfid;this。tbNa

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 应用文书 > 工作报告

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁