图书管理系统C#源代码.docx
- 文档编号:4837719
- 上传时间:2022-12-10
- 格式:DOCX
- 页数:62
- 大小:24.98KB
图书管理系统C#源代码.docx
《图书管理系统C#源代码.docx》由会员分享,可在线阅读,更多相关《图书管理系统C#源代码.docx(62页珍藏版)》请在冰豆网上搜索。
图书管理系统C#源代码
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;
namespaceWindowsApplication1
{
publicpartialclassForm_BuyAndSale:
Form
{
publicForm_BuyAndSale()
{
InitializeComponent();
}
SQLsql;
stringlastSQL="";
publicvoidshow()
{
listBox1.Items.Clear();
listBox2.Items.Clear();
listBox3.Items.Clear();
if(sql.rows.GetLength(0)!
=0)
{
for(inti=0;i { listBox1.Items.Add(sql.rows[i,0].ToString()); listBox2.Items.Add(sql.rows[i,1].ToString()); listBox3.Items.Add(sql.rows[i,2].ToString()); } } else { listBox1.Text=""; listBox2.Text=""; listBox3.Text=""; MessageBox.Show("无符合查询条件的结果! ","提示"); } } privatevoidForm_BuyAndSale_Load(objectsender,EventArgse) { //将窗体的任务栏隐藏 this.FormBorderStyle=System.Windows.Forms.FormBorderStyle.None; sql=newSQL(Form_load.connectionString); sql.ExecuteSQL("select*fromts_tushuxiaoshou"); show(); lastSQL="select*fromts_tushuxiaoshou"; } privatevoidbutThisQuarter_Click(objectsender,EventArgse) { intmonth=System.DateTime.Now.Month; intspace=(3-month%3)%3; stringmin=System.DateTime.Now.Year.ToString()+STR.add0(Convert.ToString(month+space-2))+"00"; stringmax=System.DateTime.Now.Year.ToString()+STR.add0(Convert.ToString(month+space))+"99"; sql.ExecuteSQL("select*fromts_tushuxiaoshouwheresaledate>'"+min+"'andsaledate<'"+max+"'"); show(); lastSQL="select*fromts_tushuxiaoshouwheresaledate>'"+min+"'andsaledate<'"+max+"'"; } privatevoidbutThisYear_Click(objectsender,EventArgse) { stringmin=System.DateTime.Now.Year.ToString()+"0000"; stringmax=System.DateTime.Now.Year.ToString()+"9999"; sql.ExecuteSQL("select*fromts_tushuxiaoshouwheresaledate>'"+min+"'andsaledate<'"+max+"'"); show(); lastSQL="select*fromts_tushuxiaoshouwheresaledate>'"+min+"'andsaledate<'"+max+"'"; } privatevoidbutAll_Click(objectsender,EventArgse) { sql.ExecuteSQL("select*fromts_tushuxiaoshou"); show(); lastSQL="select*fromts_tushuxiaoshou"; } privatevoidbutSearch_Click(objectsender,EventArgse) { try { int.Parse(Min.Text); int.Parse(Max.Text); } catch { MessageBox.Show("数值格式不正确! "); Min.Text=""; Max.Text=""; return; } if(int.Parse(Min.Text)>int.Parse(Max.Text)) { MessageBox.Show("最小值应小于或等于最大值! ","提示"); Min.Text=""; Max.Text=""; return; } sql.ExecuteSQL("select*fromts_tushuxiaoshouwheresalequantitybetween"+Min.Text+"and"+Max.Text); show(); lastSQL="select*fromts_tushuxiaoshouwheresalequantitybetween"+Min.Text+"and"+Max.Text; } privatevoidbutton1_Click(objectsender,EventArgse) { this.Close(); } } } usingSystem; usingSystem.Collections.Generic; usingSystem.ComponentModel; usingSystem.Data; usingSystem.Drawing; usingSystem.Text; usingSystem.Windows.Forms; namespaceWindowsApplication1 { publicpartialclassForm_Customer: Form { publicForm_Customer() { InitializeComponent(); } SQLsql; stringoldcustomerID=""; publicstaticstringCUSTOMERID=""; publicstaticstringCUSTOMERNAME=""; publicvoidshow() { if(sql.rows.GetLength(0)! =0) { customerID.Text=sql.rows[sql.getPos(),0].ToString(); customername.Text=sql.rows[sql.getPos(),1].ToString(); customerinfo.Text=sql.rows[sql.getPos(),2].ToString(); customeraddress.Text=sql.rows[sql.getPos(),3].ToString(); customertelephone.Text=sql.rows[sql.getPos(),4].ToString(); customersex.Text=sql.rows[sql.getPos(),5].ToString(); customeremail.Text=sql.rows[sql.getPos(),6].ToString(); } else { customerID.Text=""; customername.Text=""; customerinfo.Text=""; customeraddress.Text=""; customertelephone.Text=""; customersex.Text=""; customeremail.Text=""; MessageBox.Show("无符合查询条件的结果! ","提示"); } CUSTOMERID=customerID.Text; CUSTOMERNAME=customername.Text; } privatevoidForm_Customer_Load(objectsender,EventArgse) { //将窗体的任务栏隐藏 this.FormBorderStyle=System.Windows.Forms.FormBorderStyle.None; sql=newSQL(Form_load.connectionString); sql.ExecuteSQL("select*fromts_kehuorderbycustomerID"); show(); } privatevoidAddOrder_Click(objectsender,EventArgse) { if(customerID.Text! ="") { Form_Customer_AddOrderchild=newForm_Customer_AddOrder(); child.ShowDialog(); } else { MessageBox.Show("请先选择一个客户! ","提示"); } } privatevoidbutAlter_Click(objectsender,EventArgse) { if(butAlter.Text=="修改") { butAlter.Text="更新"; oldcustomerID=customerID.Text; customerID.ReadOnly=false; customername.ReadOnly=false; customerinfo.ReadOnly=false; customeraddress.ReadOnly=false; customertelephone.ReadOnly=false; customersex.ReadOnly=false; customeremail.ReadOnly=false; butAdd.Enabled=false; butDelete.Enabled=false; butFirst.Enabled=false; butPrev.Enabled=false; butNext.Enabled=false; butLast.Enabled=false; butSearch.Enabled=false; butLookOverOrders.Enabled=false; butShowAll.Enabled=false; AddOrder.Enabled=false; } else { if(sql.ExecuteSQL("updatets_kehusetcustomerID='"+customerID.Text +"',customername='"+customername.Text +"',customerinfo='"+customerinfo.Text +"',customeraddress='"+customeraddress.Text +"',customertelephone='"+customertelephone.Text +"',customersex='"+customersex.Text +"',customeremail='"+customeremail.Text+"'wherecustomerID='"+oldcustomerID+"'") ==false|| sql.ExecuteSQL("updatets_kehudingdansetcustomerID='"+customerID.Text +"'wherecustomerID='"+oldcustomerID+"'") ==false) { show(); } else { CUSTOMERID=customerID.Text; CUSTOMERNAME=customername.Text; } customerID.ReadOnly=true; customername.ReadOnly=true; customerinfo.ReadOnly=true; customeraddress.ReadOnly=true; customertelephone.ReadOnly=true; customersex.ReadOnly=true; customeremail.ReadOnly=true; butAlter.Text="修改"; butAdd.Enabled=true; butDelete.Enabled=true; butFirst.Enabled=true; butPrev.Enabled=true; butNext.Enabled=true; butLast.Enabled=true; butSearch.Enabled=true; butLookOverOrders.Enabled=true; AddOrder.Enabled=true; butShowAll.Enabled=true; } } privatevoidbutAdd_Click(objectsender,EventArgse) { try { if(butAdd.Text=="添加") { butAdd.Text="提交"; customerID.Text=""; customername.Text=""; customerinfo.Text=""; customeraddress.Text=""; customertelephone.Text=""; customersex.Text=""; customeremail.Text=""; customerID.ReadOnly=false; customername.ReadOnly=false; customerinfo.ReadOnly=false; customeraddress.ReadOnly=false; customertelephone.ReadOnly=false; customersex.ReadOnly=false; customeremail.ReadOnly=false; butAlter.Enabled=false; butDelete.Enabled=false; butFirst.Enabled=false; butPrev.Enabled=false; butNext.Enabled=false; butLast.Enabled=false; butSearch.Enabled=false; butLookOverOrders.Enabled=false; AddOrder.Enabled=false; butShowAll.Enabled=false; } else { if(this.customeraddress.Text=="") { MessageBox.Show("请输入完整信息! "); } elseif(this.customeremail.Text=="") { MessageBox.Show("请输入完整信息! "); } elseif(this.customerID.Text=="") { MessageBox.Show("请输入完整信息"); } elseif(this.customerinfo.Text=="") { MessageBox.Show("请输入完整信息! "); } elseif(this.customername.Text=="") { MessageBox.Show("请输入完整信息! "); } elseif(this.customersex.Text=="") { MessageBox.Show("请输入完整信息! "); } else { if(sql.ExecuteSQL("insertintots_kehuvalues('" +customerID.Text+"','"+customername.Text+"','"+customerinfo.Text+"','" +customeraddress.Text+"','"+customertelephone.Text+"','" +customersex.Text+"','"+customeremail.Text+"')") ==false) { show(); } else { CUSTOMERID=customerID.Text; CUSTOMERNAME=customername.Text; } } customerID.ReadOnly=true; customername.ReadOnly=true; customerinfo.ReadOnly=true; customeraddress.ReadOnly=true; customertelephone.ReadOnly=true; customersex.ReadOnly=true; customeremail.ReadOnly=true; butAdd.Text="添加"; butAlter.Enabled=true; butDelete.Enabled=true; butFirst.Enabled=true; butPrev.Enabled=true; butNext.Enabled=true; butLast.Enabled=true; butSearch.Enabled=true; butLookOverOrders.Enabled=true; AddOrder.Enabled=true; butShowAll.Enabled=true; } } catch(Exceptione1) { MessageBox.Show(e1.Message); } } privatevoidbutDelete_Click(objectsender,EventArgse) { sql.ExecuteSQL("deletefromts_kehuwherecustomerID='"+customerID.Text+"'"); show(); } privatevoidbutShowAll_Click(objectsender,EventArgse) { sql.ExecuteSQL("select*fromts_kehuorderbycustomerID"); show(); } privatevoidbutSearch_Click(objectsender,EventArgse) { if(comboBox1.Text=="客户名称") { if(comboBox2.Text=="精确") { sql.ExecuteSQL("select*fromts_kehuwherecustomername='"+textForSearch.Text+"'orderbycustomerID"); show(); } else { sql.ExecuteSQL("select*fromts_kehuwherecustomernamelike'%"+textForSearch.Text+"%'orderbycustomerID"); show(); } } else { if(comboBox2.Text=="精确") { sql.ExecuteSQL("select*fromts_kehuwherecustomeremail='"+textForSearch.Text+"'orderbycustomerID"); show(); } else { sql.ExecuteSQL("select*fromts_kehuwherecustomeremaillike'%"+textForSearch.Text+"%'orderbycustomerID"); show(); } } } privatevoidbutFirs
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 图书 管理 系统 C# 源代码