图书管理系统C#源代码.docx

上传人:b****3 文档编号:4837719 上传时间:2022-12-10 格式:DOCX 页数:62 大小:24.98KB
下载 相关 举报
图书管理系统C#源代码.docx_第1页
第1页 / 共62页
图书管理系统C#源代码.docx_第2页
第2页 / 共62页
图书管理系统C#源代码.docx_第3页
第3页 / 共62页
图书管理系统C#源代码.docx_第4页
第4页 / 共62页
图书管理系统C#源代码.docx_第5页
第5页 / 共62页
点击查看更多>>
下载资源
资源描述

图书管理系统C#源代码.docx

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

图书管理系统C#源代码.docx

图书管理系统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

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 法律文书 > 调解书

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1