收藏 分销(赏)

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

上传人:天**** 文档编号:2776799 上传时间:2024-06-05 格式:PDF 页数:82 大小:130.90KB
下载 相关 举报
RFID图书管理系统程序源代码.pdf_第1页
第1页 / 共82页
RFID图书管理系统程序源代码.pdf_第2页
第2页 / 共82页
RFID图书管理系统程序源代码.pdf_第3页
第3页 / 共82页
RFID图书管理系统程序源代码.pdf_第4页
第4页 / 共82页
RFID图书管理系统程序源代码.pdf_第5页
第5页 / 共82页
点击查看更多>>
资源描述

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();/验证控?件t /private bool ValidControl()if(t

2、his.tbID.Text=)MessageBox.Show(请填写用户名!?);this.tbID.Focus();return false;if(this.tbID.Text!=admin)if(!UserManage.ObjUser.IsHasID(All.dbo,this.tbID.Text)MessageBox.Show(不存在此用户!?);this.tbID.Text=;this.tbID.Focus();return false;if(this.tbID.Text!=admin)UserManage.ObjUser user=new UserManage.ObjUser(this

3、.tbID.Text,All.dbo);if(user.PWD!=this.tbPWD.Text)MessageBox.Show(密码错误!?);this.tbPWD.Text=;this.tbPWD.Focus();return false;else if(this.tbPWD.Text!=123456)MessageBox.Show(密码错误!);this.tbPWD.Text=;this.tbPWD.Focus();return false;return true;private void gbtnCancel_Click(object sender,EventArgs e)this.C

4、lose();private void gbtnOK_Click(object sender,EventArgs e)/如?果?验证控?件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);All.userLogin.ID=admin;All.userLogin.Name=管理员;this.DialogResult=DialogRe

5、sult.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 Labrary public partial class FormMain:Form public const int WM_USER=0 x0400;public const int WM_GETBUFFER

6、_LOOP=WM_USER+2;private RFID_dll.Reader rdr;private RFID_dll.RFID rfid;List rfids=new List();int directionFlag=0;/1进;出?FormInAndOut fiao=new FormInAndOut();public FormMain()InitializeComponent();this.rdr=new RFID_dll.Reader();/this.rfid=new RFID_dll.RFID(rdr);private void FormMain_Load(object sender

7、,EventArgs e)Init();/初始化 /private void Init()fiao.StartPosition=FormStartPosition.Manual;/多窗体在不同时间显示 Screen screens=Screen.AllScreens;if(screens.Length=2)List listScreen=new List();foreach(Screen screen in Screen.AllScreens)if(screen.Primary=false)listScreen.Add(screen);fiao.Location=listScreen0.Wor

8、kingArea.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=true;this.图

9、?书管理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();/是?否?找到?门?禁?设备?/if(rfid.

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

11、.退办卡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;else if(purview=2)this.办退卡ToolStripMenuItem.Visib

12、le=true;else if(purview=3)this.借阅?ToolStripMenuItem.Visible=true;else 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 修改密码?ToolStripMe

13、nuItem_Click(object sender,EventArgs 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 sende

14、r,EventArgs e)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(

15、);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,EventArgs e)FormCardLi

16、st fcl=new FormCardList();fcl.ShowDialog();private void tsbtnAddTime_Click(object sender,EventArgs e)string rfid=RfidOperate.GetCard();if(rfid=)MessageBox.Show(请把借阅卡放到桌面读写器上!);else if(ObjCardInfo.IsHas(rfid)ObjCardInfo oci=new ObjCardInfo(rfid);FormCardInfo fci=new FormCardInfo(5,oci);fci.ShowDialog

17、();else MessageBox.Show(没有此借阅卡信息);private void tsbtnCardDelete_Click(object sender,EventArgs e)string rfid=RfidOperate.GetCard();if(rfid=)MessageBox.Show(请把借阅卡到读写器上?);else if(ObjCardInfo.IsHas(rfid)ObjCardInfo oci=new ObjCardInfo(rfid);int count=oci.NotReturnCount();if(count=0)if(MessageBox.Show(是否决

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

19、 tsbtnHuan_Click(object sender,EventArgs e)FormBookHuan fbh=new 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.FromFile(AppD

20、omain.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=Image.FromFile(AppDomain.CurrentDomain.BaseDirectory+pic2.jpg);private v

21、oid 借阅?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);private void 门?禁?ToolStripMenuItem_Click(object sender,EventArg

22、s e)/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.ToInt32();/private void 注销ToolStripMenuItem_Click(object sender,EventArgs e)A

23、ll.userLogin=null;FormLogin fl=new FormLogin();if(fl.ShowDialog()!=DialogResult.OK)this.Close();else Init();private void 帮助ToolStripMenuItem1_Click(object sender,EventArgs e)private void 系统初始化CToolStripMenuItem_Click(object sender,EventArgs e)if(MessageBox.Show(是否初始化数据库?,MessageBoxButtons.YesNo)=Dia

24、logResult.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(初始化完成?);private void 关于ToolStripMenuItem_Click(object sender,Even

25、tArgs e)FormAbout fa=new FormAbout();fa.ShowDialog();protected override void 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.GetLoopGetBu

26、fferData(m,ref uid,ref direction,ref personWithMultCard);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);private void timer1_Tick(object sender,EventArgs e

27、)if(this.directionFlag=1)for(int i=0;i this.rfids.Count;i+)if(ObjCardInfo.IsHas(this.rfidsi)ObjCardInfo oci=new ObjCardInfo(this.rfidsi);if(oci.IsOverTime()SetMenJin(PicInOutTime);MenJinInit();return;else SetMenJin(PicIn);MenJinInit();return;SetMenJin(PicInNoCard);MenJinInit();else if(this.direction

28、Flag=2)for(int i=0;i this.rfids.Count;i+)if(ObjBookInfo.IsHas(this.rfidsi)ObjBookInfo obi=new ObjBookInfo(this.rfidsi);if(obi.LendStatus=为借出?)this.rdr.WarningOutput(false,false,true,false,false);SetMenJin(PicOut);MenJinInit();return;MenJinInit();/门禁初始化 /private void MenJinInit()this.rfids.Clear();th

29、is.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_FormClosing(object sender,FormClosingEventArgs e)

30、/this.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 Labrary public partial class FormBookStatistics:Form private int boolShe

31、lf;public FormBookStatistics()InitializeComponent();BindTreeView();this.boolShelf=0;BindListView(select RFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo);this.cboBookLendStatus.SelectedIndex=0;private void BindTreeView()this.treeView1.Nodes.Clear();TreeNode nodeRoot=new TreeNode();nod

32、eRoot.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(i=2)nodeChild.Text=第三书架;if(i=3)nodeChild.Text=第四书架;nodeRoot.Nodes.Add(nodeChild);nodeRoot.Expand();private void BindListView(string sql)thi

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

34、header.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,BookShelf from BookInfo where BookShelf=0,thi

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

36、RFID,BookType_ID,Name,Author,LendStatus,BookShelf from 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;namespa

37、ce Labrary public partial class FormCardList:Form public FormCardList()InitializeComponent();SetListView();private void SetListView()this.listView1.Items.Clear();List listCard=ObjCardInfo.GetAllCard();for(int i=0;i listCard.Count;i+)ObjCardInfo oci=listCardi;ListViewItem item=new ListViewItem(oci.Rf

38、id);item.Tag=oci;ListViewItem.ListViewSubItem subitem1=new ListViewItem.ListViewSubItem();subitem1.Text=oci.Name;item.SubItems.Add(subitem1);ListViewItem.ListViewSubItem subitem2=new ListViewItem.ListViewSubItem();subitem2.Text=oci.Sex;item.SubItems.Add(subitem2);ListViewItem.ListViewSubItem subitem

39、3=new ListViewItem.ListViewSubItem();subitem3.Text=oci.Brithday.ToString(yyyy年MM月?dd日?);item.SubItems.Add(subitem3);ListViewItem.ListViewSubItem subitem4=new ListViewItem.ListViewSubItem();subitem4.Text=oci.SID;item.SubItems.Add(subitem4);ListViewItem.ListViewSubItem subitem5=new ListViewItem.ListVi

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

41、ext=oci.User.Name;item.SubItems.Add(subitem7);this.listView1.Items.Add(item);private void SetListView(List listCard)this.listView1.Items.Clear();for(int i=0;i 0)IsEnabled(true);else IsEnabled(false);private void tsbtnAddTime_Click(object sender,EventArgs e)if(this.listView1.SelectedItems.Count 0)Obj

42、CardInfo oci=this.listView1.SelectedItems0.Tag as ObjCardInfo;FormCardInfo fci=new FormCardInfo(5,oci);if(fci.ShowDialog()=DialogResult.OK)SetListView();IsEnabled(false);private void tsbtnUpdate_Click(object sender,EventArgs e)if(this.listView1.SelectedItems.Count 0)ObjCardInfo oci=this.listView1.Se

43、lectedItems0.Tag as ObjCardInfo;FormCardInfo fci=new FormCardInfo(3,oci);if(fci.ShowDialog()=DialogResult.OK)SetListView();IsEnabled(false);private void tsbtnQuery_Click(object sender,EventArgs e)if(this.tstbTj.Text!=)if(IsNumber()string sql=string.Format(select rfid from librarycard where rfid like

44、%0%order by endtime asc,this.tstbTj.Text);SetListView(ObjCardInfo.GetAllCard(sql);else string sql=string.Format(select rfid from librarycard where name like%0%order by endtime asc,this.tstbTj.Text);SetListView(ObjCardInfo.GetAllCard(sql);else SetListView();private bool IsNumber()try Convert.ToInt64(

45、this.tstbTj.Text);return true;catch return false;private void tsbtnRecord_Click(object sender,EventArgs e)if(this.listView1.SelectedItems.Count 0)FormCardRecord fcr=new FormCardRecord(this.listView1.SelectedItems0.Tag as ObjCardInfo);fcr.ShowDialog();private void tsbtnDelete_Click(object sender,Even

46、tArgs e)if(this.listView1.SelectedItems.Count 0)ObjCardInfo oci=this.listView1.SelectedItems0.Tag as ObjCardInfo;int count=oci.NotReturnCount();if(count=0)if(MessageBox.Show(是非决定退卡?,MessageBoxButtons.YesNo)=DialogResult.Yes)oci.Delete();SetListView();IsEnabled(false);else MessageBox.Show(oci.Name+还1

47、有D+count.ToString()+本书未换不能退卡!?);借阅卡信息借阅卡信息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 FormCardInfo:Form ObjCardInfo oci;int flag;public FormCardInf

48、o()InitializeComponent();public FormCardInfo(int flag,ObjCardInfo oci)InitializeComponent();this.oci=oci;this.flag=flag;SetControl();Init();private void Init()/续期 if(this.flag=5)this.gbtnReadCard.Enabled=false;this.tbName.Enabled=false;this.rbtn0.Enabled=false;this.rbtn1.Enabled=false;this.dtpBrithd

49、ay.Enabled=false;this.tbSID.Enabled=false;this.dtpStartTime.Enabled=false;private void SetControl()this.tbRFID.Text=this.oci.Rfid;this.tbName.Text=this.oci.Name;if(this.oci.Sex=男)this.rbtn1.Checked=true;else this.rbtn0.Checked=false;this.dtpBrithday.Value=this.oci.Brithday;this.tbSID.Text=this.oci.S

50、ID;this.dtpStartTime.Value=this.oci.StartTime;this.dtpEndTime.Value=this.oci.EndTime;if(this.flag!=1)this.tbUser.Text=this.oci.User.Name;this.tbUser.Tag=this.oci.User;else this.tbUser.Text=All.userLogin.Name;this.tbUser.Tag=All.userLogin;private bool ValidControl()if(this.tbRFID.Text=)MessageBox.Sho

展开阅读全文
部分上传会员的收益排行 01、路***(¥15400+),02、曲****(¥15300+),
03、wei****016(¥13200+),04、大***流(¥12600+),
05、Fis****915(¥4200+),06、h****i(¥4100+),
07、Q**(¥3400+),08、自******点(¥2400+),
09、h*****x(¥1400+),10、c****e(¥1100+),
11、be*****ha(¥800+),12、13********8(¥800+)。
相似文档                                   自信AI助手自信AI助手
搜索标签

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服