《c图书管理系统源代码文档》由会员分享,可在线阅读,更多相关《c图书管理系统源代码文档(59页珍藏版)》请在金锄头文库上搜索。
1、 . . . 这里是我的毕业设计,用c#编写学校图书馆管理系统。全部仿真测试过,毕业论文获得优秀,分享给大家。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() InitializeC
2、omponent(); private void loginbtn_Click(object 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 + .feipin100.; OleDbD
3、ataReader dr = DBHelp.OleReader(sql); dr.Read(); if (dr.HasRows) 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(
4、); this.pswtxt.Clear(); af.Show(); else MessageBox.Show(账号或密码错误!, 提示!); 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
5、(object sender, FormClosingEventArgs e) Application.Exit(); 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(); Fil
6、l(); private void okbtn_Click(object sender, EventArgs e) 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;
7、if (this.txtfine.Text = string.Empty) MessageBox.Show(请输入超期罚款金额!, 提示!); 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(T
8、reeNode node in nodes.Nodes) if (node.Checked) arr.Add(1); 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.Count != 0) b = true; break; string sql1; if (b) sql1 = update tb_right set