数据库系统开发——旅游公司机票查询及预订系统 摘   要 目录 第一章 需求分析 第二章 概念结构设计 第三章 逻辑结构设计 第四章 物理结构设计 第五章 数据库的实施 第六章 系统实现 第七章 总结 附:程序使用说明

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

      本系统是主要针对机票查询及预定功能开发的小型系统,通过SQL Server 2008数据库和Visual Studio 2010的连接,在Visual Studio 2010中创建winform文件进行c#的程序编写,实现对SQL Server2008数据库中录入的数据信息及表格信息的调用,从而完成机票的查询与预订。Visual Studio 2010调用数据库中的信息后,通过可视化界面将航班信息显示出来。普通用户可进行用户的注册及密码的修改,在登录系统后选择出发地、目的地后可查询相应航班信息并进行预订,若要取消行程可删除订单,实现了用户预订机票的基本功能,管理员可对航班信息和用户信息进行管理操作。

关键词:机票预定,机票查询,c#,Visual Studio 2010,SQL Server 2008

  

目录

第一章 需求分析

       1.1 功能需求

          1.1.1  系统功能模块

           1.1.2预订模块

       1.2 数据流图

       1.3 功能模块图

第二章 概念结构设计

       2.1 局部 E-R图

       2.2 整体E-R图

第三章 逻辑结构设计

       3.1 关系模式

       3.2 数据关系图

第四章 物理结构设计

       4.1 存储记录结构设计

第五章 数据库的实施

       5.1 建立数据库

       5.2 数据表的建立

       5.3 存入数据

       5.4 存储过程

       5.5 创建触发器

第六章 系统实现

       6.1 系统核心代码及运行截屏

第七章 总结

        7.1 总结及心得体会

附:程序使用说明

  

第一章 需求分析

1.1 功能需求

     随着时代的发展,人们旅游出行的次数越来越多,旅游业越来越发达,针对旅游公司帮助客人订机票的需求,建立此系统。旅游公司的订票及预订系统主要功能是查询某一城市到另一城市的航班,并帮助游客预订,在行程取消时可将订单删除。该系统能够让普通用户查询机票的航班号、航空公司、出发时间、到达时间和票价,并选择预订数量和出发日期,提供正确的身份信息后可成功预订机票。系统管理员可以对航班信息和用户信息进行管理操作,以满足不同航班和不同用户的信息更改等操作。

  1.1.1  系统功能模块

      机票查询及预定系统主要包括用户登录,航班信息的查询、机票预订功能、机票信息管理和用户信息管理。

            (1)用户登录管理

      不同用户设置不同的账号及密码,用账号和密码登录后才能够进行机票的查询和预订,用户可以注册新的账号,修改已有账号的密码。

            (2)机票查询管理

      选择不同的出发地和目的地,点击查询,可查出不同的可预订航班。

            (3)机票预定管理

      查询出相应的航班后,可查看剩余票数,用户自行选择出发时间和预订数量,点击预订,即可预订成功。

            (4)  订单管理

      订单预订成功后,若行程取消或改变,可根据订单编号删除原有订单,重新进行预订。

            (5)机票信息管理

      当航班信息发生改变或有新的航班时,管理员可登录系统,对航班信息进行修改、删除、添加。

            (6)用户信息管理

      当系统中需要新的管理员时,原管理员可登录系统,添加新的管理员账号,也可删除已有管理员。

  1.1.2预订模块

      本机票查询及预定系统的主要功能是机票查询和预订:

            (1) 查询所需航班。

            (2) 修改出发地、目的地、预订数量和出发日期。

            (3) 增加和删除预定信息及订单。

            (4)管理员对机票信息和用户信息进行增删改的操作。

1.2 数据流图

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明 

图 1-1 数据流图

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

1-2 管理员数据流图

1.3 功能模块图

 数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明 

图 1-3 功能模块图

 

第二章 概念结构设计

2.1 局部 E-R图

 数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明 

图 2-1 用户E-R图

 

 数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明 

 

图 2-2  城市E-R图

 数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明 

图 2-3  航空公司E-R图

 

 数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明 

图 2-4 订单E-R图

 数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明 

图 2-5 航班信息E-R图

 

  

2.2 整体E-R图

 数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明 

图 2-6 整体E-R图

第三章 逻辑结构设计

 3.1 关系模式

      该系统的关系模式主要有以下几种:

            用    户   表:usertable( account ,password

            管 理 员 表:managertable (account1,password1)

            乘   客   表:passneger (name,idcard)

            城市信息表:Cityinfo ( id , cityname )

            航空公司表:Airwaysinfo ( id , airways )

            航班信息表:Flightinfo ( flightno , airwaysid , leavecity , destination , leavetime , landtime , price )

            订   单    表:Orderinfo ( orderinfo , flightno , leavedate , number )

3.2 数据关系图

 数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

图 3-1 数据关系图

 

第四章 物理结构设计

4.1 存储记录结构设计

      在物理结构中,数据的基本存取单位是存储记录。有逻辑结构就可以设计存储记录结构,一个存储记录可以与多个逻辑记录相对应。存储记录就包括记录的组成,数据项的类型和长度等。

            (1)用户表包括account和password

列名

字段类型

约束条件

account

Char(50)

主码

password

Char(50)

主码

             (2)Cityinfo 包括id和cityname

列名

字段类型

约束条件

Id

int

主码

cityname

nvarchar(50)

非空

            (3)Airwaysinfo包括id和airways

列名

字段类型

约束条件

Id

int

主码

airways

nvarchar(50)

非空

            (4)  Flightinfo包括flightno,airwaysid,leavecity,destination,leavetime,landtime,price,total

列名

字段类型

约束条件

flightno

Nvarchar(50)

主码

airwaysid

int

非空

leavecity

int

非空

destination

int

非空

leavetime

nvarchar(50)

非空

landtime

nvarchar(50)

非空

price

money

非空

total

int

非空

            (5)Orderinfo包括orderinfo,flightno,leavedate,number

列名

字段类型

约束条件

orderinfo

int

主码

flightno

nvarchar(50)

非空

leavedate

nvarchar(50)

非空

number

int

非空

(6)  Managertable包括 account1和password1

列名

字段类型

约束条件

account1

char(50)

主码

password1

char(50)

主码

(6)  passenger包括name和idcard

列名

字段类型

约束条件

name

char(50)

主码

idcard

char(50)

主码

第五章 数据库的实施

5.1 建立数据库

 create database MyTicket 

5.2 数据表的建立

 

 1 create table 用户表 (
 2 account  char(50) not null,
 3 password  char(50) not null,
 4 primary key(帐号,密码))
 5 
 6 create table cityinfo (
 7 id int   primary key,
 8 cityname nvarchar(50) not null)
 9 
10 create table airwaysinfo (
11 id int  primary key,
12 airways nvarchar(50) not null)
13 
14 create table flightinfo(
15 flightno nvarchar(50) primary key,
16 airwaysid int not null,
17 leavecity int not null,
18 destination int not null,
19 leavetime nvarchar(50) not null,
20 landtime nvarchar(50) not null,
21 price money not null,
22 total int not null,
23 foreign key(airwaysid) references airwaysinfo(id),
24 foreign key(leavecity) references cityinfo(id),
25 foreign key(destination) references airwaysinfo(id))
26 
27 create table orderinfo(
28 orderid int primary key,
29 flightno  nvarchar(50) not null,
30 leavedate nvarchar(50) not null,
31 number int not null,
32 foreign key(flightno) references flightinfo(flightno))
33 
34 create table  managertable(
35 account1 char(50),
36 password1 char(50),
37 primary key(account1,password1))
38 
39 create table passneger(
40 name char(50),
41 idcard char(50),
42 primary key(name,idcard))

5.3 存入数据

 1 insert into airwaysinfo values('1','中国国航')
 2 insert into airwaysinfo values('2','上海航空')
 3 insert into airwaysinfo values('3','山东航空')
 4 insert into airwaysinfo values('4','海南航空')
 5 insert into airwaysinfo values('5','东方航空')
 6 insert into airwaysinfo values('6','北京航空')
 7 
 8 insert into cityinfo values('1','上海')
 9 insert into cityinfo values('2','北京')
10 insert into cityinfo values('3','三亚')
11 insert into cityinfo values('4','沈阳')
12 insert into cityinfo values('5','杭州')
13 insert into cityinfo values('6','深圳')
14 
15 insert into flightinfo values('CA137','1','2','5','08:30','11:30','1200','100')
16 insert into flightinfo values('CA148','4','1','2','13:30','16:30','1450','100')
17 insert into flightinfo values('CA356','2','2','4','21:40','02:30','950','100')
18 insert into flightinfo values('CA888','3','4','6','06:50','10:20','1100','100')
19 insert into flightinfo values('CZ1437','5','3','1','22:30','03:30','1000','100')
20 insert into flightinfo values('CZ8137','2','6','5','11:30','14:30','800','100')
21 
22 insert into managertable values('yuanyuan','123456')

5.4 存储过程

           1.城市表的存储过程

1 create procedure pro_cityinfo
2 @id int,@cityname nvarchar(50)
3 as
4 insert into cityinfo (id,cityname)
5 values (@id,@cityname)

           2.航空公司表的存储过程

1 create procedure pro_airwaysinfo
2 @id int,@airways nvarchar(50)
3 as
4 insert into airwaysinfo (id,airways)
5 values (@id,@airways)

           3.航班信息表的存储过程

1 create procedure pro_flightinfo
2 @flightno nvarchar(50),@airwaysid int,@leavecity int,@destination int,
3 @leavetime nvarchar(50),@landtime nvarchar(50),@price money
4 as
5 insert into flightinfo (flightno,airwaysid,leavecity,
6 destination,leavetime,landtime,price)
7 values (@flightno,@airwaysid,@leavecity,
8 @destination,@leavetime,@landtime,@price)

           4.订单表的存储过程

1 create procedure pro_orderinfo
2 @orderinfo int,@flightno  nvarchar(50),@leavedate nvarchar(50),@number int
3 as
4 insert into orderinfo (orderinfo,flightno,leavedate,number)
5 values (@orderinfo,@flightno,@leavedate,@number)

           5.用户表的存储过程

1 create procedure pro_user
2 @account char(30),@password char(30)
3 as
4 insert into usertable (account,password)
5 values (@account,@password)

           6.管理员表的存储过程

1 create procedure pro_managertable
2 @account1 char(30),@password1 char(30)
3 as
4 insert into usertable (account1,password1)
5 values (@account1,@password1)

          7.乘客表的存储过程

1 create procedure pro_passneger
2 @name char(50),@idcard char(50)
3 as
4 insert into usertable (name,idcard)
5 values (@name,@idcard)

5.5 创建触发器

        当在航班信息表中插入一条新的信息时,如果插入信息的城市名和航空公司未出现过,那么在航班公司表中插入新的航空公司名,在城市表中插入新的城市名。

           1.创建触发器使cityinfo表里增加新的城市

           (1) 

1 create trigger tr_fli1 
2 on flightinfo for after insert
3 as
4 insert into cityinfo 
5 where id =(select leavecity from  inserted)

           (2)

1 create trigger tr_fli2
2 on flightinfo for after insert
3 as
4 insert into cityinfo 
5 where id =(select destination from  inserted)

           2.创建触发器使航空公司表里增加新的航空公司id

1 create trigger tr_fli3 
2 on flightinfo for after insert
3 as
4 insert into airwaysinfo 
5 where id =(select airwaysid from  inserted)

          3.创建触发器当orderinfo插入新数据时,flightinfo中的total即剩余机票数量应发生相应的更改。

1 create trigger up1 on orderinfo
2 after insert
3 as
4 update flightinfo set total = total - 
5 (select  number from orderinfo
6 where number = (select number from inserted))
7  where flightno =(
8 select flightno from inserted)

          4.创建触发器当游客删除订单时,flightinfo中的total发生相应的更改。

 

1 create trigger up1 on orderinfo
2 after insert
3 as
4 update flightinfo set total = total - 
5 (select  number from orderinfo
6 where number = (select number from inserted))
7  where flightno =(
8 select flightno from inserted)

                  预订成功界面:

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

                  预订后剩余票数变化:

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

                   删除订单后剩余票数变化:

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

第六章 系统实现

6.1 系统核心代码及运行结果

        (1)登录界面代码及运行结果

 1        private void button1_Click(object sender, EventArgs e)
 2         {
 3             string userno = txtUserNo.Text.Trim();//取出账号
 4             string pw = textPassword.Text.Trim();//取出密码
 5             //连接数据库
 6             string constr = @"Data Source=.;Initial Catalog=MyTicket;User ID=20173967;Pwd=20173967";
 7             SqlConnection mycon = new SqlConnection(constr);//实例化连接对象
 8             mycon.Open();
 9             //确定账号和密码
10             SqlCommand mycom = mycon.CreateCommand();       //创建SQL命令执行对象
11             string s1 = "select account,password from usertable where account='" + userno + "' and password='" + pw + "'";
12             //编写SQL命令
13             mycom.CommandText = s1;                           //执行SQL命令
14             SqlDataAdapter myDA = new SqlDataAdapter();       //实例化数据适配器
15             myDA.SelectCommand = mycom;                       //让适配器执行SELECT命令
16             DataSet myDS = new DataSet();                     //实例化结果数据集
17             int n = myDA.Fill(myDS, "register");         //将结果放入数据适配器,返回元祖个数
18             if (n != 0)
19             {
20                 MessageBox.Show("登录成功!", "提示");
21                 this.Hide();
22                 FrmBookTicket frm = new FrmBookTicket();
23                 frm.Show();
24             }
25             else
26             {
27                 MessageBox.Show("用户名或密码错误,请重试!","提示");
28                 txtUserNo.Text = "";
29                 textPassword.Text = "";
30             }
31         }
登录界面

 

 数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

 图6-1 登录界面

 

       (2) 注册界面代码及运行结果

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明
 1 namespace BookTicket
 2 {
 3     public partial class Frmregister : Form
 4     {
 5         public Frmregister()
 6         {
 7             InitializeComponent();
 8         }
 9  
10  
11         private void Frmregister_Load_1(object sender, EventArgs e)
12         {
13             lbluserno.BackColor = Color.Transparent;
14             lbluserno.Parent = pictureBox1;
15  
16             lblpassword.BackColor = Color.Transparent;
17             lblpassword.Parent = pictureBox1;
18  
19             copassword.BackColor = Color.Transparent;
20             copassword.Parent = pictureBox1;
21         }
22  
23         private void button2_Click_1(object sender, EventArgs e)
24         {
25             this.Hide();
26             FrmLogin f1 = new FrmLogin();
27             f1.Show();
28         }
29  
30         private void button1_Click(object sender, EventArgs e)
31         {
32             //检查是否已经存在
33             string userID = userno.Text.Trim();  //取出账号
34             string password = userPw.Text.Trim();  //取出密码
35             //连接数据库
36             string constr = @"Data Source=.;Initial Catalog=MyTicket;User ID=20173967;Pwd=20173967";
37             SqlConnection mycon = new SqlConnection(constr);                  //实例化连接对象
38             mycon.Open();
39  
40             //查询新注册的用户是否存在
41             SqlCommand checkCmd = mycon.CreateCommand();       //创建SQL命令执行对象
42             string s = "select account from usertable where account='" + userID + "'";
43             checkCmd.CommandText = s;
44             SqlDataAdapter check = new SqlDataAdapter();       //实例化数据适配器
45             check.SelectCommand = checkCmd;                    //让适配器执行SELECT命令
46             DataSet checkData = new DataSet();                 //实例化结果数据集
47             int n = check.Fill(checkData, "register");         //将结果放入数据适配器,返回元祖个数
48             if (n != 0)
49             {
50                 MessageBox.Show("用户名存在");
51             }
52  
53             else if (userno.Text == "" || userPw.Text == "" || ensurePw.Text == "")
54             {
55                 MessageBox.Show("账号或密码不能为空!", "提示");
56             }
57             else if (userPw.Text != ensurePw.Text)
58             {
59                 MessageBox.Show("两次密码不一致!", "提示");
60  
61             }
62             else
63             {
64                 MessageBox.Show("注册成功!", "提示");
65  
66                 StringBuilder sql = new StringBuilder();
67                 sql.Append("insert into usertable ([account],[password])");
68                 sql.AppendFormat(" Values ('{0}','{1}')  ", userID, password);
69  
70                 DBHelper helper = new DBHelper();
71  
72                 try
73                 {
74                     SqlCommand command = new SqlCommand(sql.ToString(), helper.Connection);
75                     helper.OpenConnection();
76                     //执行增删改
77                     int result = command.ExecuteNonQuery();
78                 }
79                 catch (Exception ex)
80                 {
81                     // Console.WriteLine(ex.Message);
82                     MessageBox.Show("发生错误,请联系管理员" + ex.Message);
83                 }
84                 finally
85                 {
86                     helper.CloseConnection();
87                 }
88                 this.Hide();
89                 FrmLogin f1 = new FrmLogin();
90                 f1.Show();
91             }
92  
93         }
94    }
95 }
注册界面

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

图6-2 注册界面

 

       (3) 修改密码界面代码及运行结果

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明
 1 namespace BookTicket
 2 {
 3     public partial class Frmchange : Form
 4     {
 5         public Frmchange()
 6         {
 7             InitializeComponent();
 8         }
 9  
10         private void button2_Click(object sender, EventArgs e)
11         {
12             this.Hide();
13             FrmLogin f1 = new FrmLogin();
14             f1.Show();
15         }
16  
17         private void button1_Click(object sender, EventArgs e)
18         {
19             string userno = txtuserid.Text.Trim();//取出账号
20             string pw = txtoldpw.Text.Trim();//取出密码
21             string npw = txtnewpw.Text.Trim();//取出新密码
22             //连接数据库
23             string constr = @"Data Source=.;Initial Catalog=MyTicket;User ID=20173967;Pwd=20173967";
24             SqlConnection mycon = new SqlConnection(constr);//实例化连接对象
25             mycon.Open();
26             //确定账号和密码
27             SqlCommand mycom = mycon.CreateCommand();       //创建SQL命令执行对象
28             string s1 = "select account,password from usertable where account='" + userno + "' and password='" + pw + "'";
29             //编写SQL命令
30             mycom.CommandText = s1;                           //执行SQL命令
31             SqlDataAdapter myDA = new SqlDataAdapter();       //实例化数据适配器
32             myDA.SelectCommand = mycom;                       //让适配器执行SELECT命令
33             DataSet myDS = new DataSet();                     //实例化结果数据集
34             int n = myDA.Fill(myDS, "register");              //将结果放入数据适配器,返回元祖个数
35             if (txtuserid.Text == "" || txtoldpw.Text == "" || txtnewpw.Text == "" || txtensurepw.Text == "")
36             {
37                 MessageBox.Show("账号或密码不能为空!", "提示");
38             }
39             else if (n == 0)
40             {
41                 MessageBox.Show("原密码输入错误!请重试", "提示");
42             }
43             else if (txtnewpw.Text != txtensurepw.Text)
44             {
45                 MessageBox.Show("两次密码不一致!", "提示");
46             }
47             else
48             {
49                 MessageBox.Show("修改密码成功!", "提示");
50                 StringBuilder sql = new StringBuilder();
51                 sql.Append("update usertable set password = " + "'" + npw + "'" + " where account = " + "'" + userno+ "'" );
52                 DBHelper helper = new DBHelper(); 
53  
54                 try
55                 {
56                     SqlCommand command = new SqlCommand(sql.ToString(), helper.Connection);
57                     helper.OpenConnection();
58                     //执行增删改
59                     int result = command.ExecuteNonQuery();
60                 }
61                 catch (Exception ex)
62                 {
63                     // Console.WriteLine(ex.Message);
64                     MessageBox.Show("发生错误,请联系管理员" + ex.Message);
65                 }
66                 finally
67                 {
68                     helper.CloseConnection();
69                 }
70                 this.Hide();
71                 FrmLogin f1 = new FrmLogin();
72                 f1.Show();
73             }
74  
75         }
76  
77         private void Frmchange_Load(object sender, EventArgs e)
78         {
79             label4.BackColor = Color.Transparent;
80             label4.Parent = pictureBox1;
81  
82             label1.BackColor = Color.Transparent;
83             label1.Parent = pictureBox1;
84  
85             label2.BackColor = Color.Transparent;
86             label2.Parent = pictureBox1;
87  
88             label3.BackColor = Color.Transparent;
89             label3.Parent = pictureBox1;
90         }
91     }
92 }
修改密码界面

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明 

图6-3 修改密码界面

 

       (4) 机票查询及预订界面代码及运行结果

 

  1   public partial class FrmBookTicket : Form
  2     {
  3         DataSet ds;  // 数据集   
  4  
  5         public FrmBookTicket()
  6         {
  7             InitializeComponent();
  8         }
  9  
 10         // 填充数据集,绑定到ComboBox显示
 11         private void BookTicketForm_Load(object sender, EventArgs e)
 12         {
 13             grpFlightInfo.BackColor = Color.Transparent;
 14             grpFlightInfo.Parent = pictureBox1;//将pictureBox1设为标签的父控件
 15             //pictureBox1.Controls.Add(label1);
 16             grpFlightInfo.Location = new Point(80, 80);
 17  
 18             grpOrderInfo.BackColor = Color.Transparent;
 19             grpOrderInfo.Parent = pictureBox1;
 20  
 21              
 22              
 23             // 查询城市数据,填充数据集
 24             DBHelper helper = new DBHelper();
 25             string sqlCity = "SELECT * FROM CityInfo";
 26             SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCity, helper.Connection);
 27  
 28             ds = new DataSet();
 29  
 30             dataAdapter.Fill(ds, "CityInfo");
 31             DataRow row = ds.Tables["CityInfo"].NewRow();
 32             row[0] = "-1";
 33             row[1] = "请选择";
 34             ds.Tables["CityInfo"].Rows.InsertAt(row, 0);
 35  
 36             // 获得座位数据源的视图
 37             DataView dvLeaveCity = new DataView(ds.Tables["CityInfo"]);
 38             DataView dvDestination = new DataView(ds.Tables["CityInfo"]);
 39              
 40             // 绑定数据源
 41             this.cboLeaveCity.DataSource = dvLeaveCity;
 42             this.cboLeaveCity.ValueMember = "Id";
 43             this.cboLeaveCity.DisplayMember = "CityName";
 44  
 45             this.cboDestination.DataSource = dvDestination;
 46             this.cboDestination.ValueMember = "Id";
 47             this.cboDestination.DisplayMember = "CityName";
 48  
 49             // 查询航班信息,填充到数据集
 50             StringBuilder sqlFlight = new StringBuilder();
 51             sqlFlight.Append("SELECT F.[FlightNO],A.[Airways],F.[LeaveCity],F.[LeaveTime],F.[Destination],F.[LandTime],F.[Price]");
 52             sqlFlight.Append(" FROM FlightInfo AS F,AirwaysInfo AS A");
 53             sqlFlight.Append(" WHERE F.[AirwaysId] = A.[Id]");
 54             SqlDataAdapter adapter = new SqlDataAdapter(sqlFlight.ToString(), helper.Connection);            
 55             adapter.Fill(ds, "FlightInfo");
 56         }
 57  
 58         // 根据查询条件,重新填充数据集
 59         private void btnSearch_Click(object sender, EventArgs e)
 60         {
 61             // 根据查询条件显示查询结果
 62             ShowResult();
 63  
 64             // 清空预定部分的内容
 65             foreach (Control c in grpOrderInfo.Controls)
 66             {
 67                 if (c is TextBox)
 68                 {
 69                     ((TextBox)c).Text = string.Empty;
 70                 }
 71             }        
 72         }
 73  
 74         /// <summary>
 75         /// 绑定DataGridView显示查询结果
 76         /// </summary>
 77         private void ShowResult()
 78         {
 79             if (cboLeaveCity.Text == "请选择" || cboDestination.Text == "请选择")
 80             {
 81                 MessageBox.Show("请选择出发地和目的地!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
 82             }
 83             else
 84             {
 85                 DataView dvFlight = new DataView(ds.Tables["FlightInfo"]);
 86                 dvFlight.RowFilter = string.Format("LeaveCity={0} AND Destination={1}",
 87                     Convert.ToInt32(cboLeaveCity.SelectedValue),Convert.ToInt32(cboDestination.SelectedValue));
 88                 this.dgvTicketInfo.DataSource = dvFlight;
 89             }
 90         }
 91  
 92         // 根据用户的选择,显示航班的详细信息
 93         private void dgvTicketInfo_MouseClick(object sender, MouseEventArgs e)
 94         {
 95             if (dgvTicketInfo.Rows.Count > 0)
 96             {
 97                 // 显示选中的航班信息
 98                 this.txtFlightNO.Text = dgvTicketInfo.CurrentRow.Cells["FlightNO"].Value.ToString();
 99                 this.txtAirways.Text = dgvTicketInfo.CurrentRow.Cells["Airways"].Value.ToString();
100                 this.txtFrom.Text = this.cboLeaveCity.Text;
101                 this.txtTo.Text = this.cboDestination.Text;
102                 this.txtLeaveTime.Text = dgvTicketInfo.CurrentRow.Cells["LeaveTime"].Value.ToString();
103                 this.txtLandTime.Text = dgvTicketInfo.CurrentRow.Cells["LandTime"].Value.ToString();
104                 this.txtPrice.Text = dgvTicketInfo.CurrentRow.Cells["Price"].Value.ToString();
105             }            
106         }
107  
108         // 单击“预订”按钮,将预订信息写入数据库       
109         private void btnOrder_Click(object sender, EventArgs e)
110         {
111             if (ValidateInput())
112             {
113                 // 获得要插入的数据
114                 Random random = new Random();
115                 int orderId = random.Next(100000, 999999);  // 订单编号
116                 string flightNo = this.txtFlightNO.Text;    // 预定的航班号
117                 string leaveDate = this.dtpDate.Value.ToShortDateString();// 出发日期
118                 int number = (int)this.numNumber.Value;
119  
120                 // 插入数据到数据库
121                 StringBuilder sql = new StringBuilder();
122                 sql.Append("INSERT INTO OrderInfo ([OrderId],[FlightNo],[LeaveDate],[Number])");
123                 sql.AppendFormat(" Values ({0},'{1}','{2}',{3})  ", orderId, flightNo, leaveDate, number);
124  
125                 DBHelper helper = new DBHelper();
126  
127                 try
128                 {
129                     SqlCommand command = new SqlCommand(sql.ToString(), helper.Connection);
130                     helper.OpenConnection();
131                     //执行增删改
132                     int result = command.ExecuteNonQuery();
133                     if (result > 0)
134                     {
135                         MessageBox.Show("预定成功!订单编号为" + orderId.ToString(),"提示");
136                        // MessageBox.Show(message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
137                     }
138                     else
139                     {
140                         MessageBox.Show("预订失败,请重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
141                     }
142                 }
143                 catch (Exception ex)
144                 {
145                    // Console.WriteLine(ex.Message);
146                     MessageBox.Show("发生错误,请联系管理员" );
147                 }
148                 finally
149                 {
150                     helper.CloseConnection();
151                 }
152                 /*this.Hide();
153                 Frmchange f1 = new Frmchange();
154                 f1.Show();*/
155             }
156         } 
157         /// <summary>
158         /// 验证预订部分的用户输入
159         /// </summary>
160         /// <returns>验证成功返回True,失败返回False</returns>
161         private bool ValidateInput()
162         {
163             if (txtFlightNO.Text == string.Empty)
164             {
165                 MessageBox.Show("请选择一个航班!", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
166                 return false;
167             }
168             if (dtpDate.Value < DateTime.Now)
169             {
170                 MessageBox.Show("请选择正确的出发日期!", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
171                 dtpDate.Focus();
172                 return false;
173             }
174             else
175             {
176                 return true;
177             }
178         } 
机票查询及预订

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

图6-4 查询与预订机票界面

 

       (5)  新增乘客界面代码及运行结果

 1 private void button1_Click_1(object sender, EventArgs e)
 2         {
 3             string id = textBox2.Text;
 4             //连接数据库
 5             string constr = @"Data Source=.;Initial Catalog=MyTicket;User ID=20173967;Pwd=20173967";
 6             SqlConnection mycon = new SqlConnection(constr);                  //实例化连接对象
 7             mycon.Open();
 8  
 9             if (textBox1.Text == "" || textBox2.Text == "")
10             {
11                 MessageBox.Show("姓名或身份证号不能为空!", "提示");
12             }
13             else if (id.Length < 18)
14             {
15                 MessageBox.Show("身份证号少于18位!","提示");
16             }
17             else
18             {
19                 MessageBox.Show("添加成功!", "提示");
20  
21                 StringBuilder sql = new StringBuilder();
22                 sql.Append("insert into passneger ([name],[idcard])");
23                 sql.AppendFormat(" Values ('{0}','{1}')  ", textBox1.Text, textBox2.Text);
24  
25                 DBHelper helper = new DBHelper();
26  
27                 try
28                 {
29                     SqlCommand command = new SqlCommand(sql.ToString(), helper.Connection);
30                     helper.OpenConnection();
31                     //执行增删改
32                     int result = command.ExecuteNonQuery();
33                 }
34                 catch (Exception ex)
35                 {
36                     // Console.WriteLine(ex.Message);
37                     MessageBox.Show("发生错误,请联系管理员" + ex.Message);
38                 }
39                 finally
40                 {
41                     helper.CloseConnection();
42                 }
43                 this.Hide();
44                 FrmBookTicket f1 = new FrmBookTicket();
45                 f1.Show();
46             }
47         }
新增乘客

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

 图6-5 新增乘客界面

 (6) 删除订单界面代码及运行结果

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明
 1 namespace BookTicket
 2 {
 3     public partial class Frmdelete : Form
 4     {
 5         public Frmdelete()
 6         {
 7             InitializeComponent();
 8         }
 9  
10         private void button1_Click(object sender, EventArgs e)
11         {
12             string orderid = textBox1.Text.Trim();
13             //连接数据库
14             string constr = @"Data Source=.;Initial Catalog=MyTicket;User ID=20173967;Pwd=20173967";
15             SqlConnection mycon = new SqlConnection(constr);//实例化连接对象
16             mycon.Open();
17             //确定订单编号
18             SqlCommand checkCmd = mycon.CreateCommand();       //创建SQL命令执行对象
19             string s = "select orderid from orderinfo where orderid = '" + orderid + "'";
20             checkCmd.CommandText = s;
21             SqlDataAdapter check = new SqlDataAdapter();       //实例化数据适配器
22             check.SelectCommand = checkCmd; //执行select命令
23             DataSet checkData = new DataSet();                 //实例化结果数据集
24             int n = check.Fill(checkData, "register");         //将结果放入数据适配器,返回元祖个数
25             if (n != 0)
26             {
27                 StringBuilder sql = new StringBuilder();
28                 sql.Append("delete from OrderInfo where orderid = '" + orderid + "'");
29                  DBHelper helper = new DBHelper();
30  
31                 try
32                 {
33                     SqlCommand command = new SqlCommand(sql.ToString(), helper.Connection);
34                     helper.OpenConnection();
35                     //执行增删改
36                     int result = command.ExecuteNonQuery();
37                     if (result > 0)
38                     {
39                         MessageBox.Show("删除成功!" ,"提示");
40                     }
41                     else
42                     {
43                         MessageBox.Show("删除失败,请重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
44                     }
45                 }
46                 catch (Exception ex)
47                 {
48                     // Console.WriteLine(ex.Message);
49                     MessageBox.Show("发生错误,请联系管理员");
50                 }
51                 finally
52                 {
53                     helper.CloseConnection();
54                 }
55                 FrmBookTicket f1 = new FrmBookTicket();
56                 f1.Show();
57                 this.Close();
58             }
59         }
60         private void button2_Click(object sender, EventArgs e)
61         {
62             FrmBookTicket f1 = new FrmBookTicket();
63             f1.Show();
64             this.Close();
65         }
66  
67         private void Frmdelete_Load(object sender, EventArgs e)
68         {
69             label1.BackColor = Color.Transparent;
70             label1.Parent = pictureBox1;
71         }
72  
73     }
74 }
删除订单界面

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明 

图6-6 删除订单界面

 

     

 (7)  管理员用户主界面代码及运行结果

 1  private void button2_Click(object sender, EventArgs e)
 2         {
 3             this.Hide();
 4             Frmuser f2 = new Frmuser();
 5             f2.Show();
 6         }
 7  
 8         private void button1_Click_1(object sender, EventArgs e)
 9         {
10             this.Hide();
11             Frmflight f1 = new Frmflight();
12             f1.Show();
13         }
管理员用户主界面

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

 图6-7 管理员用户主界面

(8)  航班信息管理代码及界面

 1 private void button2_Click(object sender, EventArgs e)
 2         {
 3             string flightno = txtflyno.Text.Trim();//取出账号
 4             string airwayid = txtairway.Text.Trim();
 5             string leavecity = txtleave.Text.Trim();
 6             string destination = txtarrive.Text.Trim();
 7             string leavetime = txtltime.Text.Trim();
 8             string landtime = txtatime.Text.Trim();
 9             string price = txtprice.Text.Trim();
10             string total = txtto.Text.Trim();
11             //连接数据库
12             string constr = @"Data Source=.;Initial Catalog=MyTicket;User ID=20173967;Pwd=20173967";
13             SqlConnection mycon = new SqlConnection(constr);//实例化连接对象
14             mycon.Open();
15             //确定账号和密码
16             SqlCommand mycom = mycon.CreateCommand();       //创建SQL命令执行对象
17             string s1 = "select flightno from flightinfo where flightno='" + flightno + "'";
18             //编写SQL命令
19             mycom.CommandText = s1;                           //执行SQL命令
20             SqlDataAdapter myDA = new SqlDataAdapter();       //实例化数据适配器
21             myDA.SelectCommand = mycom;                       //让适配器执行SELECT命令
22             DataSet myDS = new DataSet();                     //实例化结果数据集
23             int n = myDA.Fill(myDS, "register");              //将结果放入数据适配器,返回元祖个数
24             if (n == 0)
25             {
26                 MessageBox.Show("航班不存在,请填写正确的航班号", "提示");
27             }
28             if (n != 0)
29             {
30                 MessageBox.Show("航班信息修改成功!", "提示");
31                 StringBuilder sql = new StringBuilder();
32                 sql.Append("update flightinfo set airwaysid = " + "'" + airwayid + "'" + " where flightno = " + "'" + flightno + "'");
33                 sql.Append("update flightinfo set leavecity = " + "'" + leavecity + "'" + " where flightno = " + "'" + flightno + "'");
34                 sql.Append("update flightinfo set destination = " + "'" + destination + "'" + " where flightno = " + "'" + flightno + "'");
35                 sql.Append("update flightinfo set leavetime = " + "'" + leavetime + "'" + " where flightno = " + "'" + flightno + "'");
36                 sql.Append("update flightinfo set landtime = " + "'" + landtime + "'" + " where flightno = " + "'" + flightno + "'");
37                 sql.Append("update flightinfo set price = " + "'" + price + "'" + " where flightno = " + "'" + flightno + "'");
38                 sql.Append("update flightinfo set total = " + "'" + total + "'" + " where flightno = " + "'" + flightno + "'");
39                 DBHelper helper = new DBHelper();
40  
41                 try
42                 {
43                     SqlCommand command = new SqlCommand(sql.ToString(), helper.Connection);
44                     helper.OpenConnection();
45                     //执行增删改
46                     int result = command.ExecuteNonQuery();
47                 }
48                 catch (Exception ex)
49                 {
50                     // Console.WriteLine(ex.Message);
51                     MessageBox.Show("发生错误,请联系管理员" + ex.Message);
52                 }
53                 finally
54                 {
55                     helper.CloseConnection();
56                 }
57                 txtflyno.Text = "";//取出账号
58                 txtairway.Text = "";
59                 txtleave.Text = "";
60                 txtarrive.Text = "";
61                 txtltime.Text = "";
62                 txtatime.Text = "";
63                 txtprice.Text = "";
64                 txtto.Text = "";
65             }
66  
67         }
航班信息管理

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

  图6-8 航班信息管理

(9)  用户信息管理代码及界面

 1 private void button1_Click(object sender, EventArgs e)
 2         {
 3             //检查是否已经存在
 4             string account1 = txtno.Text.Trim();  //取出账号
 5             string password1 = txtpw.Text.Trim();  //取出密码
 6             //连接数据库
 7             string constr = @"Data Source=.;Initial Catalog=MyTicket;User ID=20173967;Pwd=20173967";
 8             SqlConnection mycon = new SqlConnection(constr);                  //实例化连接对象
 9             mycon.Open();
10  
11             //查询新注册的用户是否存在
12             SqlCommand checkCmd = mycon.CreateCommand();       //创建SQL命令执行对象
13             string s = "select account1 from managertable where account1 ='" + account1 + "'";
14             checkCmd.CommandText = s;
15             SqlDataAdapter check = new SqlDataAdapter();       //实例化数据适配器
16             check.SelectCommand = checkCmd;                    //让适配器执行SELECT命令
17             DataSet checkData = new DataSet();                 //实例化结果数据集
18             int n = check.Fill(checkData, "register");         //将结果放入数据适配器,返回元祖个数
19             if (n != 0)
20             {
21                 MessageBox.Show("用户名存在");
22             }
23  
24             else if (txtno.Text == "" || txtpw.Text == "")
25             {
26                 MessageBox.Show("账号或密码不能为空!", "提示");
27             }
28             else
29             {
30                 MessageBox.Show("添加成功!", "提示");
31  
32                 StringBuilder sql = new StringBuilder();
33                 sql.Append("insert into managertable ([account1],[password1])");
34                 sql.AppendFormat(" Values ('{0}','{1}')  ", account1, password1);
35  
36                 DBHelper helper = new DBHelper();
37  
38                 try
39                 {
40                     SqlCommand command = new SqlCommand(sql.ToString(), helper.Connection);
41                     helper.OpenConnection();
42                     //执行增删改
43                     int result = command.ExecuteNonQuery();
44                 }
45                 catch (Exception ex)
46                 {
47                     // Console.WriteLine(ex.Message);
48                     MessageBox.Show("发生错误,请联系管理员" + ex.Message);
49                 }
50                 finally
51                 {
52                     helper.CloseConnection();
53                 }
54                 txtno.Text = "";
55                 txtpw.Text = "";
56             }
57         }
用户信息管理

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明

   图6-9 用户信息管理

(10)数据库连接代码 

数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明数据库系统开发——旅游公司机票查询及预订系统
摘   要
目录
第一章 需求分析
第二章 概念结构设计
第三章 逻辑结构设计
第四章 物理结构设计
第五章 数据库的实施
第六章 系统实现
第七章 总结
附:程序使用说明
 1 namespace BookTicket
 2 {
 3     static class Program
 4     {
 5         /// <summary>
 6         /// 应用程序的主入口点。
 7         /// </summary>
 8         [STAThread]
 9         static void Main()
10         {
11             Application.EnableVisualStyles();
12             Application.SetCompatibleTextRenderingDefault(false);
13             Application.Run(new FrmLogin());
14         }
15     }
16 }
数据库连接

第七章 总结

7.1 总结及心得体会

  通过这次课程设计,对数据库系统开发有了比较深入的了解。首先,我们领会到了系统分析的重要性,如:系统功能模块分析和设计、数据库需求分析和设计和数据库概念结构设计(E-R图),都在系统开发中占有重要的地位。在开始开发系统之前,要花费大量时间做好系统需求分析,这是系统开发的实用性,可行性,安全性的前提和保障。其次,在设计数据库过程中,边学习边实践,学会了数据库结构设计、存储过程及触发器的构建。在设计系统过程中,我们自主学习了c#语言,做出了符合本系统要求的可视化界面。

  本旅游公司机票查询及预订系统成功记录了航班信息、航空公司信息、用户登录和订单信息,可以通过显示的可视化页面有效的帮助用户查询航班信息和预定航班。通过本次小学期的自主实践,深刻了解了系统开发的全过程,同时也认识到自身开发经验的不足,为以后的学习积累经验并为以后的工作打下基础。

附:程序使用说明

本系统的数据库名称为MyTicket,账号为yuanyuan,密码为123456。

一、程序描述

  该系统为在SQL Server 2008与Visual Studio 2010环境下设计的旅游公司机票查询及预定系统,具有机票的查询和预定功能等。在SQL Server 2008中创建数据库MyTicket,在Visual Studio 2010中使用c#语言设计界面,并与SQL Server 2008数据库中数据库MyTicket连接。首先,使用者需要选择自己的身份:用户还是管理员,然后输入账号和密码登录该系统(新用户需注册账号密码),登录成功后通过用户可查询得到所需的机票,选择机票,预定机票,用户如果预定错误可以进行删除订单,重新选择订单。以上操作机票的库存数量均会自动进行修改;管理员可以增加,删除,修改机票信息和新管理员信息。

二、功能

  本系统主要用于机票查询和预定,所以提供以下四个子功能:

  1. 机票查询:用户通过输入出发地、目的地查询机票信息。
  2. 机票预定:查询出机票信息后,选择所需机票进行预定。
  3. 删除机票:如果已经预定的机票信息错误,可进行删除订单操作,重新预定。
  4. 机票信息和新管理员的增加、删除、修改:管理员登录系统后,可对机票信息和新管理员进行增加、删除和修改。

三、性能

  1. 输入信息要求精度:航班的基本信息,例如:出发地、目的地、出发时间、到达时间、预定数量、出发日期
  2. 适用范围:本系统适用于一般小型旅游公司预定机票。
  3. 运行环境:适用于一般需求的SQL Server 2008和Visual Studio 2010环境下运行。

四、变量数据

  1. account char
  2. password char
  3. id  int
  4. cityname nvarchar
  5. airways  nvarchar
  6. flightno  nvarchar
  7. leavecity int
  8. destination int
  9. leavetime nvarchar
  10. landtime nvarchar
  11. price money
  12. leavedate nvarchar
  13. orderid int
  14. number int
  15. name  char
  16. idcard  char

五、算法

  1. 用户输入账户和密码登录该系统,新用户需注册后登录。
  2. 管理员输入账户和密码登录该系统,新管理员需要原管理员帮其注册。
  3. 若需修改密码,则进入修改界面进行修改。
  4. 按照出发地、目的地的关键信息进行机票查询,若无相应机票信息不显示查询结果。
  5. 选择所需机票进行预定。
  6. 若预定失败,重新返回查询窗口,重新输入信息再次查询。
  7. 若需退票,则删除订单即可,删除成功后相应的库存数量会增加相应的票数。
  8. 当预定成功时,系统将给出预定成功的提示及订单号,将订票信息结果插入数据库中保存,预订成功后库存机票数量会相应地减少。
  9. 管理员可以对机票信息和新管理员信息进行增加、删除和修改