1、c#图书系统源代码c#图书系统源代码部门: xxx 时间: xxx制作人:xxx整理范文,仅供参考,可下载自行修改1.登陆界面主要代码:publicpartialclassLoginForm : Formpublicstaticstring uacc。publicstaticstring upsw。publicstaticstring uname。publicstaticstring usex。publicstaticstring upart。publicstaticstring uright。public LoginForm( InitializeComponent(。 privatevoi
2、d loginbtn_Click(object sender, EventArgs eb5E2RGbCAP if (this.useracctxt.Text.Trim( = & this.pswtxt.Text = p1EanqFDPw MessageBox.Show(请输入您的用户名和密码!, 提示!。return。 try string sql。 sql = select * from tb_user where uacc= + this.useracctxt.Text + and upsw= + this.pswtxt.Text + 。DXDiTa9E3dOleDbDataReader
3、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 = newMainForm(this。this.Hide(。this.useracctxt.Clear(。this.pswtxt.Clear(。 af.
4、Show(。 else MessageBox.Show(账号或密码错误!, 提示!。this.useracctxt.Clear(。this.pswtxt.Clear(。this.useracctxt.Focus(。 catch (Exception MessageBox.Show(数据库无法连接!, 警告!。 privatevoid cancelbtn_Click(object sender, EventArgs eRTCrpUDGiT Application.Exit(。 privatevoid LoginForm_Closing(object sender, FormClosingEven
5、tArgs e5PCzVD7HxA Application.Exit(。 2.主界面 InitializeComponent(。 privatevoid RightSet_Load(object sender, EventArgs ejLBHrnAILg this.rightbox.SelectedIndex = 0。/this.treeright.ExpandAll(。 Fill(。 privatevoid okbtn_Click(object sender, EventArgs exHAQX74J0X if (this.txtnum.Text = string.Empty MessageB
6、ox.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(请输入超期罚款金额!, 提示!。return。 if (this.txttim.Text = string.Empt
7、y MessageBox.Show(请输入图书遗失罚款倍数!, 提示!。return。 ArrayList arr = newArrayList(。foreach (TreeNode nodes inthis.treeright.Nodes if (nodes.Checked arr.Add(1。 else arr.Add(0。 foreach(TreeNode node in nodes.Nodes if (node.Checked arr.Add(1。 else arr.Add(0。 string a=newstring11。for (int i = 0。 i if (arri.ToStr
8、ing(.Trim( = 1 ai = yes。 else ai = no。 string sql = string.Empty。 sql += select * from tb_right where uright= + this.rightbox.Text + 。LDAYtRyKfEDataTable dt = DBHelp.ExeOleCommand(sql。bool b = false。while (dt.Rows.Count != 0 b = true。break。 string sql1。if (b sql1 = update tb_right set 。 sql1 += maxb
9、ook= + 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 + ,。 sql1 += rum= + a1 + ,。 sql1 += rrm= + a2 + ,。 sql1 += rborm= + a3 + ,。 sql1 += ris= + a4
10、+ ,。 sql1 += rbis= + a5 + ,。 sql1 += ruis= + a6 + ,。 sql1 += rboris= + a7 + ,。 sql1 += rblp= + a8 + ,。 sql1 += rbl= + a9 + ,。 sql1 += rlp= + a10 + 。 sql1 += where uright= + this.rightbox.Text + 。Zzz6ZB2Ltk else sql1 = insert into tb_right(uright,maxbook,maxdate,rcost,rfine,rtim,rbm,rum,rrm,rborm,ris
11、,rbis,ruis,rboris,rblp,rbl,rlp。dvzfvkwMI1 sql1 += values( + this.rightbox.Text + , + this.txtnum.Text + , + this.txtday.Text + , + this.txtcost.Text + , + this.txtfine.Text + , + this.txttim.Text + , + a0 + , + a1 + , + a2 + , + a3 + , + a4 + , + a5 + , + a6 + , + a7 + , + a8 + , + a9 + , + a10 + 。r
12、qyn14ZNXI DataTable dt1 = DBHelp.ExeOleCommand(sql1。 Fill(。 privatevoid 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 as 权限管理,rborm as 借阅管理,ris as 信息查询,rbis as 图书信息查询,ruis as 用户信息查询,rbo
13、ris as 借阅历史查询,rblp as 图书挂失处理,rbl as 图书挂失,rlp as 挂失处理 from tb_right。EmxvxOtOcoDataTable dt = DBHelp.ExeOleCommand(sql。this.dataGridView1.DataSource = dt。 privatevoid cell_click(object sender, DataGridViewCellEventArgs eSixE2yXPq5 this.rightbox.Text = this.dataGridView11, this.dataGridView1.CurrentCel
14、l.RowIndex.Value.ToString(.Trim(。6ewMyirQFLthis.txtnum.Text = this.dataGridView12, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。kavU42VRUsthis.txtday.Text = this.dataGridView13, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。y6v3ALoS89this.txtcost.Text = this.dataGrid
15、View14, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。M2ub6vSTnPthis.txtfine.Text = this.dataGridView15, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。0YujCfmUCwthis.txttim.Text = this.dataGridView16, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。eUts8
16、ZQVRdArrayList list = newArrayList(。string sql = select * from tb_right where uright= + this.rightbox.Text + 。sQsAEJkW5TDataTable dt = DBHelp.ExeOleCommand(sql。if (dt.Rows.Count != 0 for (int i = 0。 i list.Add(dt.Rows07+i.ToString(。 ArrayList arr = newArrayList(。foreach (TreeNode nodes inthis.treeri
17、ght.Nodes arr.Add(nodes。foreach(TreeNode node in nodes.Nodes arr.Add(node。 for (int i = 0。 i if (listi.ToString( = yes (TreeNodearri.Checked = true。 else (TreeNodearri.Checked = false。 4.权限修改主要代码:publicpartialclassUserRight : Form public UserRight( InitializeComponent(。 privatevoid btncancel_Click(o
18、bject sender, EventArgs eGMsIasNXkA this.Close(。 privatevoid UserRight_Load(object sender, EventArgs eTIrRGchYzg this.checkbox.SelectedIndex = 0。this.partbox.SelectedIndex = 0。 privatevoid Fill( if (this.checkbox.Text = MessageBox.Show(请选择要使用的查询字段!, 提示!。return。 if (this.partbox.Text = MessageBox.Sho
19、w(请选择用户所在的部门!, 提示!。return。 string sql = string.Empty。 sql += select uid as ID号,uacc as 帐号,uname as 姓名,usex as 性别,upart as 部门,utelphone as 移动电话,uphone as 固定电话,udate as 注册日期,uright as 权限 from tb_user。7EqZcWLZNXif (this.checktxt.Text != string c = this.checkbox.SelectedIndex.ToString(。switch (c case0:/
20、用户帐号if (this.checktxt.Text != string.Empty sql += where uacc like % + this.checktxt.Text + %。lzq7IGf02E break。case1:/用户姓名if (this.checktxt.Text != string.Empty sql += where uname like % + this.checktxt.Text + %。zvpgeqJ1hk break。default:break。 if (this.partbox.SelectedIndex.ToString( != 0 sql += and
21、upart= + this.partbox.Text + 。 else if (this.partbox.SelectedIndex.ToString( != 0 sql += where upart= + this.partbox.Text + 。 sql += order by uacc asc。DataTable dt = DBHelp.ExeOleCommand(sql。this.dataGridView1.DataSource = dt。 privatevoid checkbtn_Click(object sender, EventArgs eNrpoJac3v1 Fill(。 pr
22、ivatevoid cell_click(object sender, DataGridViewCellEventArgs e1nowfTG4KI this.txtuacc.Text = this.dataGridView11, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。fjnFLDa5Zothis.txtname.Text = this.dataGridView12, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。tfnNhnE6e5
23、this.txtsex.Text = this.dataGridView13, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。HbmVN777sLthis.txtpart.Text = this.dataGridView14, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。V7l4jRB8Hsthis.txttel.Text = this.dataGridView15, this.dataGridView1.CurrentCell.RowI
24、ndex.Value.ToString(.Trim(。83lcPA59W9this.txtphone.Text = this.dataGridView16, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。mZkklkzaaPthis.txtdate.Text = this.dataGridView17, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。AVktR43bpwthis.txtright.Text = this.dataGridVi
25、ew18, this.dataGridView1.CurrentCell.RowIndex.Value.ToString(.Trim(。ORjBnOwcEdthis.txtright.Enabled = true。 privatevoid btnchange_Click(object sender, EventArgs e2MiJTy0dTT if (this.txtuacc.Text = MessageBox.Show(执行操作前,请先在下表选择要修改的用户!, 提示!。return。 DialogResult res。 res=MessageBox.Show(您确定要修改该用户吗?, 提示
26、!, MessageBoxButtons.YesNo。gIiSpiue7Aif (res = DialogResult.Yes string sql = string.Empty。 sql += update tb_user set uright=+this.txtright.Text+。uEh0U1Yfmh sql += where uacc=+this.txtuacc.Text+。DataTable dt = DBHelp.ExeOleCommand(sql。MessageBox.Show(修改成功!,恭喜!。 Fill(。 5.添加图书信息主要代码:publicpartialclassN
27、ewBook : Form public NewBook( InitializeComponent(。 privatevoid retbtn_Click(object sender, EventArgs eIAg9qLsgBX this.Hide(。 privatevoid savebtn_Click(object sender, EventArgs eWwghWvVhPE if (this.booknotxt.Text = MessageBox.Show(请输入图书的信息!, 提示!。return。 if (this.booknametxt.Text = MessageBox.Show(请输入图书的信息!, 提示!。return。 if (this.classtxt.Text = MessageBox.Show(请输入图书的信息!, 提示!。return。 if (this.isbntxt.Text = MessageBox.Show(请输入图书的信息!, 提示!。return。 if (this.bookcosttxt.Text = Mes
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1