基于VB的影院售票管理系统设计与实现(含详细源程序)_第1页
基于VB的影院售票管理系统设计与实现(含详细源程序)_第2页
基于VB的影院售票管理系统设计与实现(含详细源程序)_第3页
基于VB的影院售票管理系统设计与实现(含详细源程序)_第4页
基于VB的影院售票管理系统设计与实现(含详细源程序)_第5页
已阅读5页,还剩62页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

61 61 61 6166基于VB的影院售票管理系统设计与实现(含详细源程序)面向对象程序设计课程设计报告基于VB的影院售票管理系统设计与实现1一(系统概述 31.1项目需求 31.2需求分析 3二(项目开发计划书 4三(设计说明书 63.1分析与创建数据库 3.2创建登陆窗体模块 83.3创建售票窗体模块 153.4创建检票界面 283.5创建维护界面 333.6创建影库界面 363.7创建职工界面 453.8创建票务界面 54四(用户操作手册 4.1系统概述 614.2使用方法 61 五(结语 63 六(参考文献 642一(系统概述项目需求现在中国大部分的家庭都喜欢在家里置办属于自己风格的家庭影院。但是,仍然有很多人喜欢到电影院去看电影。因为家里的气氛毕竟不如影院好。所以,现代家庭影院的出现并不会让电影院没有生路。每个社会服务系统都有自己的一套管理机制。当然,电影院也不除外。其实电影院的管理系统应该来说比其他的社会服务系统的管理要简单一点。电影院不外乎是引进电影,制定播放影片的时间表,买票,检票进场观看,还有就是一些数据管理方面的事。如工作人员管理,票务管理等等。为了工作机制简单有序,必然要引进一套管理系统。需求分析具体而言,影院售票系统需要实现以下的需求:(1)能够对播放电影,工作人员,售票事宜,检票事宜,无用数据进行处理。售票管理自然有专人负责,要处理各电影的电影票销售问题。当然包括退票问题,还有就是预订电影票其实也就相当于买票。两者可以当一回事处理。检票管理事宜要完成观众进场时检票的事宜。其中包括了电影票的真假检测问题。数据管理要处理电影的播放的次序,工作人员的管理,以及过期电影票的处理问题。二(项目开发计划书根据需求分析的结果,本小组成员讨论协商,决定本系统主要划分为以下三个子模块:售票管理模块、检票管理模块、数据管理模块。影院售票管理系统是一个基于电影院工作人员的系统,不同类型的用户在系统中有不同的权限。主要有三种用户:1(售票管理人员:主要负责卖票,订票及退票事宜;2(检票管理人员:主要负责观众进场时检票工作,以及辨认电影票的真假(此工作自然可以由服务系统来完成);3(数据处理人员:主要负责播放电影导入数据库,工作人员的应聘以及开除的数据管理,还有过期电影票的数据处理;以下分别介绍此系统中各个系统(3个子模块。):(1)售票系统模块给观众提供售票服务。不同的位置有不同的价格。要选购哪个位置由观众决定。工作人员根据观众的需要进行操作。系统在购票成功后会产生一个验证码,此验证码连工作人员都不知道。是随机生成的。用于对电影票真假的辩识。(2)检票系统模块在观众进场时所使用的系统。由扫描仪扫描,取的验证码,然后进行辩识,看是不是和数据库中数据一样,如果一样,则电影票为真,否则电影票为假。由此来决定让不让观众入场。(3)维护系统模块此模块是由电影院的数据库管理员来管理的。他根据电影院事情的需要对有关数据进行处理。如电影票的管理,工作人员的管理,和电影库的管理等。整个系统的结构如下图1所示:影院售票管理系统xiop工作人员登录维护系统检票系统售票系统影工过片作期播人票放员务管管管理理理以下分别介绍系统中数据系统3个子模块。(1)影片播放管理模块影片播放管理是对电影院播放的电影的充实,设定电影的播放,以及电影时间的设定。当所设定的电影已经播放完成后,要对其进行删除。还要对数据库进行清理,把一些没用的数据全部清除。(2)工作人员管理:电影院里当然有工作人员的增加与开除,以及他们的管理权限的变化。这一部分事件的发生都需要数据库管理人员将有关数据进行处理。保证数据库里数据的统一与完整。其中有他们的共号,登陆电影院管理系统的密码,以及所拥有的权限。(3)过期票务管理:电影院里的电影在放过以后,在数据库的电影票数据就会变成没有用的数据。通过此管理可以把那些没用的过期的数据清除。这里指的是与放过的电影同名的电影票清除,而其他的电影票保存不变。小组人员分工情况:王圣武登陆界面和售票界面、系统转换界面的程序编写,整个系统框架的设计,整个系统界面及美化设计,整个系统流程的管理,创建数据库张润驰检票系统和整个维护系统的程序编写,局部框架辅助设计,创建数据库本系统后台数据库采用目前比较流行的MicrosoftSQLSever,该数据库系统在安全性、准确性、运行速度方面有绝对的优势,并且处理数据量大、效率高;前台采用Microsoft公司的VB.NET2003作为主要的开发工具,其可与SQLSever2000数据库无缝衔接。三(设计说明书分析与创建数据库根据系统的功能分析结果,影院售票管理系统将会使用MicrosoftSQLSever2000作为后台的数据库管理系统。本管理系统是应用于电影院中,而且需要和数据库之间进行频繁数据交换,所以采用MicrosoftSQLSever2000作为后台的数据库管理系统。在本管理系统中,需要掌握影库充实信息,职工管理信息,票务管理信息,此外,由于要进行职工管理,还需要掌握使用本系统的职工。表1存储硬库信息列表,表2存储了电影院座位的相关数据连接关系,表3存储了电影票销售情况管理,表4存储了系统使用者职工的相关情况的管理列表。表1影库管理表MOVIES字段属性字段名数据类字段大作用必填索引是否称型小字段主键Movie_ismallin2电影号是有(无重复)是dtMovie_nNvarcha50电影名是无amer称actorNvarcha50导演否无6actressNvarcha50主演否无produceNvarcha25制片厂否无palydatdatetim8上映时是无表2电影院座位管理表SEATS字段属性字段名数据类字段大作用必填索引是否主称型小字段键seatidsmallin2座位号是有(无重是t复)pricefloat8票价是无soldorsmallin2是否售是无nott出表3电影票信息表TICKETS字段属性字段名数据类字段大作用必填索引是否主称型小字段键ticketssmallin2电影票是有(无重是idt号复)seatidsmallin2座位号是有tMovie_ismallin2电影号是有dtMovie_nNvarcha50电影名否无amerpalydatdatetim8上映时是无7ee间pricefloat8价格是无yanzhensmallin2验证码是无是gmat表4职工信息表WORKERS字段属性字段名数据类字段大作用必填字索引是否主称型小段键workersmallin2职工号是无是idtpasswosmallin2职工密是无rdt码leibiesmallin2职工类是无t型根据规范化的设计理念,本管理系统的数据分成上面4个表,减少了数据的冗余,同时在这些表之间又存在着一些关联关系。这四个表之间的这两种关系表现在下图所示的关系:T工ckets匚通tieketsid.scatiAmvijra? mcivie_iLirna9^17datejjrice.73.nxhen.ErnL3.2创建登陆窗体模块(1)窗体模块的功能8登陆窗体(2)窗体界面的设计在工程中添加一个窗体,命名为“登陆系统”,用来作为系统登陆窗体。界面的设计如图3所示。(3)的设计如图3所示。(3)窗体代码ImportsSystem.Data.SqlClientPublicClassForm1InheritsSystem.Windows.Forms.FormDimnavigatorAsBindingManagerBase'用来对记录导航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设计\电影院票务系统\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连接对象操作数据库mycom.CommandType=CommandType.Text'设置命令类型mycom.CommandText="select*fromworkers"'设置要执行的命令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连接对象操作数据库mycom1.CommandType=CommandType.Text'设置命令类型mycom1.CommandText="selectleibiefromworkerswhereworkerid="+CStr(tox1)+"andpassword="+CStr(tox2)+""'设置要执行的命令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("您超出职责范围或未选择服务系统,请重新输入〜","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Warning,MessageBoxDefaultButton.Button1)EndIfCatchexAsExceptionEndTryEndIfEndSubPrivateSubForm1_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadAxShockwaveFlashl.Movie="E:\实验运行场\VB.NET程序设计、电影院票务系统\image'登陆界面l.swf"AxShockwaveFlash1.Play()EndSub14PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndIfEndSubEndClass3.3创建售票窗体模块窗体模块的功能为观众提供买票服务。在界面上观众可以看见座位的情况,根据此来选择自己喜欢的座位。不同的座位有不同的价格。此窗体还有退票功能。窗体界面的设计在工程中添加一个窗体,命名为“售票系统”,用来作为仓管人员窗体。界面的设计如下图所示。代码编写ImportsSystem.Data.SqlClientPublicClassForm2InheritsSystem.Windows.Forms.FormDimnavigatorAsBindingManagerBase'用来对记录导航DimiAsIntegerDimiAsIntegerDimiAsIntegerDimiAsInteger15DimmyconAsNewSqlConnection'连接对象DimmycomAsNewSqlCommand'命令对象PrivateSubForm2_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadMe.Show()AxShockwaveFlashl.Movie="E:\实验运行场\VB.NET程序设计、电影院票务系统\image'销售界面.swf"AxShockwaveFlash1.Play()AxShockwaveFlash2.Movie="E:\实验运行场\VB.NET程序设计、电影院票务系统\image\检票界面下.swf"AxShockwaveFlash2.Play()16DimmydataadapterAsNewSqlDataAdapterDimmydsAsNewDataSetDimjAsIntegerDimstrrowAsStringDimdtAsNewDataTablemycon.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom.Connection=mycon'通过MYCON连接对象操作数据库mycom.CommandType=CommandType.Text'设置命令类型mycom.CommandText="select*fromMovies"'设置要执行的命令"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连接对象操作数据库mycom3.CommandType=CommandType.Text'设置命令类型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连接对象操作数据库mycom1.CommandType=CommandType.Text'设置命令类型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连接对象操作数据库mycom4.CommandType=CommandType.Text'设置命令类型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连接对象操作数据库mycom2.CommandType=CommandType.Text'设置命令类型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创建检票界面(1)创建模块的功能对进场观众检票,如果发现有假票或无票观众不允许入内。(2)创建模块的窗体在工程中添加一个窗体,命名为“检票系统”,用来作为检票系统窗体。界面的设计如下图所示。(3)代码编写ImportsSystem.Data.SqlClientPublicClassForm3InheritsSystem.Windows.Forms.FormDimds1AsNewDataSetDimsqlda1AsNewSqlDataAdapterDimRecordCountAsInteger28拉近和岫谢谢观看本场电影PrivateSubForm3_Load(ByValsenderAsSystem.Object,ByValeAs拉近和岫谢谢观看本场电影PrivateSubForm3_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadAxShockwaveFlashl.Movie="E:\实验运行场\VB.NET程序设计、电影院票务系统\image、检票界面.swf"AxShockwaveFlash1.Play()AxShockwaveFlash2.Movie="E:\实验运行场\VB.NET程序设计、电影院票务系统\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="请认真填写票号〜”TextBox1.Focus()ExitSubIfTextBox2.Text=""ThenTextBox7.Text="请填写验证码〜”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创建维护界面(1)创建模块的功能给数据库维护工作人员选择维护的系统数据库(2)创建模块的设计在工程中添加一个窗体,命名为“维护系统”,用来作为维护系统窗体。界面的设计如下图所示。33(3)代码编写PublicClassForm8InheritsSystem.Windows.Forms.FormPrivateSubForm8_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadEndSubEndSubAxShockwaveFlashl.Movie="E:\实验运行场\VB.NET程序设计、电影院票务系统\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创建影库界面(1)创建模块的功能对电影库播放列表的管理)创建模块的设计(2在工程中添加一个窗体,命名为“影库系统”,用来作为影库系统窗体。界面的设计如下图所示。(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'修改数据.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'删除数据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创建职工界面(1)创建模块的功能对职工数据的处理。如增加、删除和更改(2)创建模块的设计在工程中添加一个窗体,命名为“影库系统”,用来作为影库系统窗体。界面的设计如下图所示。(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到达尾记录〜","提示信息”)MessageBox.Show("EMessageBox.Show("E到达尾记录〜","提示信息”)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到达首记录〜","提示信息”)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("服务系统号只能为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("服务系统号只能为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创建票务界面(1)创建模块的功能对所售出的电影票进行管理,把没用的数据进行清除(2)创建模块的设计在工程中添加一个窗体,命名为“影库系统”,用来作为影库系统窗体。界面的设计如下图所示。由卡伍至.舌瀛迪的芭送名 歪班言死的克题信息(3)代码编写54帆美U受辛森它除由卡伍至.舌瀛迪的芭送名 歪班言死的克题信息(3)代码编写54帆美U受辛森它除电霸髭二河码导两巴汽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("请认真填写电影名〜",”提示信息")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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论