c#图书系统源代码.docx

上传人:b****1 文档编号:29144807 上传时间:2023-07-20 格式:DOCX 页数:22 大小:273.24KB
下载 相关 举报
c#图书系统源代码.docx_第1页
第1页 / 共22页
c#图书系统源代码.docx_第2页
第2页 / 共22页
c#图书系统源代码.docx_第3页
第3页 / 共22页
c#图书系统源代码.docx_第4页
第4页 / 共22页
c#图书系统源代码.docx_第5页
第5页 / 共22页
点击查看更多>>
下载资源
资源描述

c#图书系统源代码.docx

《c#图书系统源代码.docx》由会员分享,可在线阅读,更多相关《c#图书系统源代码.docx(22页珍藏版)》请在冰豆网上搜索。

c#图书系统源代码.docx

c#图书系统源代码

c#图书系统源代码

部门:

xxx

时间:

xxx

制作人:

xxx

 

整理范文,仅供参考,可下载自行修改

1.登陆界面

主要代码:

publicpartialclassLoginForm:

Form{

publicstaticstringuacc。

publicstaticstringupsw。

publicstaticstringuname。

publicstaticstringusex。

publicstaticstringupart。

publicstaticstringuright。

publicLoginForm(>

{

InitializeComponent(>。

}

privatevoidloginbtn_Click(objectsender,EventArgse>b5E2RGbCAP

{

if(this.useracctxt.Text.Trim(>==""&&this.pswtxt.Text=="">p1EanqFDPw

{

MessageBox.Show("请输入您的用户名和密码!

","提示!

">。

return。

}

try

{

stringsql。

sql="select*fromtb_userwhereuacc='"+this.useracctxt.Text+"'andupsw='"+this.pswtxt.Text+"'"。

DXDiTa9E3d

OleDbDataReaderdr=DBHelp.OleReader(sql>。

dr.Read(>。

if(dr.HasRows>

{

uacc=this.useracctxt.Text。

upsw=this.pswtxt.Text。

uname=dr["uname"].ToString(>。

usex=dr["usex"].ToString(>。

upart=dr["upart"].ToString(>。

uright=dr["uright"].ToString(>。

MainFormaf=newMainForm(this>。

this.Hide(>。

this.useracctxt.Clear(>。

this.pswtxt.Clear(>。

af.Show(>。

}

else

{

MessageBox.Show("账号或密码错误!

","提示!

">。

this.useracctxt.Clear(>。

this.pswtxt.Clear(>。

this.useracctxt.Focus(>。

}

}

catch(Exception>

{

MessageBox.Show("数据库无法连接!

","警告!

">。

}

}

privatevoidcancelbtn_Click(objectsender,EventArgse>RTCrpUDGiT

{

Application.Exit(>。

}

privatevoidLoginForm_Closing(objectsender,FormClosingEventArgse>5PCzVD7HxA

{

Application.Exit(>。

}

}

2.主界面<图较小,自己可以拉大点)

主要代码就不写了,很简单。

3.权限设置

主要代码:

publicpartialclassRightSet:

Form

{

publicRightSet(>

{

InitializeComponent(>。

}

privatevoidRightSet_Load(objectsender,EventArgse>jLBHrnAILg

{

this.rightbox.SelectedIndex=0。

//this.treeright.ExpandAll(>。

Fill(>。

}

privatevoidokbtn_Click(objectsender,EventArgse>xHAQX74J0X

{

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("请输入超期罚款金额!

","提示!

">。

return。

}

if(this.txttim.Text==string.Empty>

{

MessageBox.Show("请输入图书遗失罚款倍数!

","提示!

">。

return。

}

ArrayListarr=newArrayList(>。

foreach(TreeNodenodesinthis.treeright.Nodes>

{

if(nodes.Checked>

{

arr.Add("1">。

}

else

{

arr.Add("0">。

}

foreach(TreeNodenodeinnodes.Nodes>

{

if(node.Checked>

{

arr.Add("1">。

}

else

{

arr.Add("0">。

}

}

}

string[]a=newstring[11]。

for(inti=0。

i

i++>

{

if(arr[i].ToString(>.Trim(>=="1">

{

a[i]="yes"。

}

else

{

a[i]="no"。

}

}

stringsql=string.Empty。

sql+="select*fromtb_rightwhereuright='"+this.rightbox.Text+"'"。

LDAYtRyKfE

DataTabledt=DBHelp.ExeOleCommand(sql>。

boolb=false。

while(dt.Rows.Count!

=0>

{

b=true。

break。

}

stringsql1。

if(b>

{

sql1="updatetb_rightset"。

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='"+a[0]+"',"。

sql1+="rum='"+a[1]+"',"。

sql1+="rrm='"+a[2]+"',"。

sql1+="rborm='"+a[3]+"',"。

sql1+="ris='"+a[4]+"',"。

sql1+="rbis='"+a[5]+"',"。

sql1+="ruis='"+a[6]+"',"。

sql1+="rboris='"+a[7]+"',"。

sql1+="rblp='"+a[8]+"',"。

sql1+="rbl='"+a[9]+"',"。

sql1+="rlp='"+a[10]+"'"。

sql1+="whereuright='"+this.rightbox.Text+"'"。

Zzz6ZB2Ltk

}

else

{

sql1="insertintotb_right(uright,maxbook,maxdate,rcost,rfine,rtim,rbm,rum,rrm,rborm,ris,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+"','"+a[0]+"','"+a[1]+"','"+a[2]+"','"+a[3]+"','"+a[4]+"','"+a[5]+"','"+a[6]+"','"+a[7]+"','"+a[8]+"','"+a[9]+"','"+a[10]+"'>"。

rqyn14ZNXI

}

DataTabledt1=DBHelp.ExeOleCommand(sql1>。

Fill(>。

}

privatevoidFill(>

{

stringsql。

sql="selectridasID号,urightas用户身份,maxbookas最大借书数量,maxdateas最大借阅时间,rcostas押金,rfineas超期罚率,rtimas遗失赔率,rbmas图书管理,rumas用户管理,rrmas权限管理,rbormas借阅管理,risas信息查询,rbisas图书信息查询,ruisas用户信息查询,rborisas借阅历史查询,rblpas图书挂失处理,rblas图书挂失,rlpas挂失处理fromtb_right"。

EmxvxOtOco

DataTabledt=DBHelp.ExeOleCommand(sql>。

this.dataGridView1.DataSource=dt。

}

privatevoidcell_click(objectsender,DataGridViewCellEventArgse>SixE2yXPq5

{

this.rightbox.Text=this.dataGridView1[1,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

6ewMyirQFL

this.txtnum.Text=this.dataGridView1[2,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

kavU42VRUs

this.txtday.Text=this.dataGridView1[3,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

y6v3ALoS89

this.txtcost.Text=this.dataGridView1[4,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

M2ub6vSTnP

this.txtfine.Text=this.dataGridView1[5,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

0YujCfmUCw

this.txttim.Text=this.dataGridView1[6,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

eUts8ZQVRd

ArrayListlist=newArrayList(>。

stringsql="select*fromtb_rightwhereuright='"+this.rightbox.Text+"'"。

sQsAEJkW5T

DataTabledt=DBHelp.ExeOleCommand(sql>。

if(dt.Rows.Count!

=0>

{

for(inti=0。

i<11。

i++>

{

list.Add(dt.Rows[0][7+i].ToString(>>。

}

ArrayListarr=newArrayList(>。

foreach(TreeNodenodesinthis.treeright.Nodes>

{

arr.Add(nodes>。

foreach(TreeNodenodeinnodes.Nodes>

{

arr.Add(node>。

}

}

for(inti=0。

i

i++>

{

if(list[i].ToString(>=="yes">

{

((TreeNode>arr[i]>.Checked=true。

}

else

{

((TreeNode>arr[i]>.Checked=false。

}

}

}

}

4.权限修改

主要代码:

publicpartialclassUserRight:

Form

{

publicUserRight(>

{

InitializeComponent(>。

}

privatevoidbtncancel_Click(objectsender,EventArgse>GMsIasNXkA

{

this.Close(>。

}

privatevoidUserRight_Load(objectsender,EventArgse>TIrRGchYzg

{

this.checkbox.SelectedIndex=0。

this.partbox.SelectedIndex=0。

}

privatevoidFill(>

{

if(this.checkbox.Text=="">

{

MessageBox.Show("请选择要使用的查询字段!

","提示!

">。

return。

}

if(this.partbox.Text=="">

{

MessageBox.Show("请选择用户所在的部门!

","提示!

">。

return。

}

stringsql=string.Empty。

sql+="selectuidasID号,uaccas帐号,unameas姓名,usexas性别,upartas部门,utelphoneas移动电话,uphoneas固定电话,udateas注册日期,urightas权限fromtb_user"。

7EqZcWLZNX

if(this.checktxt.Text!

="">

{

stringc=this.checkbox.SelectedIndex.ToString(>。

switch(c>

{

case"0":

//用户帐号

if(this.checktxt.Text!

=string.Empty>

{

sql+="whereuacclike'%"+this.checktxt.Text+"%'"。

lzq7IGf02E

}

break。

case"1":

//用户姓名

if(this.checktxt.Text!

=string.Empty>

{

sql+="whereunamelike'%"+this.checktxt.Text+"%'"。

zvpgeqJ1hk

}

break。

default:

break。

}

if(this.partbox.SelectedIndex.ToString(>!

="0">

{

sql+="andupart='"+this.partbox.Text+"'"。

}

}

else

{

if(this.partbox.SelectedIndex.ToString(>!

="0">

{

sql+="whereupart='"+this.partbox.Text+"'"。

}

}

sql+="orderbyuaccasc"。

DataTabledt=DBHelp.ExeOleCommand(sql>。

this.dataGridView1.DataSource=dt。

}

privatevoidcheckbtn_Click(objectsender,EventArgse>NrpoJac3v1

{

Fill(>。

}

privatevoidcell_click(objectsender,DataGridViewCellEventArgse>1nowfTG4KI

{

this.txtuacc.Text=this.dataGridView1[1,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

fjnFLDa5Zo

this.txtname.Text=this.dataGridView1[2,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

tfnNhnE6e5

this.txtsex.Text=this.dataGridView1[3,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

HbmVN777sL

this.txtpart.Text=this.dataGridView1[4,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

V7l4jRB8Hs

this.txttel.Text=this.dataGridView1[5,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

83lcPA59W9

this.txtphone.Text=this.dataGridView1[6,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

mZkklkzaaP

this.txtdate.Text=this.dataGridView1[7,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

AVktR43bpw

this.txtright.Text=this.dataGridView1[8,this.dataGridView1.CurrentCell.RowIndex].Value.ToString(>.Trim(>。

ORjBnOwcEd

this.txtright.Enabled=true。

}

privatevoidbtnchange_Click(objectsender,EventArgse>2MiJTy0dTT

{

if(this.txtuacc.Text=="">

{

MessageBox.Show("执行操作前,请先在下表选择要修改的用户!

","提示!

">。

return。

}

DialogResultres。

res=MessageBox.Show("您确定要修改该用户吗?

","提示!

",MessageBoxButtons.YesNo>。

gIiSpiue7A

if(res==DialogResult.Yes>

{

stringsql=string.Empty。

sql+="updatetb_userseturight='"+this.txtright.Text+"'"。

uEh0U1Yfmh

sql+="whereuacc='"+this.txtuacc.Text+"'"。

DataTabledt=DBHelp.ExeOleCommand(sql>。

MessageBox.Show("修改成功!

","恭喜!

">。

Fill(>。

}

}

}

5.添加图书信息

主要代码:

publicpartialclassNewBook:

Form

{

publicNewBook(>

{

InitializeComponent(>。

}

privatevoidretbtn_Click(objectsender,EventArgse>IAg9qLsgBX

{

this.Hide(>。

}

privatevoidsavebtn_Click(objectsender,EventArgse>WwghWvVhPE

{

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