版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
121/121基于c#窗體的航空訂票治理系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)系統(tǒng)分工治理資料查詢航線航空訂票治理系統(tǒng)治理員用戶修改公告修改航班治理資料查詢航線航空訂票治理系統(tǒng)治理員用戶修改公告修改航班治理用戶查看信息訂票治理退票治理需求分析進(jìn)入21世紀(jì),人們計(jì)算機(jī)處理情況的需求有了進(jìn)一步的要求。小到商店繳費(fèi)治理系統(tǒng)的快速運(yùn)行,大到國(guó)家航空航天計(jì)算機(jī)的治理系統(tǒng)的進(jìn)一步提升。我們每時(shí)每刻都在追求著計(jì)算機(jī)處理情況的快速,穩(wěn)定,運(yùn)算量大等一系列優(yōu)點(diǎn)。由于人們?yōu)榱朔奖憧旖莸纳罘绞剑暇W(wǎng)差不多成為潮流,如此快速穩(wěn)定的航空訂票系統(tǒng)應(yīng)運(yùn)而生。航空訂票系統(tǒng)需要滿足一般的查詢航線,訂票,退票等一系列差不多操作,因此我們也能夠設(shè)置黑名單,以屏蔽違規(guī)用戶。因此人人都追求美感,那么系統(tǒng)界面的設(shè)計(jì)也要符合大眾的審美要求。資料的安全與隱私性也是至關(guān)重要的,我們每個(gè)人,都不想不人明白自己的一些隱私,對(duì)自己資金的安全也格外重視。因此訂票系統(tǒng)對(duì)不同的角色給予不同的權(quán)限從而保證用戶資料的安全性與隱私性。系統(tǒng)功能(1)游客功能對(duì)游客我們系統(tǒng)只為其提供查詢航班信息的功能,不可進(jìn)行訂票操作。當(dāng)游客點(diǎn)擊購(gòu)票按鈕時(shí),將提醒其注冊(cè)或登錄。(2)用戶注冊(cè)用戶只有注冊(cè)成為我們的會(huì)員,才能夠進(jìn)行訂票操作。一旦注冊(cè),用戶名將不可修改。注冊(cè)時(shí)不可與數(shù)據(jù)庫(kù)中存在的用戶名相同,即系統(tǒng)中只能存在唯一一個(gè)用戶名。(3)用戶中心提供用戶對(duì)自己的資料的查看與修改的功能。還能夠?qū)ψ约旱拿艽a進(jìn)行修改,在修改密碼時(shí)需要輸入原始密碼進(jìn)而進(jìn)行驗(yàn)證。由于時(shí)刻問(wèn)題,對(duì)個(gè)人鈔票包功能先暫停使用,默認(rèn)鈔票夠買票了。(4)訂票功能用戶可依照航班時(shí)刻,和航班號(hào)或航班價(jià)格進(jìn)行訂票。訂票時(shí)系統(tǒng)會(huì)提醒確認(rèn),訂票成功后系統(tǒng)會(huì)將用戶的信息加入訂票信息表。并改變航班的余票額。(5)退票功能用戶在不需要票的情況下進(jìn)行退票操作。退票時(shí)必須輸入訂票時(shí)隨機(jī)生成的訂單號(hào),與航班號(hào)。退票成功后,航班自動(dòng)將余票量加一操作。(6)本系統(tǒng)還添加了治理員界面。當(dāng)治理員進(jìn)入后,可對(duì)用戶的信息進(jìn)行查看,但不能修改,也可將用戶加入黑名單,假如用戶有訂單,則不同意治理員做加入黑名單操作。因此加入黑名單時(shí),治理員需要講明理由,作為存檔。治理員,也可依照實(shí)際情況對(duì)航班進(jìn)行治理操作。增刪改查。他也能夠?qū)孢M(jìn)行修改操作。(7)系統(tǒng)也實(shí)現(xiàn)了,關(guān)于不同的角色進(jìn)入,會(huì)產(chǎn)生不同的界面效果。保證了數(shù)據(jù)的安全性,和保密性。數(shù)據(jù)庫(kù)設(shè)計(jì)(1)治理員表(2)航班表(3)黑名單表(4)訂單信息表(5)用戶信息表運(yùn)行截圖源代碼usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Windows.Forms;namespace航空訂票治理系統(tǒng){staticclassProgram{///<summary>///應(yīng)用程序的主入口點(diǎn)。///</summary>[STAThread]staticvoidMain(){stringdataDir=AppDomain.CurrentDomain.BaseDirectory;if(dataDir.EndsWith(@"\bin\Debug\")||dataDir.EndsWith(@"\bin\Release\")){dataDir=System.IO.Directory.GetParent(dataDir).Parent.Parent.FullName;AppDomain.CurrentDomain.SetData("DataDirectory",dataDir);}Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(newForm1());}}}usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace航空訂票治理系統(tǒng){publicpartialclassForm1:Form{zhucezc=newzhuce();Userlaunchlch=newUserlaunch();publicstringstatus1{get;set;}intlabel1x;publicForm1(){InitializeComponent();}privatevoidForm1_Load(objectsender,EventArgse){label1x=label1.Right;timer1.Enabled=true;timer2.Enabled=true;timer3.Enabled=true;timer2.Start();novisible2();novisible1();textBox1.Focus();timer1.Start();}//隱藏治理員可做的操作publicvoidnovisible1(){客戶信息ToolStripMenuItem.Visible=false;航班信息ToolStripMenuItem.Visible=false;修改公告ToolStripMenuItem.Visible=false;}//隱藏用戶可做的操作publicvoidnovisible2(){用戶補(bǔ)全資料ToolStripMenuItem.Visible=false;//個(gè)人中心用戶充值ToolStripMenuItem.Visible=false;//辦理業(yè)務(wù)}//隱藏登陸前界面publicvoidnovisible3(){用戶登錄ToolStripMenuItem.Visible=false;掃瞄信息ToolStripMenuItem.Visible=false;治理員登陸ToolStripMenuItem.Visible=false;}//操縱公告字段privatevoidtimer1_Tick(objectsender,EventArgse){label1.Location=newPoint(label1.Location.X-1,label1.Location.Y);if(label1.Right==0){label1.Left=label1x;}}//當(dāng)點(diǎn)到按鈕時(shí),進(jìn)行圖片變換privatevoidbutton1_MouseEnter(objectsender,EventArgse){Buttonbttn;timer2.Enabled=false;bttn=(Button)sender;if(bttn==button1)picture1();elseif(bttn==button2)picture2();elseif(bttn==button3)picture3();elseif(bttn==button4)picture4();elseif(bttn==button5)picture5();}privatevoidradioButton1_CheckedChanged(objectsender,EventArgse){textBox5.Enabled=false;textBox1.Enabled=true;textBox2.Enabled=true;textBox5.Text="";textBox1.Focus();}privatevoidradioButton2_CheckedChanged(objectsender,EventArgse){textBox5.Enabled=true;textBox1.Text="";textBox2.Text="";textBox1.Enabled=false;textBox2.Enabled=false;}privatevoidradioButton4_CheckedChanged(objectsender,EventArgse){textBox6.Enabled=false;textBox3.Enabled=true;textBox4.Enabled=true;textBox6.Text="";textBox4.Focus();}privatevoidradioButton3_CheckedChanged(objectsender,EventArgse){textBox6.Enabled=true;textBox4.Text="";textBox3.Text="";textBox3.Enabled=false;textBox4.Enabled=false;textBox6.Focus();}//安全退出privatevoid用戶退出ToolStripMenuItem_Click(objectsender,EventArgse){if(toolStripStatusLabel4.Text=="未登錄"){MessageBox.Show("當(dāng)前你未登錄,請(qǐng)登錄或注冊(cè)");}else{MessageBox.Show(toolStripStatusLabel4.Text+"您已下線,感謝使用!");toolStripStatusLabel4.Text="未登錄";status1="";novisible2();novisible1();用戶登錄ToolStripMenuItem.Visible=true;掃瞄信息ToolStripMenuItem.Visible=true;治理員登陸ToolStripMenuItem.Visible=true;}}//注冊(cè)界面privatevoid掃瞄信息ToolStripMenuItem_Click(objectsender,EventArgse){zhucezc=newzhuce();zc.ShowDialog();}//圖片變換privatevoidtimer2_Tick(objectsender,EventArgse){Randomrd=newRandom();intr=rd.Next(1,6);switch(r){case1:picture1();break;case2:picture2();break;case3:picture3();break;case4:picture4();break;case5:picture5();break;}}//圖片顯示方法privatevoidpicture1(){pictureBox1.Show();pictureBox2.Hide();pictureBox3.Hide();pictureBox4.Hide();pictureBox5.Hide();}privatevoidpicture2(){pictureBox2.Show();pictureBox1.Hide();pictureBox3.Hide();pictureBox4.Hide();pictureBox5.Hide();}privatevoidpicture3(){pictureBox3.Show();pictureBox2.Hide();pictureBox1.Hide();pictureBox4.Hide();pictureBox5.Hide();}privatevoidpicture4(){pictureBox4.Show();pictureBox2.Hide();pictureBox3.Hide();pictureBox1.Hide();}privatevoidpicture5(){pictureBox5.Show();pictureBox2.Hide();pictureBox3.Hide();pictureBox4.Hide();pictureBox1.Hide();}//當(dāng)不用手動(dòng)操縱圖片時(shí),執(zhí)行privatevoidbutton1_MouseLeave(objectsender,EventArgse){timer2.Enabled=true;}//用戶登陸privatevoid用戶登錄ToolStripMenuItem_Click(objectsender,EventArgse){Userlaunchuch=newUserlaunch();if(uch.ShowDialog()==DialogResult.OK){status1=uch.UserName;toolStripStatusLabel4.Text="尊敬的用戶"+status1+"你好!";用戶補(bǔ)全資料ToolStripMenuItem.Visible=true;用戶充值ToolStripMenuItem.Visible=true;novisible1();novisible3();}uch.Dispose();}//治理員登陸privatevoid治理員登陸ToolStripMenuItem_Click(objectsender,EventArgse){Admainadn=newAdmain();if(adn.ShowDialog()==DialogResult.OK){toolStripStatusLabel4.Text=adn.AdmainName;novisible2();novisible3();客戶信息ToolStripMenuItem.Visible=true;航班信息ToolStripMenuItem.Visible=true;修改公告ToolStripMenuItem.Visible=true;}}//機(jī)票預(yù)訂privatevoidbutton6_Click(objectsender,EventArgse){if(toolStripStatusLabel4.Text=="未登錄"){MessageBox.Show("請(qǐng)先登錄");textBox1.Text=textBox2.Text=textBox5.Text="";}elseif(toolStripStatusLabel4.Text.Substring(0,3)=="友愛的"){MessageBox.Show("對(duì)不起,治理員,您不能訂票的!");textBox1.Text=textBox2.Text=textBox5.Text="";}else{if(textBox1.Text!=""&&textBox2.Text!=""||textBox5.Text!=""){intn=1;jipiaoyudingjyd=newjipiaoyuding(textBox1.Text,textBox2.Text,textBox5.Text,n,status1);jyd.ShowDialog();}else{MessageBox.Show("對(duì)不起,你輸入的信息不符合查詢條件,請(qǐng)重新輸入");}}}//系統(tǒng)時(shí)刻privatevoidtimer3_Tick(objectsender,EventArgse){this.toolStripStatusLabel3.Text="當(dāng)前系統(tǒng)時(shí)刻:"+DateTime.Now.ToString("yyyy-MM-ddhh:mm:ss");}//查詢航班動(dòng)態(tài)privatevoidbutton7_Click(objectsender,EventArgse){if(textBox4.Text!=""&&textBox3.Text!=""||textBox6.Text!=""){intn=2;jipiaoyudingjyd=newjipiaoyuding(textBox4.Text,textBox3.Text,textBox6.Text,n,status1);jyd.ShowDialog();textBox4.Text=textBox3.Text=textBox6.Text="";}else{MessageBox.Show("對(duì)不起,你輸入的信息不符合查詢條件,請(qǐng)重新輸入");textBox4.Text=textBox3.Text=textBox6.Text="";}}privatevoid訂票信息ToolStripMenuItem_Click(objectsender,EventArgse){訂票信息dp=new訂票信息();dp.ShowDialog();}privatevoid用戶資料ToolStripMenuItem_Click(objectsender,EventArgse){用戶資料yz=new用戶資料();yz.ShowDialog();}privatevoid訂票ToolStripMenuItem_Click(objectsender,EventArgse){jipiaoyudingjyd=newjipiaoyuding("","","",1,status1);jyd.ShowDialog();}privatevoid查詢訂單ToolStripMenuItem_Click(objectsender,EventArgse){個(gè)人訂單gd=new個(gè)人訂單(status1);gd.ShowDialog();}privatevoid黑名單資料ToolStripMenuItem_Click(objectsender,EventArgse){黑名單表hm=new黑名單表();hm.ShowDialog();}privatevoid航班信息ToolStripMenuItem_Click(objectsender,EventArgse){航班信息hbx=new航班信息();hbx.ShowDialog();}privatevoid修改公告ToolStripMenuItem_Click(objectsender,EventArgse){修改公告xg=new修改公告();if(xg.ShowDialog()==DialogResult.OK){label1.Text=xg.gonggao;}}privatevoid查看自己資料ToolStripMenuItem_Click(objectsender,EventArgse){個(gè)人資料gz=new個(gè)人資料(status1,1);gz.ShowDialog();}privatevoid修改個(gè)人資料ToolStripMenuItem_Click(objectsender,EventArgse){個(gè)人資料gz1=new個(gè)人資料(status1,2);gz1.ShowDialog();}privatevoid我想退票ToolStripMenuItem_Click(objectsender,EventArgse){退票系統(tǒng)tp=new退票系統(tǒng)(status1);if(tp.ShowDialog()==DialogResult.OK){MessageBox.Show("退票成功");}}privatevoidbutton8_Click(objectsender,EventArgse){if(toolStripStatusLabel4.Text=="未登錄"){MessageBox.Show("你還未登陸,請(qǐng)先登錄!");textBox7.Text=textBox8.Text=textBox9.Text="";textBox1.Focus();}elseif(toolStripStatusLabel4.Text.Substring(0,3)=="友愛的"){MessageBox.Show("治理員,您是無(wú)權(quán)退票的??!");textBox7.Text=textBox8.Text=textBox9.Text="";textBox1.Focus();}else{退票系統(tǒng)tp=new退票系統(tǒng)(status1);tp.tuibiao(textBox7.Text,textBox8.Text,textBox9.Text);{if(tp.DialogResult==DialogResult.OK){MessageBox.Show("退票成功");}}}}//取消退票privatevoidbutton9_Click(objectsender,EventArgse){textBox7.Text=textBox8.Text=textBox9.Text="";textBox7.Focus();}}}usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace航空訂票治理系統(tǒng){publicpartialclasszhuce:Form{publicstringUsername{get;set;}publicstringUserpassword1{get;set;}publicstringUserpassword2{get;set;}publicintflag1,flag2,flag3;stringconnectionString=Properties.Settings.Default.HKDPConnectionString;publiczhuce(){InitializeComponent();flag1=1;flag2=1;flag3=1;toolTip1.InitialDelay=0;toolTip1.ReshowDelay=0;toolTip1.SetToolTip(textBox1,"用戶名不能超過(guò)20個(gè)字符,而且只能用字母,數(shù)字!");toolTip1.SetToolTip(textBox2,"密碼不能少于6個(gè)子");toolTip1.SetToolTip(textBox3,"請(qǐng)?jiān)佥斎胍淮蚊艽a");errorProvider1.BlinkStyle=ErrorBlinkStyle.NeverBlink;}privatevoidbutton2_Click(objectsender,EventArgse){this.Dispose();}//驗(yàn)證密碼是否大于6個(gè)字符privatevoidtextBox2_TextChanged(objectsender,EventArgse){if(textBox2.Text.Length<=6||textBox2.Text.Length>20){errorProvider2.SetError(textBox2,"密碼非法!");flag1=0;}else{errorProvider2.Clear();flag1=1;}}//驗(yàn)證用戶名是否大于6個(gè)字符,同時(shí)必須是數(shù)字和字母的組合privatevoidtextBox1_Enter(objectsender,EventArgse){intflag=1;for(inti=0;i<textBox1.Text.Length;i++){if(char.IsLetterOrDigit(textBox1.Text[i])==false){flag=0;}else{flag=1;}}if(textBox1.Text.Length<=6||textBox1.Text.Length>20||flag==0){errorProvider1.SetError(textBox1,"用戶名非法!");flag2=0;}else{errorProvider1.Clear();flag2=1;}}//驗(yàn)證確認(rèn)密碼是否正確privatevoidtextBox3_TextChanged(objectsender,EventArgse){if(textBox3.Text!=textBox2.Text||textBox3.Text.Length<=6){errorProvider3.SetError(textBox3,"密碼非法!");flag3=0;}else{errorProvider3.Clear();flag3=1;}}/*開始添加數(shù)據(jù)*/privatevoidbutton1_Click(objectsender,EventArgse){Username=textBox1.Text;Userpassword1=textBox2.Text;using(SqlConnectionconn=newSqlConnection(connectionString)){conn.Open();try{if(flag1==1&&flag2==1&&flag3==1&&textBox2.Text==textBox3.Text){SqlCommandcmd=newSqlCommand();cmd.Connection=conn;SqlDataAdapteradapter=newSqlDataAdapter("select*fromUsertablewhereUsername='"+textBox1.Text+"'",conn);DataTabletable=newDataTable();adapter.Fill(table);if(table.Rows.Count==0){cmd.CommandText="insertintoUsertable(Username,Upassword)values(@Username,@Username)";cmd.Parameters.Clear();cmd.Parameters.Add(newSqlParameter("Username",Username));cmd.Parameters.Add(newSqlParameter("Upassword",Userpassword1));cmd.ExecuteNonQuery();conn.Close();MessageBox.Show("恭喜您,注冊(cè)成功");this.Dispose();}else{MessageBox.Show("對(duì)不起,此用戶名已被注冊(cè)!");textBox1.Text=textBox2.Text=textBox3.Text="";textBox1.Focus();flag1=1;}}else{MessageBox.Show("專門遺憾,差一步就完成了!");textBox1.Text=textBox2.Text=textBox3.Text="";textBox1.Focus();flag1=1;}}catch(Exceptionerr){MessageBox.Show(err.Message);}}}}}usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace航空訂票治理系統(tǒng){publicpartialclassUserlaunch:Form{publicstringUserName{get;set;}stringconnection=Properties.Settings.Default.HKDPConnectionString;publicUserlaunch(){InitializeComponent();}//登陸開始privatevoidbutton1_Click(objectsender,EventArgse){try{SqlConnectionconn=newSqlConnection(connection);conn.Open();SqlCommandcmd=newSqlCommand();cmd.Connection=conn;cmd.CommandText="selectcount(*)fromUsertablewhereUsername='"+textBox1.Text+"'andUpassword='"+textBox2.Text+"'";if((int)cmd.ExecuteScalar()==1){UserName=textBox1.Text;this.DialogResult=DialogResult.OK;}else{MessageBox.Show("登錄名或密碼錯(cuò)誤!請(qǐng)重新輸入");textBox1.Text="";textBox2.Text="";textBox1.Focus();}conn.Close();}catch(Exceptionerr){MessageBox.Show(err.Message);}}//關(guān)閉窗體privatevoidbutton2_Click(objectsender,EventArgse){this.Dispose();}}}usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace航空訂票治理系統(tǒng){publicpartialclassAdmain:Form{publicstringAdmainName{get;set;}stringconnection=Properties.Settings.Default.HKDPConnectionString;publicAdmain(){InitializeComponent();}//釋放窗體privatevoidbutton2_Click(objectsender,EventArgse){this.Dispose();}//進(jìn)入密碼驗(yàn)證privatevoidbutton1_Click(objectsender,EventArgse){try{SqlConnectionconn=newSqlConnection(connection);conn.Open();SqlCommandcmd=newSqlCommand();cmd.Connection=conn;cmd.CommandText="selectcount(*)fromAdmainwhereAdmainId='"+textBox1.Text+"'andApassword='"+textBox2.Text+"'";if((int)cmd.ExecuteScalar()==1){AdmainName="友愛的治理員"+textBox1.Text+"你好!";this.DialogResult=DialogResult.OK;}else{MessageBox.Show("登錄名或密碼錯(cuò)誤!請(qǐng)重新輸入");textBox1.Text="";textBox2.Text="";textBox1.Focus();}conn.Close();}catch(Exceptionerr){MessageBox.Show(err.Message);}}}}usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace航空訂票治理系統(tǒng){publicpartialclassjipiaoyuding:Form{SqlDataAdapteradapter;DataTabletable;publicstringusername{get;set;}intQ;stringconnectionString=Properties.Settings.Default.HKDPConnectionString;publicjipiaoyuding(){InitializeComponent();dataGridView1.SelectionMode=DataGridViewSelectionMode.FullRowSelect;}//在主窗體中指定的條件篩選出來(lái)的數(shù)據(jù)publicjipiaoyuding(stringa,stringb,stringc,intn,stringq){InitializeComponent();dataGridView1.SelectionMode=DataGridViewSelectionMode.FullRowSelect;Q=n;username=q;try{SqlConnectionconn=newSqlConnection(connectionString);if(c==""){conn.Open();adapter=newSqlDataAdapter("select*fromHangbanwherechufadi='"+a+"'anddaodadi='"+b+"'",conn);table=newDataTable();adapter.Fill(table);dataGridView1.DataSource=table;head();conn.Close();}else{conn.Open();adapter=newSqlDataAdapter("select*fromHangbanwhereHBid='"+c+"'",conn);table=newDataTable();adapter.Fill(table);dataGridView1.DataSource=table;head();conn.Close();}}catch(Exceptionerr){MessageBox.Show(err.Message);}}//釋放此窗體privatevoidbutton2_Click(objectsender,EventArgse){this.Dispose();}//篩選指定航班的值privatevoidtextBox1_TextChanged(objectsender,EventArgse){SqlConnectionconn=newSqlConnection(connectionString);conn.Open();adapter=newSqlDataAdapter("select*fromHangbanwhereHBid='"+textBox1.Text+"'",conn);table=newDataTable();adapter.Fill(table);dataGridView1.DataSource=table;head();conn.Close();}//篩選符合大于一個(gè)價(jià)格privatevoidtextBox2_TextChanged(objectsender,EventArgse){try{SqlConnectionconn=newSqlConnection(connectionString);conn.Open();adapter=newSqlDataAdapter("select*fromHangbanwhereprice>="+textBox2.Text,conn);table=newDataTable();adapter.Fill(table);dataGridView1.DataSource=table;head();conn.Close();}catch(Exceptionerr){MessageBox.Show("看起來(lái)出錯(cuò)了,請(qǐng)重新篩選"+err.Message);}}//篩選小于一個(gè)價(jià)格的值privatevoidtextBox3_TextChanged(objectsender,EventArgse){try{SqlConnectionconn=newSqlConnection(connectionString);conn.Open();adapter=newSqlDataAdapter("select*fromHangbanwhereprice<="+textBox3.Text,conn);table=newDataTable();adapter.Fill(table);dataGridView1.DataSource=table;head();conn.Close();}catch(Exceptionerr){MessageBox.Show("看起來(lái)出錯(cuò)了,請(qǐng)重新篩選"+err.Message);}}//訂票開始privatevoidbutton1_Click(objectsender,EventArgse){if(MessageBox.Show("確定要訂票嗎?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Warning)==DialogResult.Yes){try{if(Q==1){SqlConnectionconn=newSqlConnection(connectionString);conn.Open();SqlCommandcmd=newSqlCommand("updateHangbansetsyps=syps-1whereHBid='"+dataGridView1.SelectedRows[0].Cells[0].Value.ToString()+"'",conn);cmd.ExecuteNonQuery();intx=int.Parse(dataGridView1.SelectedRows[0].Cells[8].Value.ToString());inty=int.Parse(dataGridView1.SelectedRows[0].Cells[7].Value.ToString());stringHban=dataGridView1.SelectedRows[0].Cells[0].Value.ToString();decimalPrice=decimal.Parse(dataGridView1.SelectedRows[0].Cells[6].Value.ToString());if(x==0){cmd.Connection=conn;cmd.CommandText="updateHangbansetsyps=syps+1whereHBid='"+dataGridView1.SelectedRows[0].Cells[0].Value.ToString()+"'";cmd.ExecuteNonQuery();MessageBox.Show("對(duì)不起,沒(méi)有票啦!請(qǐng)定其他航班");}else{MessageBox.Show("購(gòu)買成功,你的座位號(hào)是:"+(y-x+1).ToString());xierushuju(username,y-x+1,Hban,Price);this.Dispose();}conn.Close();}else{MessageBox.Show("對(duì)不起,你現(xiàn)在查詢航班狀態(tài)!不能預(yù)訂,現(xiàn)在帶你回登
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 《簡(jiǎn)筆畫上色技巧》課件
- 中心投影和平行投影課件
- 《壓力管理》課件
- 《市場(chǎng)營(yíng)銷情景模擬》課件
- 單位管理制度集粹選集職工管理篇
- 單位管理制度匯編大全職員管理篇
- 單位管理制度合并選集人力資源管理篇
- 三峽復(fù)習(xí)課件
- 《精油的起源基礎(chǔ)》課件
- 單位管理制度分享合集【人事管理】
- 會(huì)計(jì)科目涉稅風(fēng)險(xiǎn)點(diǎn)風(fēng)險(xiǎn)
- 香椿矮化密植栽培
- GB/T 4214.3-2023家用和類似用途電器噪聲測(cè)試方法洗碗機(jī)的特殊要求
- 建設(shè)工程質(zhì)量控制講義三
- YY/T 0606.7-2008組織工程醫(yī)療產(chǎn)品第7部分:殼聚糖
- 2023年遼寧軌道交通職業(yè)學(xué)院高職單招(英語(yǔ))試題庫(kù)含答案解析
- GB/T 29076-2021航天產(chǎn)品質(zhì)量問(wèn)題歸零實(shí)施要求
- DL-T 5190.1-2022 電力建設(shè)施工技術(shù)規(guī)范 第1部分:土建結(jié)構(gòu)工程(附條文說(shuō)明)
- 殯葬服務(wù)人才需求調(diào)研報(bào)告
- 降低銳器盒不規(guī)腎內(nèi)科品管圈課件
- 《了凡四訓(xùn)》課件
評(píng)論
0/150
提交評(píng)論