为了正常的体验网站,请在浏览器设置里面开启Javascript功能!
首页 > 飞机航班订票系统

飞机航班订票系统

2017-11-23 43页 doc 348KB 32阅读

用户头像

is_792768

暂无简介

举报
飞机航班订票系统飞机航班订票系统 分类号 编 号 North China Institute of Water Conservancy and Hydroelectric Power 课程 软 件 工 程 题目 飞 机 航 班 订 票 系 统 院 系 专 业 小 组 长 小组成员1 小组成员2 指 导 教 师 2014年 6 月 15 日 华北水利水电学院 软件工程 实验报告 2013,2014学年 第 二 学期 2011 级 计算机科学与技术 专业 小 组 长 : 分工: 小组成员1: 分工: 小组成员2: ) ...
飞机航班订票系统
飞机航班订票系统 分类号 编 号 North China Institute of Water Conservancy and Hydroelectric Power 课程 软 件 工 程 目 飞 机 航 班 订 票 系 统 院 系 专 业 小 组 长 小组成员1 小组成员2 指 导 教 师 2014年 6 月 15 日 华北水利水电学院 软件工程 实验报告 2013,2014学年 第 二 学期 2011 级 计算机科学与技术 专业 小 组 长 : 分工: 小组成员1: 分工: 小组成员2: ) 分工: 一、 实验内容: 1、题目:飞机航班订票系统 2、问题定义:飞机航班订票系统 任务:通过此系统可以实现如下功能: (1)录入:录入航班信息(数据可以存储在一个数据文件中) (2)查询:可以查询某个航线的情况(如,输入航班号,查询起降时间,起飞抵达城市,航班票价,票价折扣,确定航班是否满仓);可以输入起飞抵达城市,查询飞机航班情况; 3)订票:(订票情况可以存在一个数据文件中) ( 可以订票,如果该航班已经无票,可以提供相关可选择航班; (4)退票: 可退票,退票后修改相关数据文件; 订票的客户信息有姓名,证件号,订票数量及航班,订单要有编号。 (5)修改航班信息:当航班信息改变可以修改航班数据文件。 3、需求规格说明 (1)、关系模式如下: 用户登录(用户名,密码,类别) 用户信息(身份证号,姓名,性别,用户名,联系电话) 航班信息(航班号,航班名,飞机型号,起始地,起飞时间,目的地, 到达时间,里程,票价,额定乘员,余票量,类别) 订单(订单号,航班号,身份证号,日期,订票数量) 退单(退单号,订单号,日期) 1 (2)数据库 本系统的数据库是SQL Serve数据库,在SQL数据库环境下创建数据库学生成绩管 理系统的文件,该数据库包括四个表记录存储内容; 各表的物理结构如下: 用户登录表: 用户信息表: 退单表: 2 航班信息表: 订单表: 各表之间的关系如下: 3 二、 设计说明: 程序流程图如下: 4 按航班 航班信息 号查 询 所有航用户信息 班信息 查 询 订单信息 退单信息 航班信息 录 入 单一信 息修改 航班信息 多项信修 改 息修改 飞 信息修改 机用户信息 管理员登录 航 班 密码修改 删 除 航班信息 订 票会员登录 安系 全统 查 询 退 出 订 票 退 票 改 签 5 各界面设计如下: 6 三、 程序源: using System; using System.Collections.Generic; using System.ComponentModel; 7 using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; namespace 飞机航班订票系统 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } static public string sn, sub; Form2 fr2 = new Form2(); Form3 fr3 = new Form3(); private void button1_Click(object sender, EventArgs e) { string str = "server=APRRZQZGRFJAP3I;Database=飞机航班订票系 统;Trusted_Connection=yes;"; SqlConnection conn = new SqlConnection(str); conn.Open(); if (textBox1.Text == "" || textBox2.Text == "") { MessageBox.Show("用户名或密码为空~"); } if (radioButton1.Checked) { string cstr = "select * from 用户登录 where 类别='管理员'and 用户名='" + textBox1.Text.Trim() + "'and 密码='" + textBox2.Text.Trim() + "' "; SqlCommand conm = new SqlCommand(cstr, conn); SqlDataReader dr = conm.ExecuteReader(); if (dr.Read()) { sn = textBox1.Text.Trim(); fr2.Show(); fr2.Text="亲爱的"+sn+",欢迎进入飞机航班订票系统~"; this.Visible = false; } else { MessageBox.Show("用户名或密码错误,请从新输入~"); textBox1.Text = ""; textBox2.Text = ""; } } if (radioButton2.Checked) { string cstr = "select * from 用户登录 where 类别='会员'and 用户名='" + textBox1.Text.Trim() + "'and 密码='" + textBox2.Text.Trim() + "' "; SqlCommand conm = new SqlCommand(cstr, conn); SqlDataReader dr = conm.ExecuteReader(); if (dr.Read()) { sn = textBox1.Text.Trim(); 8 fr2.Show(); fr2.Text = "亲爱的" + sn + ",欢迎进入飞机航班订票系统~"; this.Visible = false; } } conn.Close(); conn.Dispose(); } } } 2、系统界面如下: 代码如下: namespace 飞机航班订票系统 { public partial class Form2 : Form { public Form2() { InitializeComponent(); } Form3 fr3 = new Form3(); Form4 fr4 = new Form4(); Form5 fr5 = new Form5(); Form6 fr6 = new Form6(); static public int xb, xa; static public string str = "server=APRRZQZGRFJAP3I;Database=飞机航班订票系统;Trusted_Connection=yes;"; private void toolStripTextBox1_Click(object sender, EventArgs e) { Application.Exit(); } private void button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); if (radioButton1.Checked) { string cstr = "select* from 航班信息 where 起始地='" + textBox1.Text.Trim() + "'and 目的地= '" + textBox2.Text.Trim() + "'"; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("查找失败~"); } else { SqlDataAdapter da = new SqlDataAdapter(cstr, conn); DataSet ds = new DataSet(); da.Fill(ds, "table"); dataGridView1.DataSource = ds.Tables["table"].DefaultView; } } } private void 用户信息ToolStripMenuItem_Click(object sender, EventArgs e) 9 { SqlConnection conn = new SqlConnection(str); conn.Open(); string cstr = "select* from 用户信息"; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("查找失败"); } else { SqlDataAdapter da = new SqlDataAdapter(cstr, conn); DataSet ds = new DataSet(); da.Fill(ds, "table"); dataGridView1.DataSource = ds.Tables["table"].DefaultView; } conn.Close(); conn.Dispose(); } private void 订票信息ToolStripMenuItem_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); string cstr = "select* from 订单"; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("查找失败"); } else { SqlDataAdapter da = new SqlDataAdapter(cstr, conn); DataSet ds = new DataSet(); da.Fill(ds, "table"); dataGridView1.DataSource = ds.Tables["table"].DefaultView; } conn.Close(); conn.Dispose(); } private void 退票信息ToolStripMenuItem_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); string cstr = "select* from 退单"; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("查找失败"); } else { SqlDataAdapter da = new SqlDataAdapter(cstr, conn); DataSet ds = new DataSet(); da.Fill(ds, "table"); dataGridView1.DataSource = ds.Tables["table"].DefaultView; } 10 conn.Close(); conn.Dispose(); } private void 所有航班信息ToolStripMenuItem_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); string cstr = "select* from 航班信息"; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("查找失败"); } else { SqlDataAdapter da = new SqlDataAdapter(cstr, conn); DataSet ds = new DataSet(); da.Fill(ds, "table"); dataGridView1.DataSource = ds.Tables["table"].DefaultView; } conn.Close(); conn.Dispose(); } private void button1_Click_1(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); if (radioButton1.Checked) { string cstr = "select* from 航班信息 where 起始地='" + textBox1.Text.Trim() + "' and 目的地='" + textBox2.Text.Trim() + "'and 类别='单程'"; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("查找失败"); } else { SqlDataAdapter da = new SqlDataAdapter(cstr, conn); DataSet ds = new DataSet(); da.Fill(ds, "table"); dataGridView1.DataSource = ds.Tables["table"].DefaultView; } } if (radioButton2.Checked) { string cstr = "select* from 航班信息 where 起始地='" + textBox1.Text.Trim() + "' and 目的地='" + textBox2.Text.Trim() + "'and 类别='往返'"; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("查找失败"); } else { SqlDataAdapter da = new SqlDataAdapter(cstr, conn); 11 DataSet ds = new DataSet(); da.Fill(ds, "table"); dataGridView1.DataSource = ds.Tables["table"].DefaultView; } } if (radioButton3.Checked) { string cstr = "select* from 航班信息 where 起始地='" + textBox1.Text.Trim() + "' and 目的地='" + textBox2.Text.Trim() + "'and 类别='联程'"; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("查找失败"); } else { SqlDataAdapter da = new SqlDataAdapter(cstr, conn); DataSet ds = new DataSet(); da.Fill(ds, "table"); dataGridView1.DataSource = ds.Tables["table"].DefaultView; } } conn.Close(); conn.Dispose(); } private void 确定_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); label10.Text = dateTimePicker2.Value.ToString(); string cstr = "select* from 航班信息 where 航班号='" + textBox3.Text.Trim() + "'"; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("没有此航班~"); textBox3.Text = ""; } else { label7.Text=textBox4.Text.Trim().Substring(4,5) + dateTimePicker2.Value.ToString().Substring(11,8) + textBox3.Text.Trim(); string cstr2 = "insert into 订单 values('" + label7.Text.Trim() + "','" + textBox3.Text.Trim() + "','" + textBox4.Text.Trim() + "','" + label10.Text.Trim() + "',1)"; SqlCommand cm2 = new SqlCommand(cstr2, conn); string cstr3 = "update 航班信息 set 余票量张=余票量张-1 where 航班号=" + textBox3.Text.Trim() + ""; SqlCommand cm3 = new SqlCommand(cstr3, conn); if ( cm2.ExecuteNonQuery() == 1 && cm3.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,订票成功~" ); else MessageBox.Show("操作失败~~~"); } conn.Close(); conn.Dispose(); } 12 private void button2_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); label11.Text= textBox5.Text.Trim() +"1"; label12.Text = dateTimePicker2.Value.ToString(); string cstr1 = "insert into 退单 values('" + label11.Text.Trim() + "','" + textBox5.Text.Trim() + "','" + label12.Text.Trim() + "')"; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) { MessageBox.Show("退票成功~"); } else { MessageBox.Show("操作失败~请查看是否有此订单号或者是否已经退订~"); } conn.Close(); conn.Dispose(); } private void button3_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); string cstr = "select* from 订单 where 订单号=" + textBox7.Text.Trim() + ""; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("没有此订单~"); textBox7.Text = ""; } else { string cstr1 = "update 订单 set 航班号=" + textBox8.Text.Trim() + " where 订单号 =" + textBox7.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); string cstr2 = "update 航班信息 set 余票量张=余票量张-1 where 航班号=" + textBox8.Text.Trim() + ""; SqlCommand cm2 = new SqlCommand(cstr2, conn); string cstr3 = "update 航班信息 set 余票量张=余票量张+1 where 航班号 = (select 航班号 from 订单 where 订单号=" + textBox7.Text.Trim() + ""; SqlCommand cm3 = new SqlCommand(cstr3, conn); if (cm1.ExecuteNonQuery() == 1 && cm2.ExecuteNonQuery() == 1 && cm3.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,改签成功!"); else MessageBox.Show("操作失败~~~"); } conn.Close(); conn.Dispose(); } private void 航班信息ToolStripMenuItem2_Click(object sender, EventArgs e) { fr3.Show(); xb = 1; 13 } private void 按航班号查询ToolStripMenuItem_Click(object sender, EventArgs e) { fr4.Show(); xa = 1; } private void 输入航班号ToolStripMenuItem_Click(object sender, EventArgs e) { fr4.Show(); xa = 2; } private void 多项信息修改ToolStripMenuItem_Click(object sender, EventArgs e) { fr3.Show(); xb = 2; } private void 所有航班信息ToolStripMenuItem1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); string cstr = "delete from 航班信息 "; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,删除成功~"); else MessageBox.Show("操作失败~~~"); conn.Close(); conn.Dispose(); } private void 单一信息修改ToolStripMenuItem_Click(object sender, EventArgs e) { fr5.Show(); } private void 用户信息ToolStripMenuItem1_Click(object sender, EventArgs e) { fr6.Show(); } } } 录入航班信息界面如下: 代码如下: namespace 飞机航班订票系统 { public partial class Form3 : Form { public Form3() { InitializeComponent(); } 14 static public string str = "server=APRRZQZGRFJAP3I;Database=飞机航班订票系 统;Trusted_Connection=yes;"; private void button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); if (Form2.xb == 1) { string cstr1 = "insert into 航班信息 values('" + textBox1.Text.Trim() + "','" + textBox2.Text.Trim() + "','" + textBox3.Text.Trim() + "','" + textBox4.Text.Trim() + "','" + textBox5.Text.Trim() + "','" + textBox6.Text.Trim() + "','" + textBox7.Text.Trim() + "','" + textBox8.Text.Trim() + "', '" + textBox9.Text.Trim() + "','" + textBox10.Text.Trim() + "','" + textBox11.Text.Trim() + "','" + textBox12.Text.Trim() + "','" + comboBox1.Text.Trim() + "')"; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) { MessageBox.Show("恭喜你,录入成功~"); this.Visible = false; } else MessageBox.Show("操作失败~~~"); } if (Form2.xb == 2) { string cstr2 = "delete from 航班信息 where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm2 = new SqlCommand(cstr2, conn); string cstr3 = "insert into 航班信息 values('" + textBox1.Text.Trim() + "','" + textBox2.Text.Trim() + "','" + textBox3.Text.Trim() + "','" + textBox4.Text.Trim() + "','" + textBox5.Text.Trim() + "','" + textBox6.Text.Trim() + "','" + textBox7.Text.Trim() + "','" + textBox8.Text.Trim() + "', '" + textBox9.Text.Trim() + "','" + textBox10.Text.Trim() + "','" + textBox11.Text.Trim() + "','" + textBox12.Text.Trim() + "','" + comboBox1.Text.Trim() + "')"; SqlCommand cm3 = new SqlCommand(cstr3, conn); if (cm3.ExecuteNonQuery() == 1 && cm2.ExecuteNonQuery() == 1) { MessageBox.Show("恭喜你,修改成功~"); this.Visible = false; } else MessageBox.Show("操作失败~~~"); } conn.Close(); conn.Dispose(); } private void button2_Click(object sender, EventArgs e) { this.Visible = false; } } } 单一信息录入界面如下 代码如下: namespace 飞机航班订票系统 15 { public partial class Form4 : Form { public Form4() { InitializeComponent(); } static public string str = "server=APRRZQZGRFJAP3I;Database=飞机航班订票系 统;Trusted_Connection=yes;"; private void button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); if (Form2.xa == 1) { string cstr = "select* from 航班信息 where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("查找失败"); } else { SqlDataAdapter da = new SqlDataAdapter(cstr, conn); DataSet ds = new DataSet(); da.Fill(ds, "table"); dataGridView1.DataSource = ds.Tables["table"].DefaultView; } } if (Form2.xa == 2) { string cstr1 = "delete from 航班信息 where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,删除成功!"); else MessageBox.Show("操作失败~~~"); } conn.Close(); conn.Dispose(); } private void button2_Click(object sender, EventArgs e) { this.Visible = false; } } } 航班信息修改界面如下 代码如下: namespace 飞机航班订票系统 { public partial class Form5 : Form { public Form5() 16 { InitializeComponent(); } static public string str = "server=APRRZQZGRFJAP3I;Database=飞机航班订票系 统;Trusted_Connection=yes;"; private void button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); string cstr = "select* from 航班信息 where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("查找失败"); } else { SqlDataAdapter da = new SqlDataAdapter(cstr, conn); DataSet ds = new DataSet(); da.Fill(ds, "table"); dataGridView1.DataSource = ds.Tables["table"].DefaultView; } conn.Close(); conn.Dispose(); } private void button2_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); if (comboBox1.Text == "航班号") { string cstr1 = "update 航班信息 set 航班号=" + textBox2.Text.Trim() + " where 航 班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "航班名") { string cstr1 = "update 航班信息 set 航班名=" + textBox2.Text.Trim() + " where 航 班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "飞机型号") { string cstr1 = "update 航班信息 set 飞机型号=" + textBox2.Text.Trim() + " where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); 17 else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "起始地") { string cstr1 = "update 航班信息 set 起始地=" + textBox2.Text.Trim() + " where 航 班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "起飞时间") { string cstr1 = "update 航班信息 set 起飞时间=" + textBox2.Text.Trim() + " where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "目的地") { string cstr1 = "update 航班信息 set 目的地=" + textBox2.Text.Trim() + " where 航 班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "到达时间") { string cstr1 = "update 航班信息 set 到达时间=" + textBox2.Text.Trim() + " where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "里程千米") { string cstr1 = "update 航班信息 set 里程千米=" + textBox2.Text.Trim() + " where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "票价元") { string cstr1 = "update 航班信息 set 票价元=" + textBox2.Text.Trim() + " where 航 班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); 18 else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "折扣元") { string cstr1 = "update 航班信息 set 折扣元=" + textBox2.Text.Trim() + " where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "额定乘员") { string cstr1 = "update 航班信息 set 额定乘员=" + textBox2.Text.Trim() + " where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "余票量张") { string cstr1 = "update 航班信息 set 余票量张=" + textBox2.Text.Trim() + " where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } if (comboBox1.Text == "类别") { string cstr1 = "update 航班信息 set 类别=" + textBox2.Text.Trim() + " where 航班号=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } conn.Close(); conn.Dispose(); } private void button3_Click(object sender, EventArgs e) { this.Visible = false; } } } 6、用户信息修改界面如下 代码如下: namespace 飞机航班订票系统 { public partial class Form6 : Form 19 { public Form6() { InitializeComponent(); } static public string str = "server=APRRZQZGRFJAP3I;Database=飞机航班订票系 统;Trusted_Connection=yes;"; private void button2_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); string cstr2 = "delete from 用户信息 where 身份证号 = '" + textBox4.Text.Trim() + "'"; SqlCommand cm2 = new SqlCommand(cstr2, conn); string cstr1 = "insert into 用户信息 values('" + textBox4.Text.Trim() + "','" + textBox5.Text.Trim() + "','" + comboBox1.Text.Trim() + "','" + textBox7.Text.Trim() + "','" + textBox8.Text.Trim() + "')"; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1 && cm2.ExecuteNonQuery() ==2) MessageBox.Show("恭喜你,修改成功~"); else MessageBox.Show("操作失败~~~"); conn.Close(); conn.Dispose(); } private void button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); string cstr = "select* from 用户登录 where 用户名=" + textBox1.Text.Trim() + " and 密 =" + textBox2.Text.Trim() + ""; 码 SqlCommand cm = new SqlCommand(cstr, conn); if (cm.ExecuteScalar() == null) { MessageBox.Show("用户名或密码错误,请从新输入~"); textBox1.Text = ""; textBox2.Text = ""; } else { string cstr1 = "update 用户登录 set 密码=" + textBox3.Text.Trim() + " where 用户 名=" + textBox1.Text.Trim() + ""; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功!"); else MessageBox.Show("操作失败~~~"); } conn.Close(); conn.Dispose(); } private void button3_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(str); conn.Open(); string cstr1 = "insert into 用户信息 values('" + textBox4.Text.Trim() + "','" + 20 textBox5.Text.Trim() + "','" + comboBox1.Text.Trim() + "','" + textBox7.Text.Trim() + "','" + textBox8.Text.Trim() + "')"; SqlCommand cm1 = new SqlCommand(cstr1, conn); if (cm1.ExecuteNonQuery() == 1) MessageBox.Show("恭喜你,修改成功~"); else MessageBox.Show("操作失败~~~"); conn.Close(); conn.Dispose(); } private void button4_Click(object sender, EventArgs e) { this.Visible = false; } } } 四、 测试设计: 1、登陆界面测试如下 2、查询测试如下 21 3、订票系统测试 4、退票系统测试 5、改签系统测试 6、录入航班系统测试 22 7、修改航班系统测试 8、用户信息修改系统测试 9、按航班号查询航班信息测试如下; 23 五、测试结果: 此次试验比较成功,测试运行也比较流畅~但是,在测试的时候还是出现了一些小问题~例如在测试改签系统时。 不知出现了什么原因,一直出现错误,至于出错的原因,其实我也不太清楚~一开 始,我只是一直在测试一些不一样的数据,希望能找到其中的原因,但是没有结果~ 最后,我只好用VS2012调试代码,才发现其中的错误与原因,最后经过修改,才得 以实现。不过,我也知道,做出的软件肯定会有错误,但是失败之后不能灰心,要 再接再厉,争取做到更好~ 在此次试验中,我遇到最大的问题就是线程问题,每当我运行一次软件之后,再 运行的时候,总会遇到错误 ,系统提示是线程没有关。然后当通过任务管理器把飞 机航班订票系统的exe文件关闭之后,才可以继续运行~虽然我学过操作系统的有 关知识,但对此类问题的解决却不在自己能力范围之内!希望自己好好学习有关知 识,争取做出成功的软件~ 六、实验小结 经过半年多对软件工程的学习,在庄晋林老师的正确知道下,,终于成功进行了此次试验。此次试验对于我来说,不仅使自己复习了有关C#知识的基本用法,而且让自己 24 对数据库的掌握更深了一步。非常感谢老师半年多来对我们的悉心培育,也非常感谢我的团队,我的两个队友~ 作为组长,代码我承担了代码的主要编写工作和后期的完善修改, 在写码的过程整体来说不是很难,因为有以前数据结构的基础加上之前对于图的深入构想,整体还是比较上手的,遇到的问题主要是对于订票数量的边界值没有一个准确的把握,在测试过程中,频频报错,我们通过用等价划分的解决了输入报错的问题,使系统更加完美了。当然,该售票系统在刚完成时,有很多功能bug,经过我们三个人加班加点的亲密合作 逐一排除系统不完善的部分,并使系统相对完美。在本次实验,学到了团队合作的重要性,分工的高效性。 此次实验,让我大大地感觉到,对于程序设计中,对语言再熟悉也比不过在设计中算法和结构分析的真知灼见。当然,成功的程序设计是要建立在熟悉语言的基础之上的。树立广阔的软件大思想,平时语言的基本功要扎实。而每一次程序设计的经营能大大地增加对语言的熟悉和感知。程序设计的技能来自多方面,每一次的亲自实践、思考揣摩、刨根问底就会让自己更加清楚所欠缺的是什么。所以,现在觉得在设计实践中作为参考的书册阅读和研究远远比过单纯的阅读,因为它是在最紧迫的时间上填补自己最紧迫的不足。 此次实践语言采用的是C#语言进行开发,系统主要分别为以下6个窗体分别编码,再对每个窗体中的控件进行单独编码。在前3次的需求分析和制作的基础上,有效的制作出了6个窗体设计。测试部分:根据系统用例及所实现的系统功能,我编写4-5个具有代表性的测试用例(相关实例以及结果见相关截图)。比如说针对各种可能出现错误的情况也进行了测试,选择了错误的航班号,选择了错误的座位号,机票全部被预定,机票全部被取消等等。总的来说,通过我们组的努力和庄晋林老师的帮助下,我们组顺利完成了这次实验设计。 25 书中横卧着整个过去的灵魂——卡莱尔 人的影响短暂而微弱,书的影响则广泛而深远——普希金 人离开了书,如同离开空气一样不能生活——科洛廖夫 书不仅是生活,而且是现在、过去和未来文化生活的源泉 ——库法耶夫 书籍把我们引入最美好的社会,使我们认识各个时代的伟大智者———史美尔斯 书籍便是这种改造灵魂的工具。人类所需要的,是富有启发性的养料。而阅读,则正是这种养料———雨果
/
本文档为【飞机航班订票系统】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索