第一篇:航空售票系统系统实施报告
航 空 售 票 管 理 系 统
实 施 报 告
组员:
目录
第一章 引言 ················································································································· 4
1.1编写目的··········································································································· 4 1.2参考文献··········································································································· 4 1.3术语和缩写词...................................................................................................4 第二章
软件概述 ····································································································· 5
2.1软件用途··········································································································· 5 2.2软件运行··········································································································· 5 2.3系统配置·········································································································· 7 2.4软件结构·········································································································· 7 2.5软件性能·········································································································· 8 2.6输入、处理、输出·························································································· 8
2.6.1输入········································································································· 8 2.6.2输出········································································································· 9
第三章
软件使用过程 ····························································································· 10
3.1软件安装········································································································· 10 3.2运行步骤········································································································· 10 3.3运行说明········································································································· 10
3.3.1控制输入······························································································· 10 3.3.2管理信息······························································································· 10 3.4.3输入输出文件······················································································· 10 3.4.4输出报告······························································································· 10 3.5出错处理········································································································· 10 3.6非常规过程····································································································· 11 第四章 软件维护过程 ······························································································· 12
4.1程序设计的约定····························································································· 12 4.2出错及纠正方法····························································································· 12 4.3专用维护程序································································································· 12 4.4 源程序清单···································································································· 12
第一章 引言
1.1编写目的
开发目标:开发出一个操作简便,界面友好,灵活实用,安全可靠,功能齐全的的航空售票管理信息系统。
航空售票管理信息系统对航空相关单位进行包括机票订购在内的许多信息管理有着极其重要的作用,就一般的实用软件来说,它的设计内容繁多、功能重叠、操作复杂,比如订票和修改票务信息某些功能模块重叠等。本开发小组正是通过广泛调研,对同类的相关系统掌握了一定的资料的基础上,制定开发出来的。为了更好的完善本系统,在实施管理阶段特制定本实施报告,以求彻底完善本系统。
1.2参考文献
[1]张翼英等 《Visual Basic课程设计》 清华大学出版社 出版日期:2008-1 [2]《信息系统开发方法》清华大学出版社 姜旭平
1.3术语和缩写词
在本文档中,所有专门术语的定义以及缩写词的原意如下: ①程序流程图:
程序流程图又称程序框图,独立于任何一种设计语言,比较直观和清晰的描述了过程的控制流程。
②N-S图:
N-S图是为了改变流程图描述程序逻辑时过大的随意性与灵活性,其规定了五种图形构建,包括:顺序型,选择型,while重复,until重复型,多分枝选择型。
③PAD图:
PAD图是problem analysis diagram的英文缩写,是日本日立公司提出。它使用结构化程序设计思想表现程序的逻辑结构的图形工具。
④PDL语言:
PDL语言是procedure design language的英文缩写。PDL是所有非正文形式的过程设计工具的统称。PDL具有“非纯粹”的编写语言的特点。
第二章
软件概述
2.1软件用途
现在应用在大中型企业的管理信息系统中,几乎都包括了工资管理模块。有些环境中是由作为大型ERP软件中的一个模块引进的,有些是作为企业的财务系统的一部分。这些根据规范的西方的管理制度设计的工资管理软件,在很多时候还不能完全解决中国特色的中小企业的问题,本文介绍的就是要为高校解决他们在工资管理方面的问题,主要实现系统用户管理、员工基本信息管理、工资标准设定以及工资结算和查询等一般工资管理系统应具有的主要功能,以便完成课程实践的目的。
2.2软件运行
学生成绩管理系统主要有:登陆界面、员工信息管理,工资标准管理 主要运行如下所示:
a : 登陆界面
输入姓名、密码,点击登陆界面显示图 b : 航线信息界面
图2.5 c :机票信息界面
图2.8 2.3系统配置
本软件要求在PC 及其兼容机上运行,要求奔腾II以上CPU,64兆以上内存,10G 以上硬盘。
软件需要有WINDOWS 7操作系统环境。.4软件结构
航空售票管理系统的结构图如下:
航空订票管理系统订票信息管理客户信息管理航线信息管理系统管理订票信息查询订票信息修改添加订票信息客户基本信息管理客户类别信息管理航线基本信息管理客机信息管理舱位信息管理密码管理用户管理客户信息查询客户信息修改客户信息添加客户类别信息修改客户类别信息添加航线信息查询航线信息修改航线信息添加客机信息查询客机信息修改客机信息添加舱位信息修改舱位信息添加
图2.12 2.5软件性能
A:用户管理模块能在普通用户与管理员之间加以区分,分别实现其对应的功能,方法简单,性能较好。
B:查询模块中我们对教职工按照姓名和工号两种方法进行查询,有效的考虑了重名的各种情况,达到一定的性能指标。
C:工资模块:我们将职称工资管理和其他工资管理等几种情况
D:密码管理:我们起初编写了一份密码表,只有按照密码表上的输入才能对工资管理系统进行相关操作,性能较好。.6输入、输出 2.6.1输入 本系统采用文本文框进行信息的输入以及成绩的输入。
我们将创建模块,显示模块,存盘功能模块,读入功能模块,统计功能模块等的输入项
2.6.2输出
本系统采用文本文框进行信息的输出以及成绩的输出。
我们将创建模块,显示模块,存盘功能模块,读入功能模块,统计功能模块等的输出项
第三章 软件使用过程
3.1软件安装
本系统采用vb.net进行设计与实现,完成设计后进行发布就可以在没有安装vb.net环境的计算机中使用,安装方便简洁,只需要在安装的计算机中添加数据库即可。
3.2运行步骤
首先选择要登录的角色,然后进入相应的界面进行操作。
3.3运行说明
对于本系统我们设计时进行了权限的分配,比如普通用户登陆后只能进行自己工资的查询而不能进行工资的修改,管理员登陆后既可以进行查询又可以进行修改。
3.3.1控制输入
按照软件的说明,将测试数据加入到软件中
3.3.2管理信息
软件运行过程中的密码键入:通过文本框进行输入。
3.4.3输入输出文件
软件运行过程中通过文本框进行文件的输入输出。
3.4.4输出报告
若输入要输出的条件正确的话会弹出相应的提示框提示是否成功或者正确等。
3.5出错处理
软件运行过程中可能雏形的出物及处理如下:(1)输入信息出错
在数据库内找不到输入的信息,输入信息有误,导致操作失败。(2)出错处理对策
检查重新输入的信息是否符合要求。(3)数据库连接错误
这类错误主要是数据库设置不正确,或sql server异常引起的,我们只要取消本次操作,提醒用户检查数据库问题就可。
3.6非常规过程
如果出现不可能处理的问题,可以直接与公司的技术支持人员联系。
第四章 软件维护过程
4.1程序设计的约定
本软件程序是一个单一的运行软件,各个软件子模块的预定如下:
航空售票管理系统主要以管理航空售票信息为目的,设置了严密的权限管理。用户管理:设置了权限管理功能
查询管理:包括查询航线和航班等基本信息。可以显示单独一条记录,也可以显示所有信息。
更新管理:当有需要时,管理员可以进行工资和信息的删除操作 密码管理:管理员和个人可以根据需求修改密码。
4.2出错及纠正方法
可能由于输入的数据不符合软件的要求,软件将可能提出错误,并提醒您按照软件的要求运行程序;可能出现的问题如下:
<1>若输入密码格式不对,应提示:您输入的密码错误。
4.3专用维护程序
本软件提供您一个专用维护软件,以便在软件出现意想不到的问题时可以使您迅速发现您在软件运行时的失误,保证您的分析结果不会受到损失,尽管您的软件可能永远不会出现使用维护本软件的时候,希望您在使用分析错误!未找到索引项。软件的时候,可以浏览以下本软件的使用。软件的使用如下:
A:输入正确的用户名与密码登陆。
B:若是普通用户,请选择登陆普通用户界面。C:若是管理员,请选择登陆管理员界面。
4.4 源程序清单
登录界面代码:
Imports System.Data Imports System.Data.SqlClient Public Class 登录
Inherits System.Windows.Forms.Form Dim count As Integer = 0 Dim my_class As New class1 #Region “ Windows 窗体设计器生成的代码” Public Sub New()MyBase.New()'该调用是Windows 窗体设计器所必需的。InitializeComponent()'在InitializeComponent()调用之后添加任何初始化
End Sub '窗体重写dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)If disposing Then If Not(components Is Nothing)Then components.Dispose()End If End If MyBase.Dispose(disposing)End Sub 'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer '注意: 以下过程是Windows 窗体设计器所必需的'可以使用Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label1 As System.Windows.Forms.Label
'Label2 ' Me.Label2.Font = New System.Drawing.Font(“宋体”, 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))Me.Label2.Location = New System.Drawing.Point(48, 163)Me.Label2.Name = “Label2” Me.Label2.Size = New System.Drawing.Size(136, 21)Me.Label2.TabIndex = 8 Me.Label2.Text = “ 用户名” '
'Label1 ' Me.Label1.BackColor = System.Drawing.SystemColors.ButtonHighlight Me.Label1.Font = New System.Drawing.Font(“华文彩云”, 36.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))Me.Label1.ForeColor = System.Drawing.SystemColors.InactiveCaption Me.Label1.Location = New System.Drawing.Point(55, 9)Me.Label1.Name = “Label1” Me.Label1.Size = New System.Drawing.Size(393, 120)Me.Label1.TabIndex = 7 Me.Label1.Text = “兰州航空公司 管理信息系统” '
'登录 ' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)Me.BackgroundImage = CType(resources.GetObject(“$this.BackgroundImage”), System.Drawing.Image)Me.ClientSize = New System.Drawing.Size(504, 390)Me.Controls.Add(Me.Button2)Me.Controls.Add(Me.Button1)Me.Controls.Add(Me.TextBox2)Me.Controls.Add(Me.TextBox1)Me.Controls.Add(Me.Label3)Me.Controls.Add(Me.Label2)Me.Controls.Add(Me.Label1)Me.Icon = CType(resources.GetObject(“$this.Icon”), System.Drawing.Icon)Me.Name = “登录” Me.Text = “Form7” Me.ResumeLayout(False)Me.PerformLayout()End Sub #End Region Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button1.Click Dim user As String Dim pw As String Dim temp1 As String Dim temp2 As String Dim con As String Dim singe As Integer = 1 user = TextBox1.Text username = TextBox1.Text pw = TextBox2.Text con = “select * from users where id='” + user + “' and password='” + pw + “'” Dim ds As New DataSet ds = class1.query(con)Try If ds.Tables(0).Rows.Count > 0 Then class1.dr = ds.Tables(0).Rows(0)temp1 = class1.dr(0)temp2 = class1.dr(1)主窗口.Show()End If Catch ex As Exception MessageBox.Show(ex.Message)End Try 'con = “insert into log(id)select id from permission where id='” + temp1 + “'” 'If(Trim(user)= Trim(temp1)And Trim(pw)= Trim(temp2)And(user <> “" Or pw <> ”“))Then ' Me.Hide()' class1.insert(con)' singe = 1 'ElseIf(user = ”“ And pw = ”“)Then ' MessageBox.Show(”用户名和密码为空!“, ”提示“)' TextBox1.Focus()' singe = 0 'ElseIf(Trim(user)<> Trim(temp1)Or Trim(pw)<> Trim(temp2))Then ' MessageBox.Show(”没有这个用户或密码错误,请重新输入!“, ”提示“)' TextBox1.SelectAll()' TextBox1.Focus()' singe = 0 'End If 'count = count + 1 'If(count = 3 And singe = 0)Then ' MessageBox.Show(”三次错误,退出本系统“, ”提示“)' End 'End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button2.Click End Sub Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles MyBase.Load class1.init()Label1.BackColor = Color.Transparent Label2.BackColor = Color.Transparent Label3.BackColor = Color.Transparent Button1.BackColor = Color.Transparent Button2.BackColor = Color.Transparent End Sub End Class 订票界面代码:
Public Class 订票
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button1.Click Dim i As Integer If TextBox1.Text = ”“ Then i = MsgBox(”客户号不能为空“, MsgBoxStyle.OkCancel, ”警告“)Else Dim conn As String = ”data source=.;connect timeout=5;User ID=sa;Password='123';initial catalog=Ticket;“ Dim objconn1 As New SqlConnection(conn)objconn1.Open()Dim 客户号 As New SqlParameter(”@客户号“, SqlDbType.Int, 4)Dim 客户姓名 As New SqlParameter(”@客户姓名“, SqlDbType.Char, 10)Dim 起飞地 As New SqlParameter(”@起飞地“, SqlDbType.VarChar, 50)Dim 目的地 As New SqlParameter(”@目的地“, SqlDbType.VarChar, 50)Dim 票价 As New SqlParameter(”@票价“, SqlDbType.Int, 4)Dim 飞行时间 As New SqlParameter(”@飞行时间“, SqlDbType.Int, 4)Dim 航空公司 As New SqlParameter(”@航空公司“, SqlDbType.VarChar, 50)Dim strin As String strin = ”insert into flyernb(客户号,客户姓名,起飞地,目的地,票价,飞行时间,航空公司)values(@客户号,@客户姓名,@起飞地,@目的地,@票价,@飞行时间,@航空公司)“ Dim objcmd1 As New SqlCommand(strin, objconn1)objcmd1.Parameters.Add(客户号)objcmd1.Parameters.Add(客户姓名)objcmd1.Parameters.Add(起飞地)objcmd1.Parameters.Add(目的地)objcmd1.Parameters.Add(票价)objcmd1.Parameters.Add(飞行时间)objcmd1.Parameters.Add(航空公司)客户号.Value = TextBox1.Text 客户姓名.Value = TextBox2.Text 起飞地.Value = ComboBox2.Text()目的地.Value = ComboBox3.Text()票价.Value = TextBox5.Text 飞行时间.Value = TextBox6.Text 航空公司.Value = ComboBox1.Text objcmd1.ExecuteNonQuery()objconn1.Close()objcmd1.Dispose()MsgBox(”订票成功!“)TextBox1.Text = ”“ TextBox2.Text = ”“ TextBox5.Text = ”“ TextBox6.Text = ”“ ComboBox2.Text = ”“ ComboBox3.Text()= ”“ ComboBox1.Text()= ”“ End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button2.Click Me.Close()End Sub End Class 退票界面代码:
Public Class 退票
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button1.Click Dim i As Integer i = MsgBox(”确定要退票吗?“, MsgBoxStyle.OkCancel, ”警告“)If i = MsgBoxResult.Cancel Then Close()Else Dim conn As String = ”data source=.;connect timeout=300;User ID=sa;Password='123';initial catalog=Ticket;“ Dim objconn1 As New SqlConnection(conn)'objconn1.Open()Dim strsql As String = ”delete from flyernb where 客户号='“ & Trim(TextBox1.Text)& ”'“ objconn1.Open()Dim objcmd As New SqlCommand(strsql, objconn1)objcmd.ExecuteNonQuery()objconn1.Close()objcmd.Dispose()MsgBox(”删除成功!“)TextBox1.Text = ”“ End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button2.Click Me.Close()End Sub End Class 用户权限设置代码:
Public Class 退票
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button1.Click Dim i As Integer i = MsgBox(”确定要退票吗?“, MsgBoxStyle.OkCancel, ”警告“)If i = MsgBoxResult.Cancel Then Close()Else Dim conn As String = ”data source=.;connect timeout=300;User ID=sa;Password='123';initial catalog=Ticket;“ Dim objconn1 As New SqlConnection(conn)'objconn1.Open()Dim strsql As String = ”delete from flyernb where 客户号='“ & Trim(TextBox1.Text)& ”'“ objconn1.Open()Dim objcmd As New SqlCommand(strsql, objconn1)objcmd.ExecuteNonQuery()objconn1.Close()objcmd.Dispose()MsgBox(”删除成功!“)TextBox1.Text = ”“ End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button2.Click Me.Close()End Sub End Class 航线信息代码:
Public Class 航线信息
Inherits System.Windows.Forms.Form #Region ” Windows 窗体设计器生成的代码“ Public Sub New()MyBase.New()'该调用是Windows 窗体设计器所必需的。InitializeComponent()'在InitializeComponent()调用之后添加任何初始化
End Sub '窗体重写dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)If disposing Then If Not(components Is Nothing)Then components.Dispose()End If End If MyBase.Dispose(disposing)End Sub 'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer '注意: 以下过程是Windows 窗体设计器所必需的'可以使用Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents Label6 As System.Windows.Forms.Label Friend WithEvents Label7 As System.Windows.Forms.Label Friend WithEvents Label8 As System.Windows.Forms.Label Friend WithEvents Label9 As System.Windows.Forms.Label Friend WithEvents Label10 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents TextBox3 As System.Windows.Forms.TextBox Friend WithEvents TextBox4 As System.Windows.Forms.TextBox Friend WithEvents TextBox5 As System.Windows.Forms.TextBox Friend WithEvents TextBox6 As System.Windows.Forms.TextBox Friend WithEvents TextBox7 As System.Windows.Forms.TextBox Friend WithEvents TextBox8 As System.Windows.Forms.TextBox Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Label11 As System.Windows.Forms.Label Friend WithEvents TextBox10 As System.Windows.Forms.TextBox Friend WithEvents TextBox9 As System.Windows.Forms.TextBox
'GroupBox1' Me.GroupBox1.Controls.Add(Me.TextBox10)Me.GroupBox1.Controls.Add(Me.TextBox9)Me.GroupBox1.Controls.Add(Me.Label11)Me.GroupBox1.Controls.Add(Me.ComboBox1)Me.GroupBox1.Controls.Add(Me.TextBox8)Me.GroupBox1.Controls.Add(Me.TextBox7)Me.GroupBox1.Controls.Add(Me.TextBox6)Me.GroupBox1.Controls.Add(Me.TextBox5)Me.GroupBox1.Controls.Add(Me.TextBox4)Me.GroupBox1.Controls.Add(Me.TextBox3)Me.GroupBox1.Controls.Add(Me.TextBox2)Me.GroupBox1.Controls.Add(Me.TextBox1)Me.GroupBox1.Controls.Add(Me.Label10)Me.GroupBox1.Controls.Add(Me.Label9)Me.GroupBox1.Controls.Add(Me.Label8)Me.GroupBox1.Controls.Add(Me.Label7)Me.GroupBox1.Controls.Add(Me.Label6)Me.GroupBox1.Controls.Add(Me.Label5)Me.GroupBox1.Controls.Add(Me.Label4)Me.GroupBox1.Controls.Add(Me.Label3)Me.GroupBox1.Controls.Add(Me.Label2)Me.GroupBox1.Controls.Add(Me.Label1)Me.GroupBox1.Font = New System.Drawing.Font(”宋体“, 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))Me.GroupBox1.Location = New System.Drawing.Point(8, 8)Me.GroupBox1.Name = ”GroupBox1“ Me.GroupBox1.Size = New System.Drawing.Size(488, 344)Me.GroupBox1.TabIndex = 0 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = ”航线信息“ '
'TextBox10 ' Me.TextBox10.Location = New System.Drawing.Point(376, 182)Me.TextBox10.Name = ”TextBox10“ Me.TextBox10.Size = New System.Drawing.Size(100, 23)Me.TextBox10.TabIndex = 22 '
'TextBox9 ' Me.TextBox9.Location = New System.Drawing.Point(128, 32)Me.TextBox9.Name = ”TextBox9“ Me.TextBox9.Size = New System.Drawing.Size(100, 23)Me.TextBox9.TabIndex = 21 '
'Label11 Me.Label11.Location = New System.Drawing.Point(24, 32)Me.Label11.Name = ”Label11“ Me.Label11.Size = New System.Drawing.Size(100, 23)Me.Label11.TabIndex = 20 Me.Label11.Text = ”航线编号“ 'ComboBox1 Me.ComboBox1.Location = New System.Drawing.Point(376, 29)Me.ComboBox1.Name = ”ComboBox1“ Me.ComboBox1.Size = New System.Drawing.Size(104, 22)Me.ComboBox1.TabIndex = 18 'TextBox8 ' Me.TextBox8.Location = New System.Drawing.Point(128, 272)Me.TextBox8.Multiline = True Me.TextBox8.Name = ”TextBox8“ Me.TextBox8.ScrollBars = System.Windows.Forms.ScrollBars.Both Me.TextBox8.Size = New System.Drawing.Size(336, 56)Me.TextBox8.TabIndex = 17 'TextBox7 Me.TextBox7.Location = New System.Drawing.Point(130, 237)Me.TextBox7.Name = ”TextBox7“ Me.TextBox7.Size = New System.Drawing.Size(100, 23)Me.TextBox7.TabIndex = 16 'TextBox6 Me.TextBox6.Location = New System.Drawing.Point(376, 237)Me.TextBox6.Name = ”TextBox6“ Me.TextBox6.Size = New System.Drawing.Size(100, 23)Me.TextBox6.TabIndex = 15 'TextBox5 Me.TextBox5.Location = New System.Drawing.Point(128, 182)Me.TextBox5.Name = ”TextBox5“ Me.TextBox5.Size = New System.Drawing.Size(100, 23)Me.TextBox5.TabIndex = 14 'TextBox4 Me.TextBox4.Location = New System.Drawing.Point(128, 131)Me.TextBox4.Name = ”TextBox4“ Me.TextBox4.Size = New System.Drawing.Size(100, 23)Me.TextBox4.TabIndex = 13 'TextBox3 ' Me.TextBox3.Location = New System.Drawing.Point(376, 125)Me.TextBox3.Name = ”TextBox3“ Me.TextBox3.Size = New System.Drawing.Size(100, 23)Me.TextBox3.TabIndex = 12 'TextBox2 Me.TextBox2.Location = New System.Drawing.Point(376, 72)Me.TextBox2.Name = ”TextBox2“ Me.TextBox2.Size = New System.Drawing.Size(100, 23)Me.TextBox2.TabIndex = 11'
'TextBox1 Me.TextBox1.Location = New System.Drawing.Point(128, 72)Me.TextBox1.Name = ”TextBox1“ Me.TextBox1.Size = New System.Drawing.Size(100, 23)Me.TextBox1.TabIndex = 10 'Label10' Me.Label10.Location = New System.Drawing.Point(24, 288)Me.Label10.Name = ”Label10“ Me.Label10.Size = New System.Drawing.Size(88, 23)Me.Label10.TabIndex = 9 Me.Label10.Text = ”备注信息“ 'Label9 Me.Label9.Location = New System.Drawing.Point(24, 240)Me.Label9.Name = ”Label9“ Me.Label9.Size = New System.Drawing.Size(100, 23)Me.Label9.TabIndex = 8 Me.Label9.Text = ”头等舱价格“ 'Label8 Me.Label8.Location = New System.Drawing.Point(270, 237)Me.Label8.Name = ”Label8“ Me.Label8.Size = New System.Drawing.Size(100, 23)Me.Label8.TabIndex = 7 Me.Label8.Text = ”公务舱价格“ 'Label7 Me.Label7.Location = New System.Drawing.Point(270, 185)Me.Label7.Name = ”Label7“ Me.Label7.Size = New System.Drawing.Size(100, 23)Me.Label7.TabIndex = 6 Me.Label7.Text = ”经济舱价格“ 'Label6 Me.Label6.Location = New System.Drawing.Point(22, 185)Me.Label6.Name = ”Label6“ Me.Label6.Size = New System.Drawing.Size(100, 23)Me.Label6.TabIndex = 5 Me.Label6.Text = ”客机编号“ 'Label5 Me.Label5.Location = New System.Drawing.Point(24, 131)Me.Label5.Name = ”Label5“ Me.Label5.Size = New System.Drawing.Size(100, 23)Me.Label5.TabIndex = 4 Me.Label5.Text = ”出发时间“ 'Label4 Me.Label4.Location = New System.Drawing.Point(270, 128)Me.Label4.Name = ”Label4“ Me.Label4.Size = New System.Drawing.Size(100, 23)Me.Label4.TabIndex = 3 Me.Label4.Text = ”到达时间“ 'Label3' Me.Label3.Location = New System.Drawing.Point(270, 35)Me.Label3.Name = ”Label3“ Me.Label3.Size = New System.Drawing.Size(100, 23)Me.Label3.TabIndex = 2 Me.Label3.Text = ”航班日期“ 'Label2 Me.Label2.Location = New System.Drawing.Point(270, 80)Me.Label2.Name = ”Label2“ Me.Label2.Size = New System.Drawing.Size(100, 23)Me.Label2.TabIndex = 1 Me.Label2.Text = ”到达城市“ 'Label1' Me.Label1.Location = New System.Drawing.Point(24, 77)Me.Label1.Name = ”Label1“ Me.Label1.Size = New System.Drawing.Size(88, 24)Me.Label1.TabIndex = 0 Me.Label1.Text = ”出发城市“'
'Button1 ' Me.Button1.Font = New System.Drawing.Font(”宋体“, 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))Me.Button1.Location = New System.Drawing.Point(104, 360)Me.Button1.Name = ”Button1“ Me.Button1.Size = New System.Drawing.Size(104, 40)Me.Button1.TabIndex = 1 Me.Button1.Text = ”保存“ 'Button2 Me.Button2.Font = New System.Drawing.Font(”宋体“, 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))Me.Button2.Location = New System.Drawing.Point(280, 360)Me.Button2.Name = ”Button2“ Me.Button2.Size = New System.Drawing.Size(104, 40)Me.Button2.TabIndex = 2 Me.Button2.Text = ”返回“ '
'航线信息
' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)Me.ClientSize = New System.Drawing.Size(504, 414)Me.Controls.Add(Me.Button2)Me.Controls.Add(Me.Button1)Me.Controls.Add(Me.GroupBox1)Me.Icon = CType(resources.GetObject(”$this.Icon“), System.Drawing.Icon)Me.Name = ”航线信息“ Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = ”航线信息“ Me.GroupBox1.ResumeLayout(False)Me.GroupBox1.PerformLayout()Me.ResumeLayout(False)End Sub #End Region Private Sub 航线信息_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles MyBase.Load ct = 31 class1.init()TextBox9.Focus()If(mytemp = 0)Then Button1.Text = ”添加“ Else Button1.Text = ”修改“ End If Dim ds As DataSet Dim con As String Dim count, i As Integer con = ”select * from airlineinfo“ ds = class1.query(con)count = ds.Tables(0).Rows.Count For i = 0 To count-2 class1.dr = ds.Tables(0).Rows(i)ComboBox1.Items.Add(Trim(CStr(class1.dr(”航班日期“))))Next End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button1.Click Dim con As String Dim con1 As String Dim ano, dd, dt, at, pno, cp, cap, fp As String Dim dc, ac, am As String Dim signe As Integer = 1 ano = TextBox9.Text dc = TextBox1.Text ac = TextBox2.Text dd = ComboBox1.Text pno = TextBox10.Text dt = TextBox3.Text at = TextBox4.Text cp = TextBox5.Text cap = TextBox6.Text fp = TextBox7.Text am = TextBox8.Text con = ”select * from airlineinfo where 航线编号='“ + TextBox9.Text + ”'“ Dim ds As DataSet Try ds = class1.query(con)Catch ex As Exception MessageBox.Show(ex.Message)End Try Try If(ds.Tables(0).Rows.Count > 0 And mytemp = 0)Then class1.dr = ds.Tables(0).Rows(0)If class1.dr(”航线编号“)> 0 Then MsgBox(”已存在该航线!“)TextBox9.Focus()signe = 0 End If End If Catch ex As Exception MessageBox.Show(ex.Message)End Try If TextBox9.Text = ”“ Then MsgBox(”航线编号不能为空!“)TextBox9.Focus()ElseIf(signe = 1 Or mytemp = 1)Then con1 = ”delete from airlineinfo where 航线编号='“ + TextBox9.Text + ”'“ con = ”insert into airlineinfo values('“ + ano + ”','“ + dc + ”','“ + ac + ”','“ + dd + ”','“ + dt + ”','“ + at + ”','“ + pno + ”','“ + cp + ”','“ + cap + ”','“ + fp + ”','“ + am + ”')“ Try class1.delete(con1)Catch ex As Exception MessageBox.Show(ex.Message)End Try Try class1.update(con)If(mytemp = 0)Then MsgBox(”添加成功!“)End If If(mytemp = 1)Then MsgBox(”修改成功!“)End If Catch ex As Exception MessageBox.Show(ex.Message)End Try TextBox1.Text = ”“ TextBox2.Text = ”“ TextBox3.Text = ”“ TextBox4.Text = ”“ TextBox5.Text = ”“ TextBox6.Text = ”“ TextBox7.Text = ”“ TextBox8.Text = ”“ TextBox9.Text = ”“ ComboBox1.Text = ”“ TextBox10.Text = ”“ End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button2.Click Me.Close()End Sub Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles GroupBox1.Enter End Sub End Class 添加用户代码:
Public Class 添加用户
Inherits System.Windows.Forms.Form #Region ” Windows 窗体设计器生成的代码“ Public Sub New()MyBase.New()'该调用是Windows 窗体设计器所必需的。InitializeComponent()'在InitializeComponent()调用之后添加任何初始化
End Sub '窗体重写dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)If disposing Then If Not(components Is Nothing)Then components.Dispose()End If End If MyBase.Dispose(disposing)End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer '注意: 以下过程是Windows 窗体设计器所必需的'可以使用Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents TextBox3 As System.Windows.Forms.TextBox Friend WithEvents TextBox4 As System.Windows.Forms.TextBox Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button
'Label2 Me.Label2.Font = New System.Drawing.Font(”宋体“, 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))Me.Label2.Location = New System.Drawing.Point(55, 84)Me.Label2.Name = ”Label2“ Me.Label2.Size = New System.Drawing.Size(100, 23)Me.Label2.TabIndex = 1 Me.Label2.Text = ”姓名“ 'Label3 Me.Label3.Font = New System.Drawing.Font(”宋体“, 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))Me.Label3.Location = New System.Drawing.Point(55, 121)Me.Label3.Name = ”Label3“ Me.Label3.Size = New System.Drawing.Size(100, 23)Me.Label3.TabIndex = 2 Me.Label3.Text = ”新密码“ 'Label4 Me.Label4.Font = New System.Drawing.Font(”宋体“, 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))Me.Label4.Location = New System.Drawing.Point(55, 168)Me.Label4.Name = ”Label4“ Me.Label4.Size = New System.Drawing.Size(100, 23)Me.Label4.TabIndex = 3 Me.Label4.Text = ”确认密码“ 'TextBox1 Me.TextBox1.Location = New System.Drawing.Point(224, 32)Me.TextBox1.Name = ”TextBox1“ Me.TextBox1.Size = New System.Drawing.Size(100, 21)Me.TextBox1.TabIndex = 4 'TextBox2 Me.TextBox2.Location = New System.Drawing.Point(224, 72)Me.TextBox2.Name = ”TextBox2“ Me.TextBox2.Size = New System.Drawing.Size(100, 21)Me.TextBox2.TabIndex = 5 'TextBox3 Me.TextBox3.Location = New System.Drawing.Point(224, 120)Me.TextBox3.Name = ”TextBox3“ Me.TextBox3.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)Me.TextBox3.Size = New System.Drawing.Size(100, 21)Me.TextBox3.TabIndex = 6 'TextBox4 Me.TextBox4.Location = New System.Drawing.Point(224, 168)Me.TextBox4.Name = ”TextBox4“ Me.TextBox4.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)Me.TextBox4.Size = New System.Drawing.Size(100, 21)Me.TextBox4.TabIndex = 7'
'Button1 ' Me.Button1.Font = New System.Drawing.Font(”宋体“, 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))Me.Button1.Location = New System.Drawing.Point(48, 208)Me.Button1.Name = ”Button1“ Me.Button1.Size = New System.Drawing.Size(88, 40)Me.Button1.TabIndex = 8 Me.Button1.Text = ”确定“ 'Button2 Me.Button2.Font = New System.Drawing.Font(”宋体“, 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))Me.Button2.Location = New System.Drawing.Point(240, 208)Me.Button2.Name = ”Button2“ Me.Button2.Size = New System.Drawing.Size(88, 40)Me.Button2.TabIndex = 9 Me.Button2.Text = ”取消“ '添加用户 ' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)Me.ClientSize = New System.Drawing.Size(392, 270)Me.Controls.Add(Me.Button2)Me.Controls.Add(Me.Button1)Me.Controls.Add(Me.TextBox4)Me.Controls.Add(Me.TextBox3)Me.Controls.Add(Me.TextBox2)Me.Controls.Add(Me.TextBox1)Me.Controls.Add(Me.Label4)Me.Controls.Add(Me.Label3)Me.Controls.Add(Me.Label2)Me.Controls.Add(Me.Label1)Me.Icon = CType(resources.GetObject(”$this.Icon“), System.Drawing.Icon)Me.Name = ”添加用户“ Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = ”添加用户“ Me.ResumeLayout(False)Me.PerformLayout()End Sub #End Region Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button1.Click class1.init()Dim con As String Dim user, name As String Dim pw1, pw2 As String Dim ds As DataSet Dim signe As Integer = 1 user = TextBox1.Text name = TextBox2.Text pw1 = TextBox3.Text pw2 = TextBox4.Text con = ”select * from users where id='“ + TextBox1.Text + ”'“ ds = class1.query(con)Try If(ds.Tables(0).Rows.Count > 0)Then class1.dr = ds.Tables(0).Rows(0)If class1.dr(”id“)<> ”“ Then MsgBox(”已存在用户!“)TextBox1.SelectAll()TextBox1.Focus()TextBox2.Clear()TextBox3.Clear()TextBox4.Clear()signe = 0 End If End If Catch ex As Exception MessageBox.Show(ex.Message)End Try If(TextBox3.Text <> TextBox4.Text)Then MessageBox.Show(”密码不一致,请重新确认“, ”提示“)TextBox3.SelectAll()TextBox3.Focus()TextBox4.Clear()signe = 0 End If If Trim(TextBox1.Text)= ”“ Then MsgBox(”用户名不能为空!“)Exit Sub TextBox1.Focus()ElseIf(signe = 1)Then con = ”insert into users values('“ + user + ”','“ + pw2 + ”','“ + name + ”','null')“ class1.insert(con)MsgBox(”添加成功!")End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button2.Click Me.Close()End Sub Private Sub 添加用户_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles MyBase.Load ct = 0 End Sub
End Class
第二篇:航空售票管理系统
#include
typedef struct node//定义信息结构体 {
char num[10];// 航班号
int hour;//起飞时间小时
int minitues;//起飞时间分钟
char start[10];//起始
char end[10];//终点
float prize;//经济舱票价
int last;//剩余座位 }FLIGHT;
typedef struct Order//订单信息 {
char name[10];//乘客姓名
char num[10];//航班号
int count;//订票数量 }Order;
class flight//定义类 {
private: FLIGHT stu[N];//每个元素对应一条信息
Order psg[N];//订单
int len;//航班总数
int lenp;//订票者总数 public:
flight();
~flight();void input();//录入信息
void show();//浏览
void sall();//售票
void back();//退票
void search();// 信息查询
void search2();// 信息查询(起点终点)
char menu();//菜单
};
flight stud;
char filename[]=“flight.txt”;
flight::flight(){}//构造函数 flight::~flight(){}//析构函数
bool CheckTime(int h1,int m1,int h2,int m2)//判断两个时间前后
{ if(h1
return true;else if(h1==h2){
if(m1 return true; else return false;} else return false;} void flight::show()//浏览 { system(“cls”);//清屏 cout<<“ 所有航班信息如下:”< 起飞时间 起点 终点 经济舱票价 剩余座位 备注”< for(int i=0;i printf(“%-10s%-2.2d:%-2.2d %-10s%-10s%-12.2f%-10d”,stu[i].num,stu[i].hour,stu[i].minitues,stu[i].start,stu[i].end,stu[i].prize,stu[i].last); time_t t; struct tm *tm; t=time(NULL);//获取当前系统时间 tm=localtime(&t); if(CheckTime(stud.stu[i].hour,stud.stu[i].minitues,tm->tm_hour,tm->tm_min)==true)//如果起飞时间在当前时间之前 输出此次航班已发出 cout<<“此次航班已发出”< else cout< } cout<<“_______________________________________________________________________________”< void flight::back()//退票 { char name[20]; char s[20]; system(“cls”);//清屏 cout<<“请输入退票的航班编号:”;cin>>s; for(int i=0;i if(strcmp(stud.stu[i].num,s)==0) break;//存在 结束循环 if(i==stud.len)//这二者相等说明查找完所有信息也没找到输入信息,说明输入航班编号不存在{ cout<<“对不起!没有你输入航班编号的相关信息。n”; system(“pause”);//任意键继续 return;} time_t t; struct tm *tm; t=time(NULL);//获取当前系统时间 tm=localtime(&t);if(CheckTime(stud.stu[i].hour,stud.stu[i].minitues,tm->tm_hour,tm->tm_min)==true) { cout<<“对不起!该航班已经起飞。不能退票。n”; system(“pause”);//任意键继续 return;} int j=i; cout<<“请输入您的姓名:”;cin>>name;for(i=0;i if(strcmp(stud.psg[i].name,name)==0 && strcmp(stud.psg[i].num,s)==0)//查询这个名字是否相同 { stud.stu[j].last+=stud.psg[i].count;//退票 stud.psg[i]=stud.psg[stud.lenp-1];///删除这个订单 stud.lenp--;//订单数减一 cout<<“退票成功!n”; system(“pause”);//任意键继续 return; } } cout<<“对不起!您没有定该航班的票。n”; system(“pause”);//任意键继续 } void flight::sall()//售票 { char s[20]; system(“cls”);//清屏 cout<<“请输入要购买的航班编号:”;cin>>s; for(int i=0;i if(strcmp(stud.stu[i].num,s)==0) break;//存在 结束循环 if(i==stud.len)//这二者相等说明查找完所有信息也没找到输入信息,说明输入航班编号不存在{ cout<<“对不起!没有你输入航班编号的相关信息。n”; system(“pause”);//任意键继续 return;} if(stud.stu[i].last<=0)//没有票了 { cout<<“对不起!该航班票已售完。n”; system(“pause”);//任意键继续 return;} time_t t; struct tm *tm; t=time(NULL);//获取当前系统时间 tm=localtime(&t);if(CheckTime(stud.stu[i].hour,stud.stu[i].minitues,tm->tm_hour,tm->tm_min)==true) { cout<<“对不起!该航班已经起飞。n”; system(“pause”);//任意键继续 return;} int j=i;i=stud.lenp;strcpy(stud.psg[i].num,stud.stu[i].num);cout<<“请输入购票数量:”;cin>>stud.psg[i].count; while(stud.psg[i].count>stud.stu[i].last){ cout<<“余票不足,请重新输入:”; cin>>stud.psg[i].count; } cout<<“请输入您的姓名:”;cin>>stud.psg[i].name; stud.stu[j].last-=stud.psg[i].count;//剩余票数 stud.lenp++;cout<<“购票成功!n”;system(“pause”);//任意键继续 } void flight::input()//录入信息 { system(“cls”);//清屏 for(int i=stud.len;i { cout<<“请输入航班号:”; cin>>stud.stu[i].num; cout<<“请输入起飞时间(格式: 12:30):”; char ch; cin>>stud.stu[i].hour>>ch>>stud.stu[i].minitues; cout<<“请输入起点:”; cin>>stud.stu[i].start; cout<<“请输入终点:”; cin>>stud.stu[i].end; cout<<“请输入经济舱票价:”; cin>>stud.stu[i].prize; cout<<“请输入剩余座位:”; cin>>stud.stu[i].last; stud.len++;//个数加1 cout<<“一条航班信息录入完成,是否继续录入?(y/n):”; while(1) { cin>>ch; if(ch=='y' || ch=='Y' || ch=='n' || ch=='N') break; else cout<<“输入错误请重新输入:”; } if(ch=='n' || ch=='N') break; } } void flight::search()// 信息查询 { char s[20]; system(“cls”);//清屏 cout<<“请输入要查询的航班编号:”;cin>>s; for(int i=0;i if(strcmp(stud.stu[i].num,s)==0) break;//存在 结束循环 if(i==stud.len)//这二者相等说明查找完所有信息也没找到输入信息,说明输入航班编号不存在{ cout<<“对不起!没有你输入航班编号的相关信息。n”; system(“pause”);//任意键继续 return;} cout<<“ 查询结果如下:”< 起飞时间 起点 终点 经济舱票价 剩余座位 备注”< printf(“%-10s%-2.2d:%-2.2d %-10s%-10s%-12.2f%-10d”,stu[i].num,stu[i].hour,stu[i].minitues,stu[i].start,stu[i].end,stu[i].prize,stu[i].last); time_t t; struct tm *tm; t=time(NULL);//获取当前系统时间 tm=localtime(&t); if(CheckTime(stud.stu[i].hour,stud.stu[i].minitues,tm->tm_hour,tm->tm_min)==true)//如果起飞时间在当前时间之前 输出此次航班已发出 cout<<“此次航班已发出”< else cout< cout<<“_______________________________________________________________________________”< void flight::search2()// 信息查询(按线路){ char s1[20],s2[20]; system(“cls”);//清屏 cout<<“请输入要查询的线路起点:”;cin>>s1; cout<<“请输入要查询的线路终点:”;cin>>s2; for(int i=0;i if(strcmp(stud.stu[i].start,s1)==0 && strcmp(stud.stu[i].end,s2)==0) break;//存在 结束循环 if(i==stud.len)//这二者相等说明查找完所有信息也没找到输入信息,说明输入航班编号不存在{ cout<<“对不起!没有你输入线路的相关信息。n”; system(“pause”);//任意键继续 return;} cout<<“ 查询结果如下:”< 起飞时间 起点 终点 经济舱票价 剩余座位 备注”< for(i=0;i if(strcmp(stud.stu[i].start,s1)==0 && strcmp(stud.stu[i].end,s2)==0) { printf(“%-10s%-2.2d:%-2.2d %-10s%-10s%-12.2f%-10d”,stu[i].num,stu[i].hour,stu[i].minitues,stu[i].start,stu[i].end,stu[i].prize,stu[i].last); time_t t; struct tm *tm; t=time(NULL);//获取当前系统时间 tm=localtime(&t); if(CheckTime(stud.stu[i].hour,stud.stu[i].minitues,tm->tm_hour,tm->tm_min)==true)//如果起飞时间在当前时间之前 输出此次航班已发出 cout<<“此次航班已发出”< else cout< } cout<<“_______________________________________________________________________________”< char flight::menu()//菜单 { char c; system(“cls”);//清屏 cout<<“nnnn ╔═══════════════════════════╗n”;cout<<“ ║ 1、录入航班信息 ║n”; cout<<“ ╠═══════════════════════════╣n”;cout<<“ ║ 2、浏览航班信息 ║n”;cout<<“ ╠═══════════════════════════╣n”; cout<<“ ║ 3、查询路线(按编号) ║n”; cout<<“ ╠═══════════════════════════╣n”;cout<<“ ║ 4、查询路线(按线路) ║n”; cout<<“ ╠═══════════════════════════╣n”;cout<<“ ║ 5、售票 ║n”; cout<<“ ╠═══════════════════════════╣n”;cout<<“ ║ 6、退票 ║n”; cout<<“ ╠═══════════════════════════╣n”;cout<<“ ║ 0、退出系统 ║n”; cout<<“ ╚═══════════════════════════╝n”;cout<<“ 请选择:”; cin>>c; return c;} int main(){ while(1) { char ch; ch=stud.menu();//获取选择 switch(ch) { case '1': stud.input();break;//录入航班信息 case '2': stud.show();break;//浏览航班信息 case '3': stud.search();break;// 查询路线 case '4': stud.search2();break;// 查询路线(按线路) case '5': stud.sall();break;// 售票 case '6': stud.back(); break;// 退票 case '0': exit(0);//退出 } } return 0;} public FlightBook() //构造函数 { super(“航空订票”);this.setSize(600,400);this.setLocation(300,240);this.setResizable(false);this.setVisible(true);this.setLayout(new BorderLayout());JPanel panel=new JPanel(new GridLayout(11,1));this.add(panel,BorderLayout.WEST);this.setBackground(Color.blue); button_ask=new JButton(“查询”);panel.add(button_ask);button_ask.addActionListener(this); button_book=new JButton(“订票”);panel.add(button_book);button_book.addActionListener(this); button_cancel=new JButton(“退票”);panel.add(button_cancel);button_cancel.addActionListener(this); text_user=new JTextArea();this.add(text_user,BorderLayout.CENTER); frame_cx=new JFrame(“输入”); //查询输入框 frame_cx.setSize(280,120);frame_cx.setResizable(false);frame_cx.setBackground(Color.LIGHT_GRAY);frame_cx.setLayout(new FlowLayout());frame_cx.add(new JLabel(“终点站:”));text_field1=new JTextField(20);frame_cx.add(text_field1);button_ok1=new JButton(“ok”);frame_cx.add(button_ok1);button_ok1.addActionListener(this);frame_cx.addWindowListener(this); frame_dp=new JFrame(“输入”); //订票输入框 frame_dp.setSize(350,150);frame_dp.setResizable(false);frame_dp.setBackground(Color.LIGHT_GRAY);frame_dp.setLayout(new FlowLayout());frame_dp.add(new JLabel(“ 航班号:”));text_field2=new JTextField(20);frame_dp.add(text_field2);frame_dp.add(new JLabel(“ 订票数:”));text_field3=new JTextField(20);frame_dp.add(text_field3);button_ok2=new JButton(“确定”);frame_dp.add(button_ok2); button_ok2.addActionListener(this);frame_dp.addWindowListener(this); frame_tp=new JFrame(“输入”); //退票输入框 frame_tp.setSize(350,150);frame_tp.setResizable(false);frame_tp.setBackground(Color.LIGHT_GRAY);frame_tp.setLayout(new FlowLayout());frame_tp.add(new JLabel(“ 日期 :”));text_field4=new JTextField(20);frame_tp.add(text_field4);frame_tp.add(new JLabel(“ 航班号:”));text_field5=new JTextField(20);frame_tp.add(text_field5);button_ok3=new JButton(“正确”);frame_tp.add(button_ok3);button_ok3.addActionListener(this);frame_tp.addWindowListener(this); dialog_cx=new JDialog(this,“提示”,true); //提示查询输入航线未开通错误 dialog_cx.setSize(240,80);label=new JLabel(“此站点未开通航线,请重新输入!”);dialog_cx.add(label);dialog_cx.setLayout(new FlowLayout(FlowLayout.CENTER)); dialog_cx.addWindowListener(this); frame_dpsx=new JFrame(“订票手续”); //订票手续 frame_dpsx.setSize(250,200);frame_dpsx.setResizable(false);frame_dpsx.setBackground(Color.LIGHT_GRAY);frame_dpsx.setLayout(new FlowLayout(FlowLayout.CENTER));frame_dpsx.add(new JLabel(“ 姓名 :”));text_fielddp_name=new JTextField(10);frame_dpsx.add(text_fielddp_name);frame_dpsx.add(new JLabel(“ 航班号 :”));text_fielddp_hbh=new JTextField(10);frame_dpsx.add(text_fielddp_hbh);frame_dpsx.add(new JLabel(“ 订票数 :”));text_fielddp_number=new JTextField(10);frame_dpsx.add(text_fielddp_number);frame_dpsx.add(new JLabel(“联系方式 :”));text_fielddp_lxfs=new JTextField(10);frame_dpsx.add(text_fielddp_lxfs);button_tj=new JButton(“提交”);frame_dpsx.add(button_tj);button_tj.addActionListener(this); frame_djsx=new JFrame(“登记手续”); //登记手续 frame_djsx.setSize(250,200);frame_djsx.setResizable(false); frame_djsx.setBackground(Color.LIGHT_GRAY);frame_djsx.setLayout(new FlowLayout(FlowLayout.CENTER));frame_djsx.add(new JLabel(“ 姓名 :”));text_fielddj_name=new JTextField(10);frame_djsx.add(text_fielddj_name);frame_djsx.add(new JLabel(“ 航班号 :”));text_fielddj_hbh=new JTextField(10);frame_djsx.add(text_fielddj_hbh);frame_djsx.add(new JLabel(“ 订票数 :”));text_fielddj_number=new JTextField(10);frame_djsx.add(text_fielddj_number);frame_djsx.add(new JLabel(“联系方式 :”));text_fielddj_lxfs=new JTextField(10);frame_djsx.add(text_fielddj_lxfs);button_wc=new JButton(“完成”);frame_djsx.add(button_wc);button_wc.addActionListener(this); frame_tpsx=new JFrame(“退票手续”); //退票手续 frame_tpsx.setSize(250,200);frame_tpsx.setResizable(false);frame_tpsx.setBackground(Color.LIGHT_GRAY);frame_tpsx.setLayout(new FlowLayout(FlowLayout.CENTER));frame_tpsx.add(new JLabel(“ 姓名 :”));text_fieldtp_name=new JTextField(10);frame_tpsx.add(text_fieldtp_name);frame_tpsx.add(new JLabel(“ 航班号 :”)); text_fieldtp_hbh=new JTextField(10);frame_tpsx.add(text_fieldtp_hbh);frame_tpsx.add(new JLabel(“ 退票数 :”));text_fieldtp_number=new JTextField(10);frame_tpsx.add(text_fieldtp_number);frame_tpsx.add(new JLabel(“联系方式 :”));text_fieldtp_lxfs=new JTextField(10);frame_tpsx.add(text_fieldtp_lxfs);button_cg=new JButton(“成功”);frame_tpsx.add(button_cg);button_cg.addActionListener(this); dialog_dpwk=new JDialog(this,“提示”,true); //提示订票输入未开通航线错误 dialog_dpwk.setSize(350,80);label=new JLabel(“此站点未开通航线,请查询后重新输入!”);dialog_dpwk.add(label);dialog_dpwk.setLayout(new FlowLayout(FlowLayout.CENTER));dialog_dpwk.addWindowListener(this); dialog_dpyk=new JDialog(this,“提示”,true); //提示订票输入票额不足错误 dialog_dpyk.setSize(350,150);label1=new JLabel(“此站点已满员或余票不足,请查询后重新输入!”);dialog_dpyk.add(label1); 错误 } label2=new JLabel(“ 若需要,可登记排队候补”);dialog_dpyk.add(label2);button_sq=new JButton(“登记”);button_sq.addActionListener(this);dialog_dpyk.add(button_sq);dialog_dpyk.setLayout(new FlowLayout(FlowLayout.CENTER));dialog_dpyk.addWindowListener(this); dialog_tpts=new JDialog(this,“提示”,true); //提示退票输入日期和航班号矛盾dialog_tpts.setSize(350,80);label=new JLabel(“您输入的日期无此航班号,请查询后重新输入!”);dialog_tpts.add(label);dialog_tpts.setLayout(new FlowLayout(FlowLayout.CENTER));dialog_tpts.addWindowListener(this); d=new JDialog(this,“提示”,true); //当退票满足客户,提示联系该客户 d.setSize(350,150);d.setLayout(new FlowLayout(FlowLayout.CENTER));d.addWindowListener(this); this.addWindowListener(this);this.setVisible(true);4.1.2 软件的查询、订票和退票模块 查询截图: 查询成功截图: 订票截图: 退票截图: public void actionPerformed(ActionEvent e){ String s=e.getActionCommand();if(s==“查询”){ frame_cx.setLocation(this.getX()+100,this.getY()+100);frame_cx.setVisible(true);} if(s==“订票”){ frame_dp.setLocation(this.getX()+100,this.getY()+100);frame_dp.setVisible(true);} if(s==“退票”){ frame_tp.setLocation(this.getX()+100,this.getY()+100);frame_tp.setVisible(true);} if(s==“ok”){ if(text_field1.getText().toString().trim().equals(“北京”)){ text_user.append(“地点:”+F_name[0]+“ 航班号:”+H_number[0]+“ 飞机号:”+F_number[0]+“ 时间:”+time[0]+“ ”+Price[0]+“ 余票量:”+Count[0]+“n”); 价格: } else if(text_field1.getText().toString().trim().equals(“香港”)){ text_user.append(“地点:”+F_name[1]+“ 航班号:”+H_number[1]+“ 飞机号:”+F_number[1]+“ 时间:”+time[1]+“ 价格:”+Price[1]+“ 余票量:”+Count[1]+“n”);} else if(text_field1.getText().toString().trim().equals(“澳门”)){ text_user.append(“地点:”+F_name[2]+“ 航班号:”+H_number[2]+“ 飞机号:”+F_number[2]+“ 时间:”+time[2]+“ ”+Price[2]+“ 余票量:”+Count[2]+“n”);} else if(text_field1.getText().toString().trim().equals(“纽约”)){ text_user.append(“地点:”+F_name[3]+“ 航班号:”+H_number[3]+“ 飞机号:”+F_number[3]+“ 时间:”+time[3]+“ ”+Price[3]+“ 余票量:”+Count[3]+“n”);} else if(text_field1.getText().toString().trim().equals(“悉尼”)){ text_user.append(“地点:”+F_name[4]+“ 航班号:”+H_number[4]+“ 飞机号:”+F_number[4]+“ 时间:”+time[4]+“ ”+Price[4]+“ 余票量:”+Count[4]+“n”);} else { dialog_cx.setLocation(this.getX()+100,this.getY()+100); dialog_cx.setVisible(true);} 价格:价格:价格: } frame_cx.setVisible(false);if(s==“确定”){ String Hnumber=text_field2.getText().toString().trim();int Dcount=Integer.parseInt(text_field3.getText().toString().trim());if(Hnumber.equals(“CAC”)||Hnumber.equals(“cac”)){ if(Dcount<=Count[0]){ Count[0]-=Dcount; frame_dpsx.setLocation(this.getX()+100,this.getY()+100);frame_dpsx.setVisible(true); } else { dialog_dpyk.setLocation(this.getX()+100,this.getY()+100);dialog_dpyk.setVisible(true); } else if(Hnumber.equals(“CFC”)||Hnumber.equals(“cfc”)&&Dcount<=Count[1]){ if(Dcount<=Count[1]){ Count[0]-=Dcount;} frame_dpsx.setLocation(this.getX()+100,this.getY()+100);frame_dpsx.setVisible(true); } else { dialog_dpyk.setLocation(this.getX()+100,this.getY()+100);dialog_dpyk.setVisible(true);} } else if(Hnumber.equals(“CDA”)||Hnumber.equals(“cda”)&&Dcount<=Count[2]) { if(Dcount<=Count[2]){ Count[0]-=Dcount; frame_dpsx.setLocation(this.getX()+100,this.getY()+100);frame_dpsx.setVisible(true); } else { dialog_dpyk.setLocation(this.getX()+100,this.getY()+100);dialog_dpyk.setVisible(true);} } else if(Hnumber.equals(“CCX”)||Hnumber.equals(“ccx”)&&Dcount<=Count[3]) { if(Dcount<=Count[3]){ Count[0]-=Dcount; frame_dpsx.setLocation(this.getX()+100,this.getY()+100);frame_dpsx.setVisible(true); } else { dialog_dpyk.setLocation(this.getX()+100,this.getY()+100);dialog_dpyk.setVisible(true);} } else if(Hnumber.equals(“MCM”)||Hnumber.equals(“mcm”)&&Dcount<=Count[4]) { if(Dcount<=Count[4]){ Count[0]-=Dcount; frame_dpsx.setLocation(this.getX()+100,this.getY()+100);frame_dpsx.setVisible(true); } else { dialog_dpyk.setLocation(this.getX()+100,this.getY()+100);dialog_dpyk.setVisible(true); } if(e.getActionCommand()==“提交”){ frame_dpsx.setVisible(false);else { } frame_dp.setVisible(false);dialog_dpwk.setLocation(this.getX()+100,this.getY()+100);dialog_dpwk.setVisible(true);} } } if(e.getActionCommand()==“登记”){ dialog_dpyk.setVisible(false);frame_djsx.setLocation(this.getX()+100,this.getY()+100);frame_djsx.setVisible(true);} if(e.getActionCommand()==“完成”){ int Wait_number=Integer.parseInt(text_fielddj_number.getText().toString().trim());Wait_name[Wait_i]=text_fielddj_name.getText().toString().trim();Wait_hbh[Wait_i]=text_fielddj_hbh.getText().toString().trim();Wait_count[Wait_i]=Wait_number;Wait_xl[Wait_i]=Wait_i;Wait_lxfs[Wait_i]=text_fielddj_lxfs.getText().toString().trim();frame_djsx.setVisible(false);text_user.append(“登记姓名 :”+Wait_name[Wait_i]+“ 登记航班号 :”+Wait_hbh[Wait_i]+“ 登记订票数量 :”+Wait_count[Wait_i]+“ 联系方式 ”+Wait_lxfs[Wait_i]+“n”);Wait_i++;} if(e.getActionCommand()==“正确”){ String a=text_field4.getText().toString().trim();String b=text_field5.getText().toString().trim();if(a.equals(“周三 :”)&&b.equals(“cfc”)||b.equals(“CFC”)||b.equals(“ccx”)||b.equals(“CCX”)){ } else if(a.equals(“周日 ”)&&b.equals(“cda”)||b.equals(“CDA”)||b.equals(“mcm”)||b.equals(“MCM”)){ frame_tpsx.setLocation(this.getX()+100,this.getY()+100);frame_tpsx.setLocation(this.getX()+100,this.getY()+100);frame_tpsx.setVisible(true);frame_tpsx.setVisible(true);} else if(a.equals(“周五”)&&b.equals(“cac”)||b.equals(“CAC”)){ frame_tpsx.setLocation(this.getX()+100,this.getY()+100);frame_tpsx.setVisible(true);} else { dialog_tpts.setLocation(this.getX()+100,this.getY()+100);dialog_tpts.setVisible(true);} frame_tp.setVisible(false); } if(e.getActionCommand()==“成功”){ int i=0;int j=0;String c=text_fieldtp_hbh.getText().toString().trim();int Numb=Integer.parseInt(text_fieldtp_number.getText().toString().trim());frame_tpsx.setVisible(false);if(c.equals(“cac”)||c.equals(“CAC”)){ Count[0]+=Numb; if(Wait_i>0){ for(i=0;i if(Wait_hbh[i].equals(“cac”)||Wait_hbh[i].equals(“CAC”)&&Wait_count[i]<=Count[0]) { j=i+1; label=new JLabel(j+“号客户: ”+Wait_name[i]+“ 满足订票要求,联系方式是:”+Wait_lxfs[i]);d.add(label);d.setLocation(this.getX()+100,this.getY()+100);d.setVisible(true);} } } } else if(c.equals(“cfc”)||c.equals(“CFC”)){ Count[1]+=Numb;if(Wait_i>0){ for(i=0;i if(Wait_hbh[i].equals(“cfc”)||Wait_hbh[i].equals(“CFC”)&&Wait_count[i]<=Count[0]) { j=i+1; label=new JLabel(j+“号客户: ”+Wait_name[i]+“ 满足订票要求,联系方式是:”+Wait_lxfs[i]);d.add(label);d.setLocation(this.getX()+100,this.getY()+100);d.setVisible(true);} } } } else if(c.equals(“cda”)||c.equals(“CDA”)){ Count[2]+=Numb;if(Wait_i>0){ for(i=0;i if(Wait_hbh[i].equals(“cda”)||Wait_hbh[i].equals(“CDA”)&&Wait_count[i]<=Count[0]) { j=i+1; label=new JLabel(j+“号客户: ”+Wait_name[i]+“ 满足订票要求,联系方式是:”+Wait_lxfs[i]);d.add(label);d.setLocation(this.getX()+100,this.getY()+100);d.setVisible(true);} } } } else if(c.equals(“ccx”)||c.equals(“CCX”)){ Count[3]+=Numb;if(Wait_i>0){ for(i=0;i if(Wait_hbh[i].equals(“ccx”)||Wait_hbh[i].equals(“CCX”)&&Wait_count[i]<=Count[0]) { j=i+1; label=new JLabel(j+“号客户: ”+Wait_name[i]+“ 满足订票要求,联系方式是:”+Wait_lxfs[i]);d.add(label);d.setLocation(this.getX()+100,this.getY()+100);d.setVisible(true);} } } } else if(c.equals(“mcm”)||c.equals(“MCM”)){ Count[4]+=Numb;if(Wait_i>0){ for(i=0;i if(Wait_hbh[i].equals(“mcm”)||Wait_hbh[i].equals(“MCM”)&&Wait_count[i]<=Count[0]) { j=i+1; label=new JLabel(j+“号客户: ”+Wait_name[i]+“ 满足订票要求,联系方式是:”+Wait_lxfs[i]);d.add(label);d.setLocation(this.getX()+100,this.getY()+100);d.setVisible(true);} } } } } } flight 1.用户表:user 用户编号:userid int 自动增长 主键 用户名 username varchar(20)密码 password varchar(20)类型 usertype varchar(10)登录时间 logintime datetime 2.航空公司表 company 公司编号 companyid int 自动增长 主键 航空公司名称 companyname varchar(50)3.机场表 airport 机场编号:airportid int 自动增长 主键 机场代码:airportcode varchar(20)机场名称:airportname varchar(50)4.航班信息表 flight 航班编号:flightid nt 自动增长 主键 航班代号:flightcode varchar(20)所属航空公司:company int 日期:flightdate datetime 起飞时间:flytime datetime 到达时间:landtime datetime 起飞机场:flyairport int 到达机场:landairport int 头等舱价格:firstprice money 公务舱价格:secondprice money 经济舱价格:thirdprice money 机型:planetype varchar(20) #include int number;//航班号 int Number;//飞机号 int week;//星期几飞行 int day;//日期 int left;//余票额 int n;//与数组flag一起确定客户订票状态 public: int flag[20];//订票状态数组,-1为预订票,1为已定票,0为初始化状态 Plane()//构造函数 { name[0]=' '; number=0; Number=0; week=0; day=0; left=M; n=0;//数组从0开始计数 for(int i=0;i<20;i++) flag[i]=0;} void init()//初始化每种飞机票 { cout<<“请输入终点站名:”; cin>>name; cout<<“请输入航班号:”; cin>>number; cout<<“请输入飞机号:”; cin>>Number; cout<<“请输入星期几飞行:”; cin>>week; cout<<“请输入航班的日期:”; cin>>day;} ~Plane(){};//析构函数 char *getname(){return name;}//获得终点站名 int getnumber(){return number;}//获得航班号 int getNumber(){return Number;}//获得飞机号 int getweek(){return week;}//获得星期几飞行 int getday(){return day;}//获得日期 int getleft(){return left;}//获得余票额 int getn(){return n;}//获得旅客数目 void inleft(int n){left=left+n;}//余票额增加函数 void deleft(int n){left=left-n;}//余票额减少函数 void inn(){n++;}//旅客数目增加函数 };Plane pl[N];int showmenu();//菜单函数 void start();//初始化函数 void query();//查询函数 void make();//订票函数 void back();//退票函数 int main(){ cout<<“这是民航售票处的计算机系统程序”< int choice; choice=showmenu(); switch(choice) { case 1:query();break; case 2:make();break; case 3:back();break; case 0:return 0; default:cout<<“你敲错了!n”; } } return 0;} int showmenu(){ int ch;cout< pl[i].init(); cout< if(strcmp(name,pl[i].getname())==0) { num++; cout<<“航班号:”< cout<<“飞机号:”< cout<<“星期:”< cout<<“航班日期:”< cout<<“余票额:”< break; } if(num==0) cout<<“没有此航班”< if(number==pl[i].getnumber()) { num++; if(n<=pl[i].getleft()) { cout<<“此航班有票”< pl[i].deleft(n); pl[i].inn(); pl[i].flag[pl[i].getn()]=1; for(i=0;i { cout<<“座位号”; cin>>sitnumber; } } else { cout<<“余票额少于订票额,请重新输入订票数额,”<<“订票数额应该少于或等于”< cin>>nu; if(nu<=pl[i].getleft()) { cout<<“此航班有票”< pl[i].deleft(nu); pl[i].inn(); pl[i].flag[pl[i].getn()]=1; for(i=0;i { cout<<“座位号”; cin>>sitnumber; } } else { cout<<“是否需要预约”< cout<<“是(1) 否(2)”< cin>>ch; switch(ch) { case 1:pl[i].inn();pl[i].flag[pl[i].getn()]=-1;break; case 2:break; default:cout<<“你敲错了!”< } } } } if(num==0) cout<<“没有此航班”< cout<<“请输入日期:”;cin>>day;cout<<“请输入航班:”;cin>>number;for(int i=0;i if((day==pl[i].getday())&&(number==pl[i].getnumber()))//日期与航班是否满足 { num++;//日期与航班满足 cout<<“输入退票数目”; cin>>n; cout<<“退票成功”< pl[i].inleft(n);//该种飞机票增加,即已退票 for(int j=0;j<=pl[i].getn();j++)//顺序查询客户订票状态 { if(pl[i].flag[j]==-1)//客户是否为预定状态 { cout<<“有预约订票,请输入订票数额:”; cin>>nu; if(nu<=pl[i].getleft())//余票额是否满足要求 { cout<<“此航班有票”< pl[i].flag[j]=1; cout<<“订票成功”< pl[i].deleft(nu); for(int k=0;k { } cout<<“座位号”<<“ ”; cin>>sitnumber; } cout<<“余票额为”< } } else cout<<“没有预约订票!”<<“余票额为”< 第三篇:基于java航空售票系统(范文)
第四篇:航空售票系统数据库分析表
第五篇:航空售票系统+C++课程设计源代码