版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、.专业整理.登陆界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespaceLabrarypublic partial class FormLogin : Formpublic FormLogin()InitializeComponent();/ summary/ 验一|证?6括件t/ /summary / <re
2、turns></returns> private bool ValidControl()if ( this .tbID.Text ="")MessageBoxShow("请填写用户名! e ?!);this .tbID.Focus(); return false ;if ( this .tbID.Text != "admin") if (!UserManage. ObjUser .IsHasID( All .dbo, this .tbID.Text) MessageBoxShow("不存在此用户! e ?"
3、); 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)MessageBoxShow("密码错误! e ?');this .tbPWD.Text =""this .tbPWD.Focu
4、s(); return false ; elseif ( this .tbPWD.Text !="123456")MessageBoxShow("密码错误!");this .tbPWD.Text =""this .tbPWD.Focus(); return false ;return true ;private void gbtnCancel_Click( object sender, EventArgs e) this .Close();private void gbtnOK_Click( object sender, EventA
5、rgs e) /如一 ?果?验一 |证?6报件1通2?§过丫 if (ValidControl()if ( this .tbID.Text != "admin")All .userLogin = new UserManage. ObjUser(this .tbID.Text, All .dbo); elseAll .userLogin = new UserManage. ObjUser(All .dbo);All .userLogin.ID = "admin"All .userLogin.Name ="管理员";this .
6、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;namespaceLabrarypublic partialclass FormMain : Formpublicpublicconst int WM_USER = 0x0400;co
7、nst 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 进;出?FormInAndOut fiao = new FormInAndOut();public FormMain()InitializeComponent();this .rdr = newRFID_dll. Reader。;/this.r
8、fid = new RFID_dll.RFID(rdr); private void FormMain_Load( object sender, EventArgs e) Init();/ summary/初始化/ /summaryprivate void Init()fiao.StartPosition =FormStartPosition .Manual;/多窗体在不同时间显示Screen口 screens = Screen.AllScreens;if (screens.Length = 2) ListScreenlistScreen = new List <Screen>()
9、; foreach ( Screen screen in Screen .AllScreens) if (screen.Primary = false )listScreen.Add(screen);fiao.Location = listScreen0.WorkingArea.Location;SetMenJin( "PicIn"); fiao.Show(); /toolStripStatusLabel2显示登陆用户名?toolStripStatusLabel2.Text =All .userLogin.Name;this .panell.Backgroundlmage
10、= null ;/菜单栏全部显示o?this .用?户? i 管 一 1理。一 aToolStripMenultem.Visible =true ;this .系| i 统a3初始o?化?¥ CToolStripMenultem.Visible =true ;this .应?| 用??南莫? 6 式o?ToolStripMenuItem.Visible = true ;this .图a?书。一 | 管 一 1 理。"aToolStripMenultem.Visible = true ;this .退a?办? 一 ?卡? § ToolStripMenultem.Vi
11、sible = true ;this .借,阅?ToolStripMenuItem.Visible = true ;this .门?禁?ToolStripMenuItem.Visible = true ;SetPurview();this.toolStripl.Visible=false;this.toolStrip2.Visible=false;this.toolStrip3.Visible=false;/rfid.OpenSerial();/是o?否。?找.一到i ?了禁?设| .一备d?/if (rfid.ChangeWorkModel(2) / rfid.StartInventory(
12、this.Handle.ToInt32(),2);/ summary/权限设置/ /summaryprivate void SetPurview() if ( All .userLogin.ID = "admin")this .应?| 用??南莫? 6 式o?ToolStripMenuItem.Visible =false ; else this .用户管理一 aToolStripMenultem.Visible = false ;this .系统初始化?¥ CToolStripMenultem.Visible =false ;this .读书管理一 aToolS
13、tripMenultem.Visible = false ;this .退力卡? § ToolStripMenultem.Visible = false ;this .借IMl ToolStripMenultem.Visible =false ;this .门禁?ToolStripMenultem.Visible = false ;for ( int i = 0; i < All .userLogin.Purview.Count; i+) string purview = All .userLogin.Purviewi;if (purview ="1")th
14、is .图书管理一 aToolStripMenulte m.Visible = true ; else if (purview ="2")this .办退卡? § ToolStripMenultem.Visible = true ;else if (purview ="3")this .借I?T ?ToolStripMenuItem.Visible =true ;else if (purview ="4")this .门禁 ToolStripMenultem.Visible = true ;private void 用户管理
15、一 aToolStripMenuItem_Click( object sender, EventArgs e) UserManage. FormUserList ful =new UserManage. FormUserList (All .conn);ful.ShowDialog();private void 修改密码?ToolStripMenuItem_Click(object sender, EventArgs e)UserManage. FormUserPwdfup = newUserManage. FormUserPwd( All .conn, All .userLogin);fup
16、.ShowDialog();private void tsbtnBookType_Click( object sender, EventArgs e) FormBookTypeList fbtl = new FormBookTypeList ();fbtl.ShowDialog();private void tsbtnBookAdd_Click( object sender, EventArgs e) FormBookAddfba = new FormBookAdd);fba.ShowDialog();private void tsbtnBookManage_Click( object sen
17、der, EventArgs e) FormBookInfoList fbil = new FormBookInfoList ();fbil.ShowDialog();private void tsbtnBookStatistics_Click( object sender, EventArgs e)FormBookStatistics fbs = new FormBookStatistics (); fbs.ShowDialog();private void 退a?出?XToolStripMenuItem_Click(object sender, EventArgs e)this .Clos
18、e(); 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) FormCardList fcl = new FormCardList ();fcl.ShowDialog();private void tsbtnAddTime_Click( objec
19、t sender, EventArgs e) string rfid = RfidOperate .GetCard(); if (rfid ="")MessageBoxShow("请把借阅卡放到桌面读写器上!"); else if ( ObjCardInfo .IsHas(rfid) ObjCardInfo oci = new ObjCardInfo (rfid);FormCardInfo fci = new FormCardInfo (5, oci); fci.ShowDialog(); elseMessageBoxShow("没有此借阅卡信
20、息"); private void tsbtnCardDelete_Click( object sender, EventArgs e) string rfid = RfidOperate .GetCard(); if (rfid ="")MessageBoxShow("请把借阅卡到读写器上?"); else if ( ObjCardInfo .IsHas(rfid) ObjCardInfo oci = new ObjCardInfo (rfid);int count = oci.NotReturnCount(); if (count = 0)
21、 if ( MessageBoxShow("是否决定退卡! e ?""", MessageBoxButtons .YesNo) = DialogResult .Yes) oci.Delete();MessageBoxShow("退卡成功 | ! e ?); else MessageBoxShow(oci.Name + "还有一本"+ count.ToString() +"本书未归还不能退卡?"); else MessageBoxShow("没有止匕借阅信息?"); private vo
22、id tsbtnJie_Click( object sender, EventArgs e) FormBookJie fbj = new FormBookJie(1);fbj.ShowDialog();private void tsbtnHuan_Click( object sender, EventArgs e)FormBookHuanfbh = new FormBookHua。fbh.ShowDialog();private void 图a?书。一 | 管 一 1 理。一 aToolStripMenuItem_Click( object sender, EventArgs e)this.t
23、oolStrip1.Visible =true ;this.toolStrip2.Visible =false;this.toolStrip3.Visible =false;this.panel1.BackgroundImage =Image.FromFile( AppDomainCurrentDomain.BaseDirectory +"pic1.jpg");private void 退a?办? 一?卡? § ToolStripMenuItem_Click( object sender, EventArgs e) this.toolStrip1.Visible=
24、false;this.toolStrip2.Visible=true ;this.toolStrip3.Visible=false;this.panel1.BackgroundImage =Image.FromFile( AppDomainCurrentDomain.BaseDirectory +"pic2.jpg");private void 借.一 阅?ToolStripMenuItem_Click( object sender, EventArgs e) this.toolStrip1.Visible=false;this.toolStrip2.Visible=fal
25、se;this.toolStrip3.Visible=true ;this.panel1.BackgroundImage =Image.FromFile( AppDomainCurrentDomain.BaseDirectory +"pic3.jpg");private void 门?禁?ToolStripMenuItem_Click( object sender, EventArgs e) /MenJinInit();/this.toolStrip1.Visible = false;/this.toolStrip2.Visible = false;/this.toolSt
26、rip3.Visible = false;/this.panel1.BackgroundImage = null;/rfid.OpenSerial();/是否找到门禁设备?/if (rfid.IsOpen)/ rfid.StartInventory(this.Handle.ToInt32();/private void 注销 2ToolStripMenuItem_Click( object sender, EventArgs e) All .userLogin = null ;FormLogin fl = new FormLogin ();if (fl.ShowDialog() != Dial
27、ogResult .OK)this .Close(); elseInit();private void 帮助 一 2ToolStripMenuItem1_Click( object sender, EventArgs e) private void 系统初始化?¥ CToolStripMenuItem_Click( object sender, EventArgs e) if ( MessageBoxShow("是否初始化数据库?", "" , MessageBoxButtons.YesNo)=DialogResult .Yes)All .db
28、o.excuteSql(All .dbo.excuteSql(All .dbo.excuteSql(All .dbo.excuteSql(All .dbo.excuteSql("delete from lendtable" );"delete from bookinfo");"delete from booktype");"delete from librarycard" );"delete from usertable" );MessageBoxShow("初始化完成?")
29、;private void 关于 ToolStripMenuItem_Click( object sender, EventArgs e)FormAbout fa = new FormAbout(); fa.ShowDialog();protected override void DefWndProc( ref System.Windows.Forms. Messagem) if (m.Msg = WM_GETBUFFER_LOOP)/启动if ( this .timer1.Tag.ToString() ="0")this .timer1.Start();this .tim
30、er1.Tag ="1"string uid =""string direction =""bool personWithMultCard =false ;rdr.GetLoopGetBufferData(m,ref uid, ref direction, refpersonWithMultCard); if (uid !="0000000000000000")/进if (direction = "In") this .directionFlag = 1;this .rfids.Add(uid)
31、; /出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)if ( this .directionFlag = 1)for ( int i = 0; i < this .rfids.Count; i+)if ( ObjCardInfo .IsHas( t
32、his .rfidsi)ObjCardInfo oci = new ObjCardInfo (this .rfidsi);if (oci.IsOverTime()SetMenJin("PicInOutTime");MenJinInit();return ;elseSetMenJin("PicIn");MenJinInit();return ;SetMenJin("PicInNoCard");MenJinInit();else if ( this .directionFlag = 2)for ( int i = 0; i < th
33、is .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(); / summary/门禁初始化/ /summary
34、 private void MenJinInit() this .rfids.Clear();this .directionFlag = 0;this .timerl.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(
35、ucmj); private void FormMain_FormClosing( object sender, FormClosingEventArgs e) /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;nam
36、espaceLabrary public partial 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.SelectedInd
37、ex = 0; private void BindTreeView() this .treeView1.Nodes.Clear();TreeNode nodeRoot = new TreeNode();nodeRoot.Text ="全部书架 1"this .treeView1.Nodes.Add(nodeRoot);for ( int i = 0; i < 4; i+) TreeNode nodeChild = new TreeNode(); if (i = 0) nodeChild.Text ="第一书架 1" if (i = 1)nodeCh
38、ild.Text ="第二书架1”;if (i = 2)nodeChild.Text ="第三书架. 1”;if (i = 3)nodeChild.Text ="第四书架 一 1”;nodeRoot.Nodes.Add(nodeChild);nodeRoot.Expand();private void BindListView( string sql) this .listView1.Items.Clear();this .listView1.Columns.Clear();string 口 headerText = new string 口 ”标签,100“,”
39、 所属分类。一 O ,100“,“ 书 名,150“,”作者,80“,“借阅危志,80”,”所在书架,80“ ;for ( int i = 0; i < headerText.Length; i+) ColumnHeaderheader = new ColumnHeadeQstring headerName = headerTexti.Split( ',' )0;int headerWidth = Convert .ToInt32(headerTexti.Split( ',' )1);header.Text = headerName;header.Widt
40、h = headerWidth;this .listView1.Columns.Add(header); DataTable dtb = All .dbo.getDataTable(sql);for ( int i = 0; i < dtb.Rows.Count; i+) ObjBookInfo bookinfo = new ObjBookInfo (dtb.Rowsi "RFID” .ToString();ListViewItem item = new ListViewitem (new string bookInfo.RFID, bookInfo.BookType.Name
41、, bookInfo.Name, bookInfo.Author, bookInfo.LendStatus, bookInfo.BookShelf);this .listViewl.Items.Add(item);ListViewItem itemCount = new ListViewItem (newstring 口 "统a3计?","","","""",dtb.Rows.Count.ToString() +"本d ?");this .listView1.Items.Ad
42、d(itemCount);private void treeView1_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e)if (e.Node.Text ="全部书架- 1")this .boolShelf = 0;BindListView(string .Format( "selectRFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo" );if (e.Node.Text ="第一书架 一 1&q
43、uot;)this .boolShelf = 1;BindListView(string .Format( "selectRFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='1'");if (e.Node.Text ="第二书架. 1”)this .boolShelf = 2;BindListView(string .Format( "selectRFID,BookType_ID,Name,Author,LendStatus,Bo
44、okShelf from BookInfo where BookShelf='2'");if (e.Node.Text ="第三书架, 1”)this .boolShelf = 3;BindListView(string .Format( "selectRFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='3'");if (e.Node.Text ="第四书架 1")this .boolShelf
45、 = 4;BindListView(string .Format( "selectRFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='4'");private void toolStripComboBox1_SelectedIndexChanged( object sender, EventArgs e) if ( this .boolShelf = 0) if ( this .cboBookLendStatus.SelectedIndex = 0)
46、 BindListView(string .Format( "selectRFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo" ); if ( this .cboBookLendStatus.SelectedIndex = 1) BindListView(string .Format( "selectRFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where LendStatus='1'&quo
47、t;);if ( this .cboBookLendStatus.SelectedIndex = 2) BindListView(string .Format( "selectRFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where LendStatus='0'"); if ( this .boolShelf > 0) if ( this .cboBookLendStatus.SelectedIndex = 0) BindListView(string .Format(
48、"selectRFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='0'",this .boolShelf.ToString(); if ( this .cboBookLendStatus.SelectedIndex = 1) BindListView(string .Format( "selectRFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where Boo
49、kShelf='0' and LendStatus='1'" , this .boolShelf.ToString(); if ( this .cboBookLendStatus.SelectedIndex = 2) BindListView(string .Format( "selectRFID,BookType_ID,Name,Author,LendStatus,BookShelf from BookInfo where BookShelf='0' and LendStatus='0'" , th
50、is .boolShelf.ToString(); 借阅卡管理using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespaceLabrarypublic partial class FormCardList : Form public FormCardList()InitializeComponent();SetListView
51、();private void SetListView() this .listView1.Items.Clear();List <ObjCardInfo > listCard = ObjCardInfo .GetAllCard(); for ( int i = 0; i < listCard.Count; i+)ObjCardInfo oci = listCardi;ListViewItem item = new ListViewItem (oci.Rfid); item.Tag = oci;ListViewItem . ListViewSubItem subitem1 =
52、 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 .ListViewSubItemsubitem3 =new"yyyy 年一 0MMi ?dd 日 一 ?"
53、);ListViewItem . ListViewSubItem ();subitem3.Text = oci.Brithday.ToString( item.SubItems.Add(subitem3);ListViewItem . ListViewSubItem subitem4 = new ListViewItem . ListViewSubItem ();subitem4.Text = oci.SID;item.SubItems.Add(subitem4);ListViewItem . ListViewSubItem subitem5 = new ListViewItem . List
54、ViewSubItem ();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 . ListView
55、SubItem ();subitem7.Text = oci.User.Name;item.SubItems.Add(subitem7);this .listView1.Items.Add(item); private void SetListView( List <ObjCardInfo > listCard) this .listView1.Items.Clear();for ( int i = 0; i < listCard.Count; i+) ObjCardInfo oci = listCardi;ListViewItem item = new ListViewIt
56、em (oci.Rfid); item.Tag = oci;ListViewItem . ListViewSubItem subitem1 = new ListViewItem . ListViewSubItem ();subitem1.Text = oci.Name;item.Subltems.Add(subiteml);ListViewItem . ListViewSubItem subitem2 = new ListViewItem . ListViewSubItem ();subitem2.Text = oci.Sex;item.SubItems.Add(subitem2);new&q
57、uot;yyyy 年一 0MMi ?dd 日 一 ?");ListViewItem . ListViewSubItem subitem3 =ListViewItem . ListViewSubItem ();subitem3.Text = oci.Brithday.ToString( item.SubItems.Add(subitem3);ListViewItem . ListViewSubItem subitem4 = new ListViewItem . ListViewSubItem ();subitem4.Text = oci.SID;item.SubItems.Add(subitem4);ListViewItem . ListViewSubItem subitem5 = new ListViewItem . Lis
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 播音主持人雇佣协议
- 销售提成奖金合同
- 培训学校专业职业指导培训服务合同
- 终止水泥购销合同协议
- 安全协议与合同
- 招标投标表格部分的内容解读与分析
- 网络营销合同范本版合同协议解读
- 数字风向计仪表采购合同
- 公司总公司与分公司合作合同
- 房屋购买委托协议范本
- 2024年度餐饮店合伙人退出机制与财产分割协议2篇
- 《招商银行转型》课件
- 灵新煤矿职业病危害告知制度范文(2篇)
- 2024年护校队安全工作制度(3篇)
- 2024年安徽省广播电视行业职业技能大赛(有线广播电视机线员)考试题库(含答案)
- 山东省济南市济阳区三校联考2024-2025学年八年级上学期12月月考语文试题
- 糖尿病酮酸症中毒
- Unit 6 Food Lesson 1(说课稿)-2024-2025学年人教精通版(2024)英语三年级上册
- 东北师大附属中学2025届高一物理第一学期期末质量检测试题含解析
- HSE(健康、安全与环境)计划书
- 雨的形成课件教学课件
评论
0/150
提交评论