圖書管理系統(tǒng)C++源代碼

上傳人:仙*** 文檔編號:28395736 上傳時間:2021-08-27 格式:DOC 頁數(shù):50 大?。?10.50KB
收藏 版權(quán)申訴 舉報 下載
圖書管理系統(tǒng)C++源代碼_第1頁
第1頁 / 共50頁
圖書管理系統(tǒng)C++源代碼_第2頁
第2頁 / 共50頁
圖書管理系統(tǒng)C++源代碼_第3頁
第3頁 / 共50頁

下載文檔到電腦,查找使用更方便

15 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《圖書管理系統(tǒng)C++源代碼》由會員分享,可在線閱讀,更多相關(guān)《圖書管理系統(tǒng)C++源代碼(50頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form_BuyAndSale : Form { public Form_BuyAndSale()

2、 { InitializeComponent(); } SQL sql; string lastSQL = ""; public void show() { listBox1.Items.Clear(); listBox2.Items.Clear(); listBox3.Items.Clear(); if (sql.rows.GetLength(0) != 0

3、) { for (int i = 0; i < sql.rows.GetLength(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

4、()); } } else { listBox1.Text = ""; listBox2.Text = ""; listBox3.Text = ""; MessageBox.Show("無符合查詢條件的結(jié)果!", "提示"); } } private void Form_BuyAndS

5、ale_Load(object sender, EventArgs e) { //將窗體的任務(wù)欄隱藏 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; sql = new SQL(Form_load .connectionString ); sql.ExecuteSQL("select * from ts_tushuxiaoshou"); show();

6、 lastSQL = "select * from ts_tushuxiaoshou "; } private void butThisQuarter_Click(object sender, EventArgs e) { int month = System.DateTime.Now.Month; int space = (3 - month % 3) % 3; string min = System.DateTime.Now.Year.

7、ToString() + STR.add0(Convert.ToString(month + space - 2)) + "00"; string max = System.DateTime.Now.Year.ToString() + STR.add0(Convert.ToString(month + space)) + "99"; sql.ExecuteSQL("select * from ts_tushuxiaoshou where saledate>" + min + " and saledate<" + max + "");

8、 show(); lastSQL = "select * from ts_tushuxiaoshou where saledate>" + min + " and saledate<" + max + ""; } private void butThisYear_Click(object sender, EventArgs e) { string min = System.DateTime.Now.Year.ToString() + "0000";

9、 string max = System.DateTime.Now.Year.ToString() + "9999"; sql.ExecuteSQL("select * from ts_tushuxiaoshou where saledate>" + min + " and saledate<" + max + ""); show(); lastSQL = "select * from ts_tushuxiaoshou where saledate>" + min + " and saledate<" + max

10、 + ""; } private void butAll_Click(object sender, EventArgs e) { sql.ExecuteSQL("select * from ts_tushuxiaoshou"); show(); lastSQL = "select * from ts_tushuxiaoshou "; } private void butSearch_Click(object sender

11、, EventArgs e) { try { int.Parse(Min.Text); int.Parse(Max.Text); } catch { MessageBox.Show("數(shù)值格式不正確!"); Min.Text = ""; Max.Text = "";

12、 return; } if (int.Parse(Min.Text) > int.Parse(Max.Text)) { MessageBox.Show("最小值應(yīng)小于或等于最大值!", "提示"); Min.Text = ""; Max.Text = ""; return; } sql.ExecuteSQL("se

13、lect * from ts_tushuxiaoshou where salequantity between " + Min.Text + " and " + Max.Text); show(); lastSQL = "select * from ts_tushuxiaoshou where salequantity between " + Min.Text + " and " + Max.Text; } private void button1_Click(object sender, EventA

14、rgs e) { this.Close(); } } } using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public pa

15、rtial class Form_Customer : Form { public Form_Customer() { InitializeComponent(); } SQL sql; string oldcustomerID = ""; public static string CUSTOMERID = ""; public static string CUSTOMERNAME = ""; public vo

16、id show() { 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

17、(); 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].

18、ToString(); } else { customerID.Text = ""; customername.Text = ""; customerinfo.Text = ""; customeraddress.Text = ""; customertelephone.Text = ""; customersex.

19、Text = ""; customeremail.Text = ""; MessageBox.Show("無符合查詢條件的結(jié)果!", "提示"); } CUSTOMERID = customerID.Text; CUSTOMERNAME = customername.Text; } private void Form_Customer_Load(object sender, EventArgs e)

20、 { //將窗體的任務(wù)欄隱藏 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; sql = new SQL(Form_load .connectionString ); sql.ExecuteSQL("select * from ts_kehu order by customerID"); show(); } private void AddO

21、rder_Click(object sender, EventArgs e) { if (customerID.Text != "") { Form_Customer_AddOrder child = new Form_Customer_AddOrder(); child.ShowDialog(); } else { MessageBox.Show

22、("請先選擇一個客戶!", "提示"); } } private void butAlter_Click(object sender, EventArgs e) { if (butAlter.Text == "修改") { butAlter.Text = "更新"; oldcustomerID = customerID.Text; customerID.Rea

23、dOnly = false; customername.ReadOnly = false; customerinfo.ReadOnly = false; customeraddress.ReadOnly = false; customertelephone.ReadOnly = false; customersex.ReadOnly = false; customeremail.ReadOnl

24、y = false; butAdd.Enabled = false; butDelete.Enabled = false; butFirst.Enabled = false; butPrev.Enabled = false; butNext.Enabled = false; butLast.Enabled = false; butSearch.Enable

25、d = false; butLookOverOrders.Enabled = false; butShowAll.Enabled = false; AddOrder.Enabled = false; } else { if (sql.ExecuteSQL("update ts_kehu set customerID=" + customerID.Text

26、 + ",customername=" + customername.Text + ",customerinfo=" + customerinfo.Text + ",customeraddress=" + customeraddress.Text + ",customertelephone=" + customertelephone.Text + ",customersex=" + customersex.Text

27、 + ",customeremail=" + customeremail.Text + " where customerID=" + oldcustomerID + "") == false || sql.ExecuteSQL("update ts_kehudingdan set customerID=" + customerID.Text + " where customerID=" + oldcustomerID + "")

28、 == false) { show(); } else { CUSTOMERID = customerID.Text; CUSTOMERNAME = customername.Text; } customerID.ReadOnly

29、 = true; customername.ReadOnly = true; customerinfo.ReadOnly = true; customeraddress.ReadOnly = true; customertelephone.ReadOnly = true; customersex.ReadOnly = true; customeremail.ReadOnly = true;

30、 butAlter.Text = "修改"; butAdd.Enabled = true; butDelete.Enabled = true; butFirst.Enabled = true; butPrev.Enabled = true; butNext.Enabled = true; butLast.Enabled = true;

31、 butSearch.Enabled = true; butLookOverOrders.Enabled = true; AddOrder.Enabled = true; butShowAll.Enabled = true; } } private void butAdd_Click(object sender, EventArgs e) { try

32、{ if (butAdd.Text == "添加") { butAdd.Text = "提交"; customerID.Text = ""; customername.Text = ""; customerinfo.Text = ""; customeraddress.Text = "";

33、 customertelephone.Text = ""; customersex.Text = ""; customeremail.Text = ""; customerID.ReadOnly = false; customername.ReadOnly = false; customerinfo.ReadOnly = false;

34、customeraddress.ReadOnly = false; customertelephone.ReadOnly = false; customersex.ReadOnly = false; customeremail.ReadOnly = false; butAlter.Enabled = false; butDelete.Enabled = false;

35、 butFirst.Enabled = false; butPrev.Enabled = false; butNext.Enabled = false; butLast.Enabled = false; butSearch.Enabled = false; butLookOverOrders.Enabled = false;

36、 AddOrder.Enabled = false; butShowAll.Enabled = false; } else { if (this.customeraddress.Text == "") { MessageBox.Show("請輸入完整信息!"); }

37、 else if (this.customeremail.Text == "") { MessageBox.Show("請輸入完整信息!"); } else if (this.customerID.Text == "") { MessageBox.Show("請輸入完整信息");

38、 } else if (this.customerinfo.Text == "") { MessageBox.Show("請輸入完整信息!"); } else if (this.customername.Text == "") { MessageBox.Show("請輸

39、入完整信息!"); } else if (this.customersex.Text == "") { MessageBox.Show("請輸入完整信息!"); } else { if (sql.ExecuteSQL("insert into ts

40、_kehu values(" + customerID.Text + "," + customername.Text + "," + customerinfo.Text + "," + customeraddress.Text + "," + customertelephone.Text + "," + customersex.Text + "," + customeremail.Text + ")")

41、 == false) { show(); } else { CUSTOMERID = customerID.Text; CUSTOMERNAME = customername.Text;

42、 } } customerID.ReadOnly = true; customername.ReadOnly = true; customerinfo.ReadOnly = true; customeraddress.ReadOnly = true; customertelephone.ReadOn

43、ly = true; customersex.ReadOnly = true; customeremail.ReadOnly = true; butAdd.Text = "添加"; butAlter.Enabled = true; butDelete.Enabled = true; butFirst.Enabled = true;

44、 butPrev.Enabled = true; butNext.Enabled = true; butLast.Enabled = true; butSearch.Enabled = true; butLookOverOrders.Enabled = true; AddOrder.Enabled = true; b

45、utShowAll.Enabled = true; } } catch (Exception e1) { MessageBox.Show(e1.Message); } } private void butDelete_Click(object sender, EventArgs e) { sql.ExecuteSQL("delete from

46、 ts_kehu where customerID=" + customerID.Text + ""); show(); } private void butShowAll_Click(object sender, EventArgs e) { sql.ExecuteSQL("select * from ts_kehu order by customerID"); show(); } private void butSe

47、arch_Click(object sender, EventArgs e) { if (comboBox1.Text == "客戶名稱") { if (comboBox2.Text == "精確") { sql.ExecuteSQL("select * from ts_kehu where customername=" + textForSearch.Text + " order by customerID");

48、 show(); } else { sql.ExecuteSQL("select * from ts_kehu where customername like %" + textForSearch.Text + "% order by customerID"); show(); } }

49、else { if (comboBox2.Text == "精確") { sql.ExecuteSQL("select * from ts_kehu where customeremail=" + textForSearch.Text + " order by customerID"); show(); } else

50、{ sql.ExecuteSQL("select * from ts_kehu where customeremail like %" + textForSearch.Text + "% order by customerID"); show(); } } } private void butFirst_Click(object sender, EventArgs e) {

51、 sql.pointToFirst(); show(); } private void butPrev_Click(object sender, EventArgs e) { sql.pointToPrev(); show(); } private void butNext_Click(object sender, EventArgs e) { sql.pointToNex

52、t(); show(); } private void butLast_Click(object sender, EventArgs e) { sql.pointToLast(); show(); } private void butLookOverOrders_Click(object sender, EventArgs e) { Form_Customer_LookOver

53、Orders child = new Form_Customer_LookOverOrders(); child.ShowDialog(); } private void button1_Click(object sender, EventArgs e) { this.Close(); } } } using System; using System.Collections.Gen

54、eric; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form_Customer : Form { public Form_Customer() { InitializeComponent();

55、 } SQL sql; string oldcustomerID = ""; public static string CUSTOMERID = ""; public static string CUSTOMERNAME = ""; public void show() { if (sql.rows.GetLength(0) != 0) { customerID.Text = sql.ro

56、ws[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

57、= 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 = ""; custom

58、ername.Text = ""; customerinfo.Text = ""; customeraddress.Text = ""; customertelephone.Text = ""; customersex.Text = ""; customeremail.Text = ""; MessageBox.Show("無符合查詢條件的結(jié)果!", "提示"); }

59、 CUSTOMERID = customerID.Text; CUSTOMERNAME = customername.Text; } private void Form_Customer_Load(object sender, EventArgs e) { //將窗體的任務(wù)欄隱藏 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; s

60、ql = new SQL(Form_load .connectionString ); sql.ExecuteSQL("select * from ts_kehu order by customerID"); show(); } private void AddOrder_Click(object sender, EventArgs e) { if (customerID.Text != "") {

61、Form_Customer_AddOrder child = new Form_Customer_AddOrder(); child.ShowDialog(); } else { MessageBox.Show("請先選擇一個客戶!", "提示"); } } private void butAlter_Click(object sender, EventArgs e)

62、 { if (butAlter.Text == "修改") { butAlter.Text = "更新"; oldcustomerID = customerID.Text; customerID.ReadOnly = false; customername.ReadOnly = false; customerinfo.ReadOnly = false;

63、 customeraddress.ReadOnly = false; customertelephone.ReadOnly = false; customersex.ReadOnly = false; customeremail.ReadOnly = false; butAdd.Enabled = false; butDelete.Enabled = false; butFirs

64、t.Enabled = false; butPrev.Enabled = false; butNext.Enabled = false; butLast.Enabled = false; butSearch.Enabled = false; butLookOverOrders.Enabled = false; butShowAll.Enabled = false;

65、 AddOrder.Enabled = false; } else { if (sql.ExecuteSQL("update ts_kehu set customerID=" + customerID.Text + ",customername=" + customername.Text + ",customerinfo=" + customerinfo.Text

66、 + ",customeraddress=" + customeraddress.Text + ",customertelephone=" + customertelephone.Text + ",customersex=" + customersex.Text + ",customeremail=" + customeremail.Text + " where customerID=" + oldcustomerID + "") == false || sql.ExecuteSQL("update ts_kehudingdan set customerID=" + customerID.Text

展開閱讀全文
溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!