2022年系统源代码参照 .pdf
《2022年系统源代码参照 .pdf》由会员分享,可在线阅读,更多相关《2022年系统源代码参照 .pdf(18页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、namespace BookManage publicpartialclassfrmLogin : Form public frmLogin() InitializeComponent(); privatevoid btnLogin_Click(object sender, EventArgs e) / 验证通过if (Validate() string state = this .cboUserType.Text; int num; if (state.Equals(管理员 ) / 判断用户角色 num = 1; elseif (state.Equals(后台管理 ) num = 2; el
2、se num = 3; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 18 页 - - - - - - - - - / 定义查询语句string sql = string.Format( select * from userinfo where uname=0and upwd=1 and ustate=2, this .txName.Text.Trim(),this .txtPwd.Text.Trim(),num); DataSet ds = DataAccess.Ge
3、tDataSetBySql(sql); if (ds.Tables0.Rows.Count 0) MessageBox .Show( 登录成功 ); Constans .UserBookID = ds.Tables0.Rows0UBookID .ToString(); Constans .UserName = ds.Tables0.Rows0UName.ToString(); Constans .UserState = ds.Tables0.Rows0UState .ToString(); if (num=1) frmMain .result = DialogResult.OK; this .
4、Hide(); frmMain main = new frmMain (); main.ShowDialog(); elseif (num = 2) frmBookInStore store = new frmBookInStore(); store.ShowDialog(); else frmBookJY jy = new frmBookJY(); jy.ShowDialog(); else MessageBox .Show( 用户名或密码错误); privatevoid frmLogin_Load(object sender, EventArgs e) this .cboUserType.
5、SelectedIndex = 0; / 验证方法privatebool Vaildate() if ( this .txName.Text != string.Empty & this .txtPwd.Text != string.Empty) returntrue ; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 18 页 - - - - - - - - - else MessageBox .Show( 用户名或密码不能为空); returnfalse ; priv
6、atevoid btnCancle_Click(object sender, EventArgs e) this .Close(); namespace BookManage publicpartialclassfrmMain : Form publicstaticDialogResult result; public frmMain() InitializeComponent(); / 查询子窗体是否存在publicbool checkchildfrm(string childfrmname) foreach ( Form childFrm inthis .MdiChildren) if (
7、childFrm.Name = childfrmname) if (childFrm.WindowState = FormWindowState.Minimized) childFrm.WindowState = FormWindowState.Normal; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 18 页 - - - - - - - - - childFrm.Activate(); returntrue ; returnfalse ; / 用户登录菜单的事件处
8、理privatevoid用户登录 ToolStripMenuItem_Click(object sender, EventArgs e) / 检测该窗口是否处于打开状态if ( this .checkchildfrm(frmLogin) = true ) return ; / 窗口已经打开,返回frmLogin user = new frmLogin (); / 实例化登录窗体 user.ShowDialog(); / 登录窗体以模式对话框的方式的打开/ 判断是否登录成功,登录成功则启用相应的菜单和按钮if (result = DialogResult.OK) this .tsbtnAddBo
9、ok.Enabled = true ; this .mnuUpdateBook.Enabled = true ; this .mnuAddBook.Enabled = true ; / 登录按钮事件处理privatevoid tsbtnLogin_Click(object sender, EventArgs e) if ( this .checkchildfrm(frmLogin) = true ) return ; frmLogin user = new frmLogin (); user.ShowDialog(); if (result = DialogResult.OK) this .t
10、sbtnAddBook.Enabled = true ; this .mnuUpdateBook.Enabled = true ; this .mnuAddBook.Enabled = true ; / 图书查询按钮 Click 事件处理privatevoid tsbtnSearch_Click(object sender, EventArgs e) frmBookSearch frmbs = new frmBookSearch (); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第
11、 4 页,共 18 页 - - - - - - - - - frmbs.ShowDialog(); / 图书检索菜单 Click 事件处理privatevoid图书检索 ToolStripMenuItem_Click(object sender, EventArgs e) frmBookSearch frmbs = new frmBookSearch (); frmbs.ShowDialog(); / 图书入库菜单 Click 事件处理privatevoid图书入库 ToolStripMenuItem1_Click(object sender, EventArgs e) frmBookInSt
12、ore bookinstore = new frmBookInStore(); bookinstore.ShowDialog(); / 图书入库按钮 Click 事件处理privatevoid tsbtnAddBook_Click(object sender, EventArgs e) frmTsgx tsgx = new frmTsgx (); tsgx.ShowDialog(); / 图书更新菜单 Click 事件处理privatevoid图书修改 ToolStripMenuItem_Click(object sender, EventArgs e) frmTsgx tsgx = new
13、frmTsgx (); tsgx.ShowDialog(); / 图书借阅按钮事件处理privatevoid tsbtnIssue_Click(object sender, EventArgs e) frmBookJY bookjy = new frmBookJY(); bookjy.ShowDialog(); privatevoid tsbtnExit_Click(object sender, EventArgs e) Application.Exit(); privatevoid退出 ToolStripMenuItem1_Click(object sender, EventArgs e)
14、Application.Exit(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 18 页 - - - - - - - - - privatevoid退出 ToolStripMenuItem_Click(object sender, EventArgs e) Application.Exit(); / 窗体载入时事件处理privatevoid FrmMain_Load( object sender, EventArgs e) /this.tsbtnAddBook.E
15、nabled = false; /this.mnuAddBook.Enabled = false; /this.mnuUpdateBook.Enabled = false; / 在关闭主窗体的同时,关闭整个系统privatevoid frmMain_FormClosed(object sender, FormClosedEventArgs e) Application.Exit(); privatevoid图书借阅 ToolStripMenuItem_Click(object sender, EventArgs e) frmBookJY bookJy = new frmBookJY(); bo
16、okJy.ShowDialog(); privatevoid图书归还 ToolStripMenuItem_Click(object sender, EventArgs e) frmBookReturn frmreturn = new frmBookReturn (); frmreturn.ShowDialog(); privatevoid注册 ToolStripMenuItem_Click(object sender, EventArgs e) frmUserZC zc = new frmUserZC(); zc.ShowDialog(); 名师资料总结 - - -精品资料欢迎下载 - - -
17、 - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 18 页 - - - - - - - - - namespace BookManage publicpartialclassfrmBookInStore : Form public frmBookInStore() InitializeComponent(); privatevoid BookInStore_Load(object sender, EventArgs e) DataSet Myds = DataAccess .GetDataSetBySql(select *
18、from BookInfo); DataTable table = Myds.Tables0; this .dataGridView1.DataSource = table; privatevoid btnExit_Click(object sender, EventArgs e) this .Close(); privatevoid btnInsert_Click(object sender, EventArgs e) string bookname = this .txtBookName.Text; string booktype = this .txtBookType.Text; str
19、ing author = this .txtAuthor.Text; string cbs = this .txtCBS.Text;/ 出版商int kc = Convert .ToInt32( this .txtKC.Text);/ 库存int kjysl =Convert .ToInt32( this .txtKJY.Text);/ 可借阅数量名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 18 页 - - - - - - - - - string sql = str
20、ing.Format( insert into BookInfo values(0,1,2,3,4,5), booktype,bookname, author, cbs, kc, kjysl); if ( DataAccess .UpdateDataTable(sql) MessageBox .Show( 添加成功! , 提示 ); else MessageBox .Show( 添加失败! , 提示 , MessageBoxButtons .OK); DataSet Myds = DataAccess .GetDataSetBySql(select * from BookInfo); Data
21、Table table=Myds.Tables0; this .dataGridView1.DataSource = table; publicbool Validate() returntrue ; namespace BookManage publicpartialclassfrmTsgx : Form public frmTsgx() 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 18 页 - - - - - - - - - InitializeComponent
22、(); privatevoid btnClose_Click(object sender, EventArgs e) this .Close(); privatevoid frmTsgx_Load( object sender, EventArgs e) DataSet Myds = DataAccess .GetDataSetBySql(select * from BookInfo); DataTable table = Myds.Tables0; dataGridView1.DataSource = table; privatevoid dataGridView1_CellContentC
23、lick(object sender, DataGridViewCellEventArgse) int index = dataGridView1.CurrentCell.RowIndex; this .textBox1.Text = this .dataGridView1.Rowsindex.Cells0.Value.ToString().Trim();/ 图书编号this .textBox2.Text = this .dataGridView1.Rowsindex.Cells2.Value.ToString().Trim();/ 图书名称this .textBox3.Text = this
24、 .dataGridView1.Rowsindex.Cells1.Value.ToString().Trim();/ 图书类型this .textBox4.Text = this .dataGridView1.Rowsindex.Cells3.Value.ToString().Trim();/ 图书作者this .textBox5.Text = this .dataGridView1.Rowsindex.Cells4.Value.ToString().Trim();/ 出版商this .textBox6.Text = this .dataGridView1.Rowsindex.Cells5.V
25、alue.ToString().Trim();/ 库存this .textBox7.Text = this .dataGridView1.Rowsindex.Cells6.Value.ToString().Trim();/ 可借阅的数量 privatevoid btnUpdate_Click(object sender, EventArgs e) string bookname = textBox2.Text.ToString().Trim(); string booktype = textBox3.Text.ToString().Trim(); string bookauthor = tex
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年系统源代码参照 2022 系统 源代码 参照
限制150内