c#图书管理系统源代码.docx
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《c#图书管理系统源代码.docx》由会员分享,可在线阅读,更多相关《c#图书管理系统源代码.docx(103页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、主要代码:pub 1ic partialclass :nl-orm : l-onn publicstaticstring uacc;publicstaticstring upsw;publicstaticstring uname;publicstaticstring usex;publicstaticstring upart;publi cstaticstring uright;public LoginFormOInitializeComponent();1.登陆界面private void loginbtn Click (object sender, EvcntArgs e)if (this
2、, useracctxt. Text. TrimO & this, pswtxt. Text =return;try(string sql;sql = select * from tb user where uacc=, + this, useracctxt. Text + and upsw=,+ this, pswtxt. Text +;OleDbDatdReader dr = DBIIelp. OleReader(sql);dr. Read 0 ;if (dr. HasRows)(uacc = this.useracctxt. Text;upsw = this.pswtxt. Text;u
3、name = druname. ToStringO ;usex = drusex. ToStringO ;upart = drupart. ToStringO ;uright = dr*uright*. ToStringO ;MainForm af = new MainForm(this);this. Hide();this, useracctxt. Clear 0;this, pswtxt. Clear();af. Show ();)else(MessageBox.Show (“账号或密码错误!提示!);this. useracctxt. Clear ();this, pswtxt. Cle
4、ar ();this, useracctxt. Focus 0;)catch (Except ion)(VessageBox. Show (数据库无法连接!,警告!”);)private void cancelbtn_Click(object sender, EventArgs e)(Application. Exit();private void LoginForm_Closing(object sender, l;orm(JosingEventArgs e)Appli ceil ion. Exit ();)2 .主界面(图较小,自己可以拉大点)主要代码就不写了,很简单。3 .权限设置主要代
5、码:public partial class RightSet : Formpublic RightSet0(InitializeComponent();)e)private void RightSet_Load(object sender,(this, rightbox. Selectedlndex = 0;/this, treeright. ExpandAl 1 ();FillO;private void okbtn_Click(object sender, EventArgs e)if (this, txtnum. Text = string. Empty)MessageBox.Show
6、(请输入最大借阅图书数量!”,提示!”); 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)McssageBox.Show(请输入超期罚款金额!,”提示!); return;if (this, txttim. Textstr
7、ing. Empty)MessageBox.Show(请输入图书遗失罚款倍数!,”提示!;return;I i st arr = new0 ;foreach (TreeXode nodes in this.treeright. Nodes)if (nodes. Checked)arr. Add(l);elsearr. Add(0);foreach(TreeNode node in nodes. Nodes)i f (node. Checked)arr. Add (1);elsearr. Add (0”);string a=new stringl1;for (int i = 0; i arr.
8、Count; i+)if (arri. ToStringO. TrimO = T)ai = yes”;elseai = nostring sql = string. Empty:sql += select * from tb_right where urighl=+ this, rightbox. Text +DataTable dt = DBHeIp. ExeOleCommand(sql): bool b = false;while (dt. Rows. Count != 0)b = true;break;string sqll;if (b)sql1 = update tb_right se
9、t ;sql1+=maxbook=+ thi s. txtnum.Text +sql1+=maxdate=+ this, txtday. Text +sql 1+=rcost=+this, txtcost. Text +sql 1+=*rfine=,*+this, txtfine. Text +sqll += *rtim=+ this, txttim. Text +sqll += rbm=+ a0 + sqll += rum= + al +sqll += rrm=, + a2 +sqll += rborm= + a3sqll += ris=+ a4 +sqll += rbis=,* + a5
10、+ *,;sqll += ruis=, + a6 + ,:sqll += *rboris=* * + a7 +sqll += rblp= + a8sqll += rbl= + a 9 +sqll += rip=+ a10 +;sqll +二where uright= + this.rightbox. Text +;)else(sql! 二 insert intotb_right (uright, raaxbook, maxdate, rcost, rfine, rtim, rbm, rum, rrm, rborm, ris, rbis, ruis, rboris, rblp ,rbl,rlp)
11、;sqll + 二values( + this, rightbox. Text +,+ this, txtnum. Text +,+this, txtday. Text + *, * + this, txtcost. Text + *, + this, txtfine. Text + +this, txttim. Text +a0+ al+ a2a3 + + a4 + a5+ a6+ a7+ a8a9+ a10 + )DataTable dtl = DBHelp. ExeOleCommand(sqll);FillO;private void Fill ()string sql;sql = se
12、lect rid as ID 号,uright as 用户身份,max book as 最大借书数鼠,maxdate as 最大借阅时间,rcost as押金,rfineas超期罚率,rtim as遗失赔率,rbm as图书管理,rum as用户管理,门m as权限管理,rborm as借阅管理,ris as信息查询,rbis as图书信息查询,ruis as用户信息查询,rborisas借阅历史査询,rblp as图书挂失处理,rbl as图书挂失,rip as挂失处理from tb_right*;DataTable dt = DBHe1p. ExeOleCommand(sql);this.
13、 dataGridViewl. DataSource = dt;private void cell_click(object sender, DataGridViewCe11EventArgs e)this, rightbox. Text = this. dataGridViewl 1, this. dataGridViewl. CurrentCel 1. Rowindex. Value. ToStringO. TrimO ;this, txtnum. Text = this. dataGridViewl2,this. dataGridViewl. CurrentCel 1. Rowindex
14、. Value. ToStringO. TrimO ;this, txtday.Text = this. dataGridViewl3,this. dataGridViewl. CurrentCel 1. Rowindex. Value. ToStringO. TrimO ;this, txtcost. Text = this. dataGridViewl4,this. dataGridViewl. CurrentCel 1. Rowindex. Value. ToStringO. TrimO ;this, txtfine. Text = this. dataGridViewl5,this.
15、dataGridViewl. CurrentCel 1. Rowindex. Value. ToStringO. TrimO ;this, txttim. Text = this. dataGridViewl6,this. dataGridViewl. CurrentCel 1. Rowindex. Value. ToStringO. TrimO ;ArrayList list = new ArrayList();string sql = select * from tb_right where uright二 + this, rightbox. Text +DataTable dt = DB
16、Help. ExeOleConunand(sql);if (dt. Rows. Count != 0)for (int i = 0; i 11; i+)1 ist. Add(dt. Rows0 7+i. ToStringO);ArrayList arr = new ArrayLi st ();foreach (TreeNode nodes in this, treeright. Nodes)arr.Add(nodes);foreach(TreeNode node in nodes. Nodes)arr. Add (node);for (int i = 0; i list. Count; i+)
17、if (listi. ToStringO = yes)(T)(?eNode)arri). Checked = true;else(TreeNode)arri). Checked = false;4 .权限修改主要代码:public partial class UserRight : Form(public UserRight0(InitializeComponent();private void btncancel_Click(object sender, EventArgs e)(this. CloseO;)private void UserRight Load(object sender,
18、 EventArgs e)(thi s.checkbox. Seiectedlndex = 0;this, partbox. Selectedlndex = 0;private void Fill ()if (this, checkbox. Text =VcssageBox. Show(请选择要使用的査询字段!”,提示!”); return;if (this, part box. Text =)MessageBox.Show(请选择用户所在的部门!,提示!”); return;string sql = string. Empty;sql += sei ect ui d as 11) uacc
19、as 帐号,unamc as 姓名,usex as 性别,upart as 部f J, uteIphone as 移动电话,uphone as 固定电话,udate as 注册 II 期,uright as 权限 from tb user;if (this, checktxt. Text !=)string c = this, checkbox. Selectedlndex. ToStringO ;switch (c)(case ”:用户帐号if (this, checktxt. Text != string. Empty)(sql += where uacc 1 ike * % + this
20、, checktxt. Text + %;)break;case 1:用户姓名if (this, checktxt. Text != string. Empty)(sql += where uname like * % + this.checktxt. Text + %* *)break;default:break;if (this, partbox. Selectedlndex. ToStringO != 0)sql += and upart=+ this, partbox. Text + )else(if (this, partbox. Selected Index. ToStringO
21、!= 0)(sql += where upart=+ thi s. partbox. Text +)sql += order by uacc asc;DataTable dt = DBHelp. ExeOleCommand(sql);this. dataGridViewl. DataSource = dt;pri vate voi d checkbtn_Click (object sender, Invent Args e)FillO;private void cel l_c lick (object sender, Da t tiGi, i dV i ewCe 11 E ent A s e)
22、this, txtuacc. Text = this. dataGridViewll, this. dataGridViewl. CurrentCel 1. Rowindex. Value. ToString(). TrimO ;this, txtname. Text = this. dataGridViewl2,this. dataGridViewl. CurrentCel 1. Rowindex. Value. ToString(). TrimO ;this, txtsex. Text = this. dataGridViewl 3,this. dataGridViewl. Current
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- c# 图书 管理 系统 源代码
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内