基于VB的影院售票管理系統(tǒng)設(shè)計與實現(xiàn)(含詳細(xì)源程序)_第1頁
基于VB的影院售票管理系統(tǒng)設(shè)計與實現(xiàn)(含詳細(xì)源程序)_第2頁
基于VB的影院售票管理系統(tǒng)設(shè)計與實現(xiàn)(含詳細(xì)源程序)_第3頁
基于VB的影院售票管理系統(tǒng)設(shè)計與實現(xiàn)(含詳細(xì)源程序)_第4頁
基于VB的影院售票管理系統(tǒng)設(shè)計與實現(xiàn)(含詳細(xì)源程序)_第5頁
已閱讀5頁,還剩62頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

61 61 61 6166基于VB的影院售票管理系統(tǒng)設(shè)計與實現(xiàn)(含詳細(xì)源程序)面向?qū)ο蟪绦蛟O(shè)計課程設(shè)計報告基于VB的影院售票管理系統(tǒng)設(shè)計與實現(xiàn)1一(系統(tǒng)概述 31.1項目需求 31.2需求分析 3二(項目開發(fā)計劃書 4三(設(shè)計說明書 63.1分析與創(chuàng)建數(shù)據(jù)庫 3.2創(chuàng)建登陸窗體模塊 83.3創(chuàng)建售票窗體模塊 153.4創(chuàng)建檢票界面 283.5創(chuàng)建維護界面 333.6創(chuàng)建影庫界面 363.7創(chuàng)建職工界面 453.8創(chuàng)建票務(wù)界面 54四(用戶操作手冊 4.1系統(tǒng)概述 614.2使用方法 61 五(結(jié)語 63 六(參考文獻 642一(系統(tǒng)概述項目需求現(xiàn)在中國大部分的家庭都喜歡在家里置辦屬于自己風(fēng)格的家庭影院。但是,仍然有很多人喜歡到電影院去看電影。因為家里的氣氛畢竟不如影院好。所以,現(xiàn)代家庭影院的出現(xiàn)并不會讓電影院沒有生路。每個社會服務(wù)系統(tǒng)都有自己的一套管理機制。當(dāng)然,電影院也不除外。其實電影院的管理系統(tǒng)應(yīng)該來說比其他的社會服務(wù)系統(tǒng)的管理要簡單一點。電影院不外乎是引進電影,制定播放影片的時間表,買票,檢票進場觀看,還有就是一些數(shù)據(jù)管理方面的事。如工作人員管理,票務(wù)管理等等。為了工作機制簡單有序,必然要引進一套管理系統(tǒng)。需求分析具體而言,影院售票系統(tǒng)需要實現(xiàn)以下的需求:(1)能夠?qū)Σシ烹娪埃ぷ魅藛T,售票事宜,檢票事宜,無用數(shù)據(jù)進行處理。售票管理自然有專人負(fù)責(zé),要處理各電影的電影票銷售問題。當(dāng)然包括退票問題,還有就是預(yù)訂電影票其實也就相當(dāng)于買票。兩者可以當(dāng)一回事處理。檢票管理事宜要完成觀眾進場時檢票的事宜。其中包括了電影票的真假檢測問題。數(shù)據(jù)管理要處理電影的播放的次序,工作人員的管理,以及過期電影票的處理問題。二(項目開發(fā)計劃書根據(jù)需求分析的結(jié)果,本小組成員討論協(xié)商,決定本系統(tǒng)主要劃分為以下三個子模塊:售票管理模塊、檢票管理模塊、數(shù)據(jù)管理模塊。影院售票管理系統(tǒng)是一個基于電影院工作人員的系統(tǒng),不同類型的用戶在系統(tǒng)中有不同的權(quán)限。主要有三種用戶:1(售票管理人員:主要負(fù)責(zé)賣票,訂票及退票事宜;2(檢票管理人員:主要負(fù)責(zé)觀眾進場時檢票工作,以及辨認(rèn)電影票的真假(此工作自然可以由服務(wù)系統(tǒng)來完成);3(數(shù)據(jù)處理人員:主要負(fù)責(zé)播放電影導(dǎo)入數(shù)據(jù)庫,工作人員的應(yīng)聘以及開除的數(shù)據(jù)管理,還有過期電影票的數(shù)據(jù)處理;以下分別介紹此系統(tǒng)中各個系統(tǒng)(3個子模塊。):(1)售票系統(tǒng)模塊給觀眾提供售票服務(wù)。不同的位置有不同的價格。要選購哪個位置由觀眾決定。工作人員根據(jù)觀眾的需要進行操作。系統(tǒng)在購票成功后會產(chǎn)生一個驗證碼,此驗證碼連工作人員都不知道。是隨機生成的。用于對電影票真假的辯識。(2)檢票系統(tǒng)模塊在觀眾進場時所使用的系統(tǒng)。由掃描儀掃描,取的驗證碼,然后進行辯識,看是不是和數(shù)據(jù)庫中數(shù)據(jù)一樣,如果一樣,則電影票為真,否則電影票為假。由此來決定讓不讓觀眾入場。(3)維護系統(tǒng)模塊此模塊是由電影院的數(shù)據(jù)庫管理員來管理的。他根據(jù)電影院事情的需要對有關(guān)數(shù)據(jù)進行處理。如電影票的管理,工作人員的管理,和電影庫的管理等。整個系統(tǒng)的結(jié)構(gòu)如下圖1所示:影院售票管理系統(tǒng)xiop工作人員登錄維護系統(tǒng)檢票系統(tǒng)售票系統(tǒng)影工過片作期播人票放員務(wù)管管管理理理以下分別介紹系統(tǒng)中數(shù)據(jù)系統(tǒng)3個子模塊。(1)影片播放管理模塊影片播放管理是對電影院播放的電影的充實,設(shè)定電影的播放,以及電影時間的設(shè)定。當(dāng)所設(shè)定的電影已經(jīng)播放完成后,要對其進行刪除。還要對數(shù)據(jù)庫進行清理,把一些沒用的數(shù)據(jù)全部清除。(2)工作人員管理:電影院里當(dāng)然有工作人員的增加與開除,以及他們的管理權(quán)限的變化。這一部分事件的發(fā)生都需要數(shù)據(jù)庫管理人員將有關(guān)數(shù)據(jù)進行處理。保證數(shù)據(jù)庫里數(shù)據(jù)的統(tǒng)一與完整。其中有他們的共號,登陸電影院管理系統(tǒng)的密碼,以及所擁有的權(quán)限。(3)過期票務(wù)管理:電影院里的電影在放過以后,在數(shù)據(jù)庫的電影票數(shù)據(jù)就會變成沒有用的數(shù)據(jù)。通過此管理可以把那些沒用的過期的數(shù)據(jù)清除。這里指的是與放過的電影同名的電影票清除,而其他的電影票保存不變。小組人員分工情況:王圣武登陸界面和售票界面、系統(tǒng)轉(zhuǎn)換界面的程序編寫,整個系統(tǒng)框架的設(shè)計,整個系統(tǒng)界面及美化設(shè)計,整個系統(tǒng)流程的管理,創(chuàng)建數(shù)據(jù)庫張潤馳檢票系統(tǒng)和整個維護系統(tǒng)的程序編寫,局部框架輔助設(shè)計,創(chuàng)建數(shù)據(jù)庫本系統(tǒng)后臺數(shù)據(jù)庫采用目前比較流行的MicrosoftSQLSever,該數(shù)據(jù)庫系統(tǒng)在安全性、準(zhǔn)確性、運行速度方面有絕對的優(yōu)勢,并且處理數(shù)據(jù)量大、效率高;前臺采用Microsoft公司的VB.NET2003作為主要的開發(fā)工具,其可與SQLSever2000數(shù)據(jù)庫無縫銜接。三(設(shè)計說明書分析與創(chuàng)建數(shù)據(jù)庫根據(jù)系統(tǒng)的功能分析結(jié)果,影院售票管理系統(tǒng)將會使用MicrosoftSQLSever2000作為后臺的數(shù)據(jù)庫管理系統(tǒng)。本管理系統(tǒng)是應(yīng)用于電影院中,而且需要和數(shù)據(jù)庫之間進行頻繁數(shù)據(jù)交換,所以采用MicrosoftSQLSever2000作為后臺的數(shù)據(jù)庫管理系統(tǒng)。在本管理系統(tǒng)中,需要掌握影庫充實信息,職工管理信息,票務(wù)管理信息,此外,由于要進行職工管理,還需要掌握使用本系統(tǒng)的職工。表1存儲硬庫信息列表,表2存儲了電影院座位的相關(guān)數(shù)據(jù)連接關(guān)系,表3存儲了電影票銷售情況管理,表4存儲了系統(tǒng)使用者職工的相關(guān)情況的管理列表。表1影庫管理表MOVIES字段屬性字段名數(shù)據(jù)類字段大作用必填索引是否稱型小字段主鍵Movie_ismallin2電影號是有(無重復(fù))是dtMovie_nNvarcha50電影名是無amer稱actorNvarcha50導(dǎo)演否無6actressNvarcha50主演否無produceNvarcha25制片廠否無palydatdatetim8上映時是無表2電影院座位管理表SEATS字段屬性字段名數(shù)據(jù)類字段大作用必填索引是否主稱型小字段鍵seatidsmallin2座位號是有(無重是t復(fù))pricefloat8票價是無soldorsmallin2是否售是無nott出表3電影票信息表TICKETS字段屬性字段名數(shù)據(jù)類字段大作用必填索引是否主稱型小字段鍵ticketssmallin2電影票是有(無重是idt號復(fù))seatidsmallin2座位號是有tMovie_ismallin2電影號是有dtMovie_nNvarcha50電影名否無amerpalydatdatetim8上映時是無7ee間pricefloat8價格是無yanzhensmallin2驗證碼是無是gmat表4職工信息表WORKERS字段屬性字段名數(shù)據(jù)類字段大作用必填字索引是否主稱型小段鍵workersmallin2職工號是無是idtpasswosmallin2職工密是無rdt碼leibiesmallin2職工類是無t型根據(jù)規(guī)范化的設(shè)計理念,本管理系統(tǒng)的數(shù)據(jù)分成上面4個表,減少了數(shù)據(jù)的冗余,同時在這些表之間又存在著一些關(guān)聯(lián)關(guān)系。這四個表之間的這兩種關(guān)系表現(xiàn)在下圖所示的關(guān)系:T工ckets匚通tieketsid.scatiAmvijra? mcivie_iLirna9^17datejjrice.73.nxhen.ErnL3.2創(chuàng)建登陸窗體模塊(1)窗體模塊的功能8登陸窗體(2)窗體界面的設(shè)計在工程中添加一個窗體,命名為“登陸系統(tǒng)”,用來作為系統(tǒng)登陸窗體。界面的設(shè)計如圖3所示。(3)的設(shè)計如圖3所示。(3)窗體代碼ImportsSystem.Data.SqlClientPublicClassForm1InheritsSystem.Windows.Forms.FormDimnavigatorAsBindingManagerBase'用來對記錄導(dǎo)航DimmyconAsNewSqlConnection'連接對象DimmycomAsNewSqlCommand'命令對象Dimmycom1AsNewSqlCommandDimfrm2AsNewForm2Dimfrm3AsNewForm3Dimfrm8AsNewForm89PrivateSubTimer1_Tick(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesTimer1.TickStatusBar1.Panels(0).Text=DateTime.TodayStatusBar1.Panels(1).Text=DateTime.Now.ToString("T")EndSubPrivateSubGroupBox1_Enter(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesGroupBox1.EnterIfRadioButton1.Checked=TrueThenRadioButton2.Checked=FalseRadioButton3.Checked=FalseElseIfRadioButton2.Checked=TrueThenRadioButton1.Checked=FalseRadioButton3.Checked=FalseElseIfRadioButton3.Checked=TrueThenRadioButton1.Checked=FalseRadioButton2.Checked=FalseEndIfEndSubPrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickAxShockwaveFlashl.Movie="E:\實驗運行場\VB.NET程序10設(shè)計\電影院票務(wù)系統(tǒng)\image'登陸界面l.swf"AxShockwaveFlash1.Playing=FalseAxShockwaveFlash1.Stop()Dimtox1AsInt32Dimtox2AsInt32DimmydataadapterAsNewSqlDataAdapterDimmydsAsNewDataSetDimiAsIntegerDimjAsIntegertox1=Val(TextBox1.Text)tox2=Val(TextBox2.Text)mycon.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom.Connection=mycon'通過MYCON連接對象操作數(shù)據(jù)庫mycom.CommandType=CommandType.Text'設(shè)置命令類型mycom.CommandText="select*fromworkers"'設(shè)置要執(zhí)行的命令Trymycon.Open()mydataadapter.SelectCommand=mycomCatchexAsException11MessageBox.Show("連接失敗”)Finallymycon.Close()EndTrymydataadapter.Fill(myds,"workers")Fori=0Tomyds.Tables("workers").Rows.Count-1Iftox1=Val(myds.Tables("workers").Rows(i).ItemArray(0))Thenj=0ExitForElsej=1EndIfNextFori=0Tomyds.Tables("workers").Rows.Count-1Iftox2=Val(myds.Tables("workers").Rows(i).ItemArray(1))Thenj=0ExitForElsej=1EndIf12NextIfj=1ThenMessageBox.Show("您的工號或者密碼錯誤","錯誤提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)ElseTrymycom1.Connection=mycon'通過MYCON連接對象操作數(shù)據(jù)庫mycom1.CommandType=CommandType.Text'設(shè)置命令類型mycom1.CommandText="selectleibiefromworkerswhereworkerid="+CStr(tox1)+"andpassword="+CStr(tox2)+""'設(shè)置要執(zhí)行的命令Dimmydataadapter1AsNewSqlDataAdaptermydataadapter1.SelectCommand=mycom1Dimmyds1AsNewDataSetmydataadapter1.Fill(myds1,"workers")IfRadioButton1.Checked=TrueAnd1ThenVal(myds1.Tables("workers").Rows(0)("leibie"))=1ThenMe.Hide()=TrueAndElseIfRadioButton2.Checked=TrueAndVal(myds1.Tables("workers").Rows(0)("leibie"))=2Thenfrm3.Show()Me.Hide()ElseIfRadioButton3.Checked=TrueAndVal(myds1.Tables("workers").Rows(0)("leibie"))=3Thenfrm8.Show()Me.Hide()ElseMessageBox.Show("您超出職責(zé)范圍或未選擇服務(wù)系統(tǒng),請重新輸入?","錯誤提示",MessageBoxButtons.OK,MessageBoxIcon.Warning,MessageBoxDefaultButton.Button1)EndIfCatchexAsExceptionEndTryEndIfEndSubPrivateSubForm1_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadAxShockwaveFlashl.Movie="E:\實驗運行場\VB.NET程序設(shè)計、電影院票務(wù)系統(tǒng)\image'登陸界面l.swf"AxShockwaveFlash1.Play()EndSub14PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndIfEndSubEndClass3.3創(chuàng)建售票窗體模塊窗體模塊的功能為觀眾提供買票服務(wù)。在界面上觀眾可以看見座位的情況,根據(jù)此來選擇自己喜歡的座位。不同的座位有不同的價格。此窗體還有退票功能。窗體界面的設(shè)計在工程中添加一個窗體,命名為“售票系統(tǒng)”,用來作為倉管人員窗體。界面的設(shè)計如下圖所示。代碼編寫ImportsSystem.Data.SqlClientPublicClassForm2InheritsSystem.Windows.Forms.FormDimnavigatorAsBindingManagerBase'用來對記錄導(dǎo)航DimiAsIntegerDimiAsIntegerDimiAsIntegerDimiAsInteger15DimmyconAsNewSqlConnection'連接對象DimmycomAsNewSqlCommand'命令對象PrivateSubForm2_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadMe.Show()AxShockwaveFlashl.Movie="E:\實驗運行場\VB.NET程序設(shè)計、電影院票務(wù)系統(tǒng)\image'銷售界面.swf"AxShockwaveFlash1.Play()AxShockwaveFlash2.Movie="E:\實驗運行場\VB.NET程序設(shè)計、電影院票務(wù)系統(tǒng)\image\檢票界面下.swf"AxShockwaveFlash2.Play()16DimmydataadapterAsNewSqlDataAdapterDimmydsAsNewDataSetDimjAsIntegerDimstrrowAsStringDimdtAsNewDataTablemycon.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom.Connection=mycon'通過MYCON連接對象操作數(shù)據(jù)庫mycom.CommandType=CommandType.Text'設(shè)置命令類型mycom.CommandText="select*fromMovies"'設(shè)置要執(zhí)行的命令"Trymycon.Open()mydataadapter.SelectCommand=mycommydataadapter.Fill(myds,"Movies")CatchexAsExceptionMessageBox.Show("連接失敗”)Finallymycon.Close()17EndTryTryFori=0Tomyds.Tables("Movies").Rows.Count-1strrow=myds.Tables("Movies").Rows(i)("movie_name")ComboBox1.Items.Add(strrow)NextCatchexAsExceptionMessageBox.Show(ex.ToString)EndTryEndSubPrivateSubButton1_Click_1(ByValsenderAsSystem.Object,ByValAsSystem.EventArgs)HandlesButton1.ClickDimiAsIntegerDimtickethaoAsIntegerDimmoviehaoAsIntegerDimsuijiAsIntegerDimmydataadapter3AsNewSqlDataAdapterDimmyds3AsNewDataSetDimdt3AsNewDataTableDimmycom3AsNewSqlCommandDimmycon3AsNewSqlConnection18Randomize()suiji=Int(9000*Rnd()+1000)Trytickethao=tickets_id()moviehao=movieid()mycon3.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom3.Connection=mycon3'通過MYCON連接對象操作數(shù)據(jù)庫mycom3.CommandType=CommandType.Text'設(shè)置命令類型CatchexAsExceptionMessageBox.Show(ex.ToString)EndTryIftickethao=0ThenTryMessageBox.Show("此座位已售出,請重新選擇?","錯誤")ComboBox1.Text=""TextBox1.Text=""TextBox2.Text=""TextBox3.Text=""19TextBox4.Text=""TextBox5.Text=""CatchexAsExceptionMessageBox.Show(ex.ToString)EndTryElseTrymycon3.Open()mycom3.CommandText="insertintotickets(ticketsid,seatid,movie_id,movie_name,palydate,price,yanzhengma)values("+CStr(tickethao)+","+TextBox4.Text+","+CStr(moviehao)+",'+TextBox2.Text+"','"+TextBox1.Text+"',"+TextBox5.Text+","+CStr(suiji)+")"DimsqlAsStringsql="insertintotickets(ticketsid,seatid,movie_id,movie_name,palydate,price,yanzhengma)values("+CStr(tickethao)+","+TextBox4.Text+","+CStr(moviehao)+",'"+TextBox2.Text+"','"+TextBox3.Text+"',"+TextBox5.Text+","+CStr(suiji)+")"mydataadapter3.InsertCommand=mycom3Trymycom3.ExecuteNonQuery()20MessageBox.Show("售票成功?","謝謝觀看")CatchexAsExceptionMsgBox(ex.ToString)EndTryCatchexAsExceptionMessageBox.Show(ex.ToString)EndTrymycon3.Close()ComboBox1.Text=""TextBox1.Text=""TextBox2.Text=""TextBox3.Text=""TextBox4.Text=""TextBox5.Text=""EndIfrevoke_seat()EndSubPrivateSubComboBox1_SelectedIndexChanged_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesComboBox1.SelectedIndexChangedrevoke_seat()21Dimmydataadapter1AsNewSqlDataAdapterDimmydataadapter11AsNewSqlDataAdapterDimmyds1AsNewDataSetDimmyds11AsNewDataSetDimdt1AsNewDataTableDimdt11AsNewDataTableDimmycom1AsNewSqlCommandDimmycom11AsNewSqlCommandmycon.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom1.Connection=mycon'通過MYCON連接對象操作數(shù)據(jù)庫mycom1.CommandType=CommandType.Text'設(shè)置命令類型mycom11.Connection=myconmycom11.CommandType=CommandType.TextTrymycon.Open()mycom11.CommandText="selectpalydatefromMovieswheremovie_name='"+ComboBox1.Text+"'mycom1.CommandText="select*fromticketswheremovie_name='"+ComboBox1.Text+"'"22mydataadapter1.SelectCommand=mycom1mydataadapter11.SelectCommand=mycom11mydataadapter1.Fill(myds1,"tickets")mydataadapter11.Fill(myds11,"Movies")dt1=myds1.Tables("tickets")dt11=myds11.Tables("Movies")CatchexAsExceptionMessageBox.Show(ex.ToString)EndTryTryIfdt1.Rows.Count=0ThenMessageBox.Show(“還未出售?”)TextBox1.Text=dt11.Rows(0)("palydate")revoke_seat()ElseShowSellInfo(dt1)TextBox1.Text=dt11.Rows(0)("palydate")EndIfCatchexAsExceptionEndTrymycon.Close()EndSub23PrivateSubButton2_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickDimtickethaoAsIntegerDimmydataadapter4AsNewSqlDataAdapterDimmyds4AsNewDataSetDimdt4AsNewDataTableDimmycom4AsNewSqlCommandDimmycon4AsNewSqlConnectionTrymycon4.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom4.Connection=mycon4'通過MYCON連接對象操作數(shù)據(jù)庫mycom4.CommandType=CommandType.Text'設(shè)置命令類型tickethao=tuipiao()CatchexAsExceptionMessageBox.Show(ex.ToString)EndTryIftickethao=0ThenMessageBox.Show("座位號輸入錯誤,請重新輸入?”,24錯誤")ElseTrymycon4.Open()mycom4.CommandText="deletefromticketswhereticketsid="+CStr(tickethao)+""Trymycom4.ExecuteNonQuery()MessageBox.Show("退票成功?","謝謝觀看")CatchexAsExceptionMsgBox(ex.ToString)EndTryCatchexAsExceptionMsgBox(ex.ToString)EndTryEndIfmycon4.Close()TextBox1.Text=""TextBox2.Text=""TextBox3.Text=""TextBox4.Text=""25TextBox5.Text=""ComboBox1.Text=""revoke_seat()EndSubPrivateSubButton3_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickTextBox2.Text=ComboBox1.TextTextBox3.Text=TextBox1.TextIfTextBox4.Text=""ThenMessageBox.Show(”請輸入座位號?","提示")EndIDimmydataadapter2AsNewSqlDataAdapterDimmyds2AsNewDataSetDimdt2AsNewDataTableDimmycom2AsNewSqlCommandmycon.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom2.Connection=mycon'通過MYCON連接對象操作數(shù)據(jù)庫mycom2.CommandType=CommandType.Text'設(shè)置命令類型Try26mycon.Open()mycom2.CommandText="select*fromseatswhereseatid="+TextBox4.Text+""mydataadapter2.SelectCommand=mycom2mydataadapter2.Fill(myds2,"seats")dt2=myds2.Tables("seats")CatchexAsExceptionMessageBox.Show(ex.ToString)EndTryTextBox5.Text=dt2.Rows(0)("price")mycon.Close()EndSubPrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndIfEndSubEndClass273.4創(chuàng)建檢票界面(1)創(chuàng)建模塊的功能對進場觀眾檢票,如果發(fā)現(xiàn)有假票或無票觀眾不允許入內(nèi)。(2)創(chuàng)建模塊的窗體在工程中添加一個窗體,命名為“檢票系統(tǒng)”,用來作為檢票系統(tǒng)窗體。界面的設(shè)計如下圖所示。(3)代碼編寫ImportsSystem.Data.SqlClientPublicClassForm3InheritsSystem.Windows.Forms.FormDimds1AsNewDataSetDimsqlda1AsNewSqlDataAdapterDimRecordCountAsInteger28拉近和岫謝謝觀看本場電影PrivateSubForm3_Load(ByValsenderAsSystem.Object,ByValeAs拉近和岫謝謝觀看本場電影PrivateSubForm3_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadAxShockwaveFlashl.Movie="E:\實驗運行場\VB.NET程序設(shè)計、電影院票務(wù)系統(tǒng)\image、檢票界面.swf"AxShockwaveFlash1.Play()AxShockwaveFlash2.Movie="E:\實驗運行場\VB.NET程序設(shè)計、電影院票務(wù)系統(tǒng)\image\檢票界面下.swf"AxShockwaveFlash2.Play()Dimsqlcmd1AsNewSqlCommandDimstr1AsString="select*fromticketssqlcmd1.Connection=sqlcn129sqlcmd1.CommandText=str1sqlda1.SelectCommand=sqlcmd1Trysqlcn1.Open()EndIfEndIfsqlcmd1.ExecuteNonQuery()CatchexAsSqlExceptionMsgBox(ex.Message)Finallysqlcn1.Close()EndTryTrysqlda1.Fill(ds1)CatchexAsSqlExceptionMsgBox(ex.Message)EndTryRecordCount=ds1.Tables(0).Rows.CountTextBox6.Text=RecordCountEndSubPrivateSubButton1_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimiAsIntegerDimflagAsBoolean=False30IfTextBox1.Text=""ThenTextBox7.Text="請認(rèn)真填寫票號?”TextBox1.Focus()ExitSubIfTextBox2.Text=""ThenTextBox7.Text="請?zhí)顚戲炞C碼?”TextBox2.Focus()ExitSubEndIfFori=0ToRecordCount-1IfTextBox1.Text=CStr(ds1.Tables(0).Rows(i)("ticketsid"))AndTextBox2.Text=CStr(ds1.Tables(0).Rows(i)("yanzhengma"))Thenflag=TrueExitForEndIfNextIfflag=TrueThenTryTextBox3.Text=ds1.Tables(0).Rows(i)("seatid")31TextBox4.Text=ds1.Tables(0).Rows(i)("movie_name")TextBox5.Text=ds1.Tables(0).Rows(i)("price")CatchexAsExceptionMsgBox(ex.Message)EndTryTextBox7.Text="此票為真?"ElseTextBox7.Text="此票為假?"EndIfTextBox6.Text=RecordCountEndSubPrivateSubButton2_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickTextBox1.Text=""TextBox2.Text=""TextBox3.Text=""TextBox4.Text=""TextBox5.Text=""TextBox6.Text=""TextBox7.Text=""32TextBox1.Focus()EndSubPrivateSubButton3_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndSubEndClass3.5創(chuàng)建維護界面(1)創(chuàng)建模塊的功能給數(shù)據(jù)庫維護工作人員選擇維護的系統(tǒng)數(shù)據(jù)庫(2)創(chuàng)建模塊的設(shè)計在工程中添加一個窗體,命名為“維護系統(tǒng)”,用來作為維護系統(tǒng)窗體。界面的設(shè)計如下圖所示。33(3)代碼編寫PublicClassForm8InheritsSystem.Windows.Forms.FormPrivateSubForm8_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadEndSubEndSubAxShockwaveFlashl.Movie="E:\實驗運行場\VB.NET程序設(shè)計、電影院票務(wù)系統(tǒng)\image'登陸界面.swf"AxShockwaveFlash1.Play()EndSubPrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimfrm4AsNewForm4frm4.Show()Me.Hide()34EndSubPrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickDimfrm6AsNewForm6frm6.Show()Me.Hide()EndSubPrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickDimfrm9AsNewForm9frm9.Show()Me.Hide()PrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndIfEndSub35EndClass3.6創(chuàng)建影庫界面(1)創(chuàng)建模塊的功能對電影庫播放列表的管理)創(chuàng)建模塊的設(shè)計(2在工程中添加一個窗體,命名為“影庫系統(tǒng)”,用來作為影庫系統(tǒng)窗體。界面的設(shè)計如下圖所示。(3)代碼編寫DimsqlAdapterAsNewSqlDataAdapterDimmovieRowAsDataRowDimRecordCountAsIntegerDimiAsInteger=0Dimidnum(2000)AsInteger36DimCurrentPositionAsIntegerSubShowPosition()RecordCount=DataSet11.Movies.Rows.CountIfRecordCount=0ThenTextBox1.Text="無記錄"ElseCurrentPosition=Me.BindingContext(DataSet11,"Movies").PositionmovieRow=DataSet11.Movies.Rows(CurrentPosition)TextBox1.Text=movieRow.Item("movie_id")idnum(i)=TextBox1.Texti+=1TextBox2.Text=movieRow.Item("movie_name")TextBox3.Text=movieRow.Item("actor")TextBox4.Text=movieRow.Item("actress")TextBox5.Text=movieRow.Item("producer")TextBox6.Text=movieRow.Item("palydate")TextBox7.Text=CurrentPosition+1&"/"&RecordCountEndIfEndSub37PrivateSubForm4_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadDataSet11.Clear()Me.SqlDataAdapter1.Fill(DataSet11)ShowPosition()EndSubPrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickIfMe.BindingContext(DataSet11,"Movies").Position>0ThenMe.BindingContext(DataSet11,"Movies").Position-=1ShowPosition()System.EventArgs)HandlesButtonSystem.EventArgs)HandlesButton#.Click'修改數(shù)據(jù).Item("producer")=TextBox5.Text.Item("palydate")=TextBox6.Text.EndEdit()EndWithCatchexAsExceptionMessageBox.Show(ex.Message)Return40EndTryDataSet11.Movies.Rows.Add(MyNewData)TryDimiAsInteger=SqlDataAdapter1.Update(DataSet11,"Movies")DataSet11.AcceptChanges()MessageBox.Show(i&"條記錄添加成功?”)CatchexAsExceptionMessageBox.Show(ex.Message)EndTryidnum(i)=TextBox1.Texti=i+1EndIfEndSubPrivateSubButton6_Click(ByValsenderAsSystem.Object,ByValeAsDimjAsIntegerForj=0ToiIfTextBox1.Text=CStr(idnum(j))ThenMessageBox.Show("ID地址有沖突?","提示")EndIfNext41CurrentPosition=Me.BindingContext(DataSet11,"Movies").PositionmovieRow=DataSet11.Movies.Rows(CurrentPosition)TryWithmovieRow.BeginEdit().Item("movie_id")=TextBox1.Text.Item("movie_name")=TextBox2.Text.Item("actor")=TextBox3.Text.Item("actress")=TextBox4.Text.Item("producer")=TextBox5.Text.Item("palydate")=TextBox6.Text.EndEdit()EndWithCatchexAsExceptionMessageBox.Show(ex.Message)ReturnEndTryTryDimiAsInteger=SqlDataAdapter1.Update(DataSet11,"Movies")DataSet11.AcceptChanges()42MessageBox.Show(i&"條記錄修改成功?”)CatchexAsExceptionMessageBox.Show(ex.Message)EndTryEndSubPrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickMe.BindingContext(DataSet11,"Movies").Position=0ShowPosition()EndSubPrivateSubButton7_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton7.Click'刪除數(shù)據(jù)CurrentPosition=Me.BindingContext(DataSet11,"Movies").PositionmovieRow=DataSet11.Movies.Rows(CurrentPosition)DimnAsInteger=movieRow.Item("movie_id")DimjAsInteger=0Forj=0ToiIfn=idnum(j)Thenidnum(j)=-1EndIfNext43movieRow.Delete()TryDimiAsInteger=SqlDataAdapter1.Update(DataSet11,"Movies")DataSet11.AcceptChanges()MessageBox.Show(i&"條記錄刪除成功?”)CatchexAsExceptionMessageBox.Show(ex.Message)EndTryEndSubPrivateSubButton8_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton8.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndIfEndSubPrivateSubButton9_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton9.ClickDimfrm8AsNewForm844frm8.Show()Me.Close()EndSubEndClass3.7創(chuàng)建職工界面(1)創(chuàng)建模塊的功能對職工數(shù)據(jù)的處理。如增加、刪除和更改(2)創(chuàng)建模塊的設(shè)計在工程中添加一個窗體,命名為“影庫系統(tǒng)”,用來作為影庫系統(tǒng)窗體。界面的設(shè)計如下圖所示。(3)代碼編寫InheritsSystem.Windows.Forms.FormDimfrm8AsNewForm8DimsqlAdapterAsNewSqlDataAdapter45DimmovieRowAsDataRowDimRecordCountAsIntegerDimiAsInteger=0Dimidnum(2000)AsIntegerDimCurrentPositionAsIntegerSubShowPosition()RecordCount=DataSet11.Workers.Rows.CountIfRecordCount=0ThenTextBox1.Text="無記錄"ElseCurrentPosition=Me.BindingContext(DataSet11,"Workers").PositionmovieRow=DataSet11.Workers.Rows(CurrentPosition)TextBox1.Text=movieRow.Item("workerid")idnum(i)=TextBox1.Text+=1TextBox2.Text=movieRow.Item("password")TextBox3.Text=movieRow.Item("leibie")TextBox4.Text=CurrentPosition+1&"/"&RecordCountEndIf46EndSubMessageBox.Show("EMessageBox.Show("E到達(dá)尾記錄?","提示信息”)MessageBox.Show("EMessageBox.Show("E到達(dá)尾記錄?","提示信息”)PrivateSubForm6_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadDataSet11.Clear()Me.SqlDataAdapter1.Fill(DataSet11)ShowPosition()EndSubPrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickIfMe.BindingContext(DataSet11,"Workers").Position>0ThenMe.BindingContext(DataSet11,"Workers").Position-=1ShowPosition()ElseMessageBox.Show("E到達(dá)首記錄?","提示信息”)EndIfEndSubPrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickIfMe.BindingContext(DataSet11,"Workers").Position<RecordCount-1Then47Me.BindingContext(DataSet11,"Workers").Position+=1ShowPosition()ElseEndIfEndSubPrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickMe.BindingContext(DataSet11,"Workers").Position=0ShowPosition()EndSubPrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.ClickMe.BindingContext(DataSet11,"Workers").Position=RecordCount-1ShowPosition()EndSubPrivateSubButton5_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton5.ClickDimjAsIntegerDimflagAsBoolean=True48Forj=0ToiIfTextBox1.Text=CStr(idnum(j))Thenflag=FalseMessageBox.Show("ID地址有沖突?","提示")EndIfNextIfTextBox3.Text<>1AndTextBox3.Text<>2AndTextBox3.Text<>3Thenflag=FalseMessageBox.Show("服務(wù)系統(tǒng)號只能為1,2,3?","提示")EndIfIfflag=TrueThenDimMyNewDataAsDataRowMyNewData=DataSet11.Workers.NewRowTryWithMyNewData.BeginEdit()IfTextBox1.Text<>""Then.Item("workerid")=TextBox1.TextElseMessageBox.Show("編號不能為空")49ReturnEndIf.Item("password")=TextBox2.Text.Item("leibie")=TextBox3.Text.EndEdit()EndWithCatchexAsExceptionMessageBox.Show(ex.Message)ReturnEndTryDataSet11.Workers.Rows.Add(MyNewData)TryDimkAsInteger=SqlDataAdapter1.Update(DataSet11,"Workers")DataSet11.AcceptChanges()MessageBox.Show(k&"條記錄添加成功?”)CatchexAsExceptionMessageBox.Show(ex.Message)EndTryidnum(i)=TextBox1.Texti=i+1EndIf50EndSubPrivateSubButton6_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton6.ClickDimjAsIntegerForj=0ToiIfTextBox1.Text=CStr(idnum(j))ThenMessageBox.Show("ID地址有沖突?","提示")EndIfNextIfTextBox3.Text<>1AndTextBox3.Text<>2AndTextBox3.Text<>3ThenMessageBox.Show("服務(wù)系統(tǒng)號只能為1,2,3?",”提示")EndIfCurrentPosition=Me.BindingContext(DataSet11,"Workers").PositionmovieRow=DataSet11.Workers.Rows(CurrentPosition)TryWithmovieRow.BeginEdit().Item("workerid")=TextBox1.Text.Item("password")=TextBox2.Text51.Item("leibie")=TextBox3.Text.EndEdit()EndWithCatchexAsExceptionMessageBox.Show(ex.Message)ReturnEndTryTryDimkAsInteger=SqlDataAdapter1.Update(DataSet11,"Workers")DataSet11.AcceptChanges()MessageBox.Show(k&"條記錄修改成功?”)CatchexAsExceptionMessageBox.Show(ex.Message)EndTryEndSubPrivateSubButton7_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton7.ClickCurrentPosition=Me.BindingContext(DataSet11,"Workers").PositionmovieRow=DataSet11.Workers.Rows(CurrentPosition)DimnAsInteger=movieRow.Item("workerid")52DimjAsInteger=0Forj=0ToiIfn=idnum(j)Thenidnum(j)=-1EndIfNextmovieRow.Delete()TryDimkAsInteger=SqlDataAdapter1.Update(DataSet11,"Workers")DataSet11.AcceptChanges()MessageBox.Show(k&"條記錄刪除成功?")CatchexAsExceptionMessageBox.Show(ex.Message)EndTryEndSubPrivateSubButton8_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton8.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()53Application.Exit()EndIffrm8.Close()EndSubPrivateSubButton9_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton9.ClickMe.Close()frm8.Show()EndSubEndClass3.8創(chuàng)建票務(wù)界面(1)創(chuàng)建模塊的功能對所售出的電影票進行管理,把沒用的數(shù)據(jù)進行清除(2)創(chuàng)建模塊的設(shè)計在工程中添加一個窗體,命名為“影庫系統(tǒng)”,用來作為影庫系統(tǒng)窗體。界面的設(shè)計如下圖所示。由卡伍至.舌瀛迪的芭送名 歪班言死的克題信息(3)代碼編寫54帆美U受辛森它除由卡伍至.舌瀛迪的芭送名 歪班言死的克題信息(3)代碼編寫54帆美U受辛森它除電霸髭二河碼導(dǎo)兩巴汽4品口乂目I主清才即函苕制片"iIJsatBoHS上咦明樂麻荷ImportsSystem.Data.SqlClientPublicClassForm9InheritsSystem.Windows.Forms.FormDimds1AsNewDataSetDimsqlda1AsNewSqlDataAdapterDimRecordCountAsIntegerPrivateSubForm9_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadDimsqlcmd1AsNewSqlCommandDimstr1AsString="SELECTMovies.movie_id,Movies.movie_name,Movies.actor,Movies.actress,Mducer,Movies.palydateFROMMoviesINNERJOINTicketsONMovies.movie_name=Tickets.movie_name"sqlcmd1.Connection=sqlcn155sqlcmd1.CommandText=str1sqlda1.SelectCommand=sqlcmd1Trysqlcn1.Open()sqlcmd1.ExecuteNonQuery()CatchexAsSqlExceptionMsgBox(ex.Message)Finallysqlcn1.Close()EndTryTrysqlda1.Fill(ds1)CatchexAsSqlExceptionMsgBox(ex.Message)EndTryRecordCount=ds1.Tables(0).Rows.CountEndSubPrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimiAsIntegerDimflagAsBoolean=FalseIfTextBox1.Text=""Then56MessageBox.Show("請認(rèn)真填寫電影名?",”提示信息")TextBox1.Focus()ElseFori=0ToRecordCount-1IfCStr(ds1.Tables(0).Rows(i).Item("movie_name")).Trim=CStr(TextBox1.Text)ThenTryTextBox2.Text=CStr(ds1.Tables(0).Rows(i).Item("movie_id"))TextBox3.Text=CStr(ds1.Tables(0).Rows(i).Item("movie_name"))TextBox4.Text=CStr(ds1.Tables(0).Rows(i).Item("actor"))TextBox5.Text=CStr(ds1.Tables(0).Rows(i).Item("actress"))TextBox6.Text=CStr(ds1.Tables(0).Rows(i).Item("producer"))TextBox7.Text=CStr(ds1.Tables(0).Rows(i).Item("palydate"))CatchexAsException57MsgBox(ex.Message)EndTryflag=TrueExitSubEndIfNextEndIfIfflag=FalseThenMessageBox.Show("輸入電影名有誤?","提示")EndIfEndSubPrivateSubButton2_Click(ByValsenderAsSystem.

溫馨提示

  • 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)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論