? 管理员界面的航线信息界面对航线信息的添加、修改、删除和查询,包括
航线编号、出发城市、到达城市、航班日期、出发时间、到达时间、客机编号、经济舱价格、公务舱价格、头等舱价格和备注信息等。
? 客户查询及预订界面
四、详细设计
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 航班信息设计
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库网上机票预订系统课程设计(3)在线全文阅读。
相关推荐: