网上机票预订系统课程设计(3)

2018-11-30 14:54

? 管理员界面的航线信息界面对航线信息的添加、修改、删除和查询,包括

航线编号、出发城市、到达城市、航班日期、出发时间、到达时间、客机编号、经济舱价格、公务舱价格、头等舱价格和备注信息等。

? 客户查询及预订界面

四、详细设计

4.1 窗体代码设计

(1) 订票代码

private void Pice() {

if (txtId.Text.Trim() == \) {

MessageBox.Show(\请填写航班号\, \提示\, MessageBoxButtons.OK, MessageBoxIcon.Information); txtId.Focus(); }

else if (txtPice.Text.Trim() == \) {

MessageBox.Show(\请填写您要预订的票数\, MessageBoxButtons.OK, MessageBoxIcon.Information); txtPice.Focus(); }

else if (cboType.Text.Trim() == \) {

MessageBox.Show(\请选择类型\, \提示\, MessageBoxButtons.OK, MessageBoxIcon.Information); cboType.Focus(); }

else if (txtFromTime.Text.Trim() == \) {

MessageBox.Show(\请填写日期\, \提示\, MessageBoxButtons.OK, MessageBoxIcon.Information); txtFromTime.Focus(); } else {

Priced(); } }

private void Priced() {

string message = \; int Num = 0;

int bookSeatNum = 0;

\提示\, int Pice = Convert.ToInt32(txtPice.Text); try {

string Dayth = txtFromTime.Text; string Type = cboType.Text;

string sql = string.Format(\OrderInfo where FlightNo='{0}' and LeaveDate='{1}' and SeatType = '{2}' \, txtId.Text, Dayth, Type);

SqlCommand command = new SqlCommand(sql, DBHepler.connection);

DBHepler.connection.Open();

if (!(command.ExecuteScalar() is DBNull)) {

bookSeatNum =

Convert.ToInt32(command.ExecuteScalar());

MessageBox.Show(bookSeatNum.ToString()); } }

catch (Exception ex) {

MessageBox.Show(ex.Message); }

finally {

DBHepler.connection.Close(); }

switch (cboType.Text) {

case \头等舱\:

Num = 8 - bookSeatNum;

//MessageBox.Show(Num.ToString()); break;

case \经济舱\:

Num = 160 - bookSeatNum;

//MessageBox.Show(Num.ToString()); break; }

if (Pice >= Num) {

message = string.Format(\剩余客票只有{0}请选择其他航班!\, Num);

MessageBox.Show(message, \温馨提示\,

MessageBoxButtons.OK, MessageBoxIcon.Information); } else {

Rearch(); } }

(2)实时更新预定信息

private void Rearch() {

int rs = 0;

DBHepler.connection.Open();

string sql = string.Format(\OrderInfo(FlightNo,LeaveDate,SeatType,Number) values

('{0}','{1}','{2}','{3}')\, txtId.Text, txtFromTime.Text, cboType.Text, txtPice.Text);

SqlCommand command = new SqlCommand(sql,DBHepler.connection);

rs = command.ExecuteNonQuery(); DBHepler.connection.Close(); if (rs == 1) {

MessageBox.Show(\预定成功\, \提示\, MessageBoxButtons.OK, MessageBoxIcon.Information); DBHepler.connection.Open();

string SQL = string.Format(\where OrderInfo.FlightNo='\+txtId.Text.ToString()+\LeaveDate='\+txtFromTime.Text.ToString()+\SeatType='\+cboType.Text.ToString()+\Number='\+txtPice.Text+\);

SqlCommand comm = new SqlCommand(SQL, DBHepler.connection);

SqlDataReader dataRead = comm.ExecuteReader(); if (dataRead.Read()) {

string s = \;

s = Convert.ToInt32(dataRead[\]).ToString(); MessageBox.Show(\符合你的打印ID号有:\ +Environment.NewLine+ s, \打印ID号\); }

dataRead.Close();

DBHepler.connection.Close();

} else {

MessageBox.Show(\预定失败\, \提示\, MessageBoxButtons.OK, MessageBoxIcon.Information); } } (3)删除航班

private void btndelete_Click(object sender, EventArgs e) {

if (ticketInfoDataGridView.CurrentCell.RowIndex < -1) {

return; } else {

ticketInfoDataGridView.Rows.RemoveAt(ticketInfoDataGridView.CurrentCell.RowIndex);

ticketInfoTableAdapter.Update(ticketDataSet); MessageBox.Show(\删除成功!\操作提示\ } }

4.2 数据库设计 4.2.1 系统登陆设计

4.2.2 航班信息设计


网上机票预订系统课程设计(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:武汉市七一中学2018-2019学年度下学期五月检测八年级语文试题无

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: