c#图书管理系统源代码.doc
《c#图书管理系统源代码.doc》由会员分享,可在线阅读,更多相关《c#图书管理系统源代码.doc(59页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、更多实例访问成功网1.登陆界面主要代码:public partial class LoginForm : Form public static string uacc; public static string upsw; public static string uname; public static string usex; public static string upart; public static string uright; public LoginForm() InitializeComponent(); private void loginbtn_Click(object
2、 sender, EventArgs e) if (this.useracctxt.Text.Trim() = & this.pswtxt.Text = ) MessageBox.Show(请输入您的用户名和密码!, 提示!); return; try string sql; sql = select * from tb_user where uacc= + this.useracctxt.Text + and upsw= + this.pswtxt.Text + ; OleDbDataReader dr = DBHelp.OleReader(sql); dr.Read(); if (dr.H
3、asRows) uacc = this.useracctxt.Text; upsw = this.pswtxt.Text; uname = druname.ToString(); usex = drusex.ToString(); upart = drupart.ToString(); uright = druright.ToString(); MainForm af = new MainForm(this); this.Hide(); this.useracctxt.Clear(); this.pswtxt.Clear(); af.Show(); else MessageBox.Show(账
4、号或密码错误!, 提示!); this.useracctxt.Clear(); this.pswtxt.Clear(); this.useracctxt.Focus(); catch (Exception) MessageBox.Show(数据库无法连接!, 警告!); private void cancelbtn_Click(object sender, EventArgs e) Application.Exit(); private void LoginForm_Closing(object sender, FormClosingEventArgs e) Application.Exit(
5、); 2.主界面(图较小,自己可以拉大点)主要代码就不写了,很简单。3.权限设置主要代码:public partial class RightSet : Form public RightSet() InitializeComponent(); private void RightSet_Load(object sender, EventArgs e) this.rightbox.SelectedIndex = 0; /this.treeright.ExpandAll(); Fill(); private void okbtn_Click(object sender, EventArgs e)
6、 if (this.txtnum.Text = string.Empty) MessageBox.Show(请输入最大借阅图书数量!, 提示!); return; if (this.txtday.Text = string.Empty) MessageBox.Show(请输入最大借阅图书时间!, 提示!); return; if (this.txtcost.Text = string.Empty) MessageBox.Show(请输入借书押金金额!, 提示!); return; if (this.txtfine.Text = string.Empty) MessageBox.Show(请输入
7、超期罚款金额!, 提示!); return; if (this.txttim.Text = string.Empty) MessageBox.Show(请输入图书遗失罚款倍数!, 提示!); return; ArrayList arr = new ArrayList(); foreach (TreeNode nodes in this.treeright.Nodes) if (nodes.Checked) arr.Add(1); else arr.Add(0); foreach(TreeNode node in nodes.Nodes) if (node.Checked) arr.Add(1)
8、; else arr.Add(0); string a=new string11; for (int i = 0; i arr.Count; i+) if (arri.ToString().Trim() = 1) ai = yes; else ai = no; string sql = string.Empty; sql += select * from tb_right where uright= + this.rightbox.Text + ; DataTable dt = DBHelp.ExeOleCommand(sql); bool b = false; while (dt.Rows.
9、Count != 0) b = true; break; string sql1; if (b) sql1 = update tb_right set ; sql1 += maxbook= + this.txtnum.Text + ,; sql1 += maxdate= + this.txtday.Text + ,; sql1 += rcost= + this.txtcost.Text + ,; sql1 += rfine= + this.txtfine.Text + ,; sql1 += rtim= + this.txttim.Text + ,; sql1 += rbm= + a0 + ,;
10、 sql1 += rum= + a1 + ,; sql1 += rrm= + a2 + ,; sql1 += rborm= + a3 + ,; sql1 += ris= + a4 + ,; sql1 += rbis= + a5 + ,; sql1 += ruis= + a6 + ,; sql1 += rboris= + a7 + ,; sql1 += rblp= + a8 + ,; sql1 += rbl= + a9 + ,; sql1 += rlp= + a10 + ; sql1 += where uright= + this.rightbox.Text + ; else sql1 = in
11、sert into tb_right(uright,maxbook,maxdate,rcost,rfine,rtim,rbm,rum,rrm,rborm,ris,rbis,ruis,rboris,rblp,rbl,rlp); sql1 += values( + this.rightbox.Text + , + this.txtnum.Text + , + this.txtday.Text + , + this.txtcost.Text + , + this.txtfine.Text + , + this.txttim.Text + , + a0 + , + a1 + , + a2 + , +
12、a3 + , + a4 + , + a5 + , + a6 + , + a7 + , + a8 + , + a9 + , + a10 + ); DataTable dt1 = DBHelp.ExeOleCommand(sql1); Fill(); private void Fill() string sql; sql = select rid as ID号,uright as 用户身份, maxbook as 最大借书数量,maxdate as 最大借阅时间,rcost as 押金,rfine as 超期罚率,rtim as 遗失赔率,rbm as 图书管理,rum as 用户管理,rrm a
13、s 权限管理,rborm as 借阅管理,ris as 信息查询,rbis as 图书信息查询,ruis as 用户信息查询,rboris as 借阅历史查询,rblp as 图书挂失处理,rbl as 图书挂失,rlp as 挂失处理 from tb_right; DataTable dt = DBHelp.ExeOleCommand(sql); this.dataGridView1.DataSource = dt; private void cell_click(object sender, DataGridViewCellEventArgs e) this.rightbox.Text =
14、 this.dataGridView11, this.dataGridView1.CurrentCell.RowIndex.Value.ToString().Trim(); this.txtnum.Text = this.dataGridView12, this.dataGridView1.CurrentCell.RowIndex.Value.ToString().Trim(); this.txtday.Text = this.dataGridView13, this.dataGridView1.CurrentCell.RowIndex.Value.ToString().Trim(); thi
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- c# 图书 管理 系统 源代码
限制150内