public override void addReserveList(Reservation reserve) { for (int i = 0; i < 2; i++){ if (reserveList[i] == null){ reserveList[i] = reserve; break; } } }
public override void addReserveList(Reservation reserve) { if (reserveList.Length > 3) luckyDraw = true; for (int i = 0; i < 4; i++){ if (reserveList[i] == null){ reserveList[i] = reserve; break; } } }
private void btnBuyTrip_Click(object sender, EventArgs e) { string planeCode = txtPlaneCode.Text; string origin = txtOrigin.Text; string dest = txtDest.Text; string depTime = txtDepTime.Text; string arrTime = txtArrTime.Text; double prices = Convert.ToDouble(txtPrices.Text); AirCraft custCraft = new AirCraft(planeCode, origin, dest, depTime, arrTime, prices); Trips custTrip = new Trips(custCraft, numOfSeat); Reservation custReserve = new Reservation(custTrip, theCust, tripType); }
public ReservationDetail(Reservation r) { InitializeComponent(); dataBaseConn = new OleDbConnection(connString); reservation = r; loginID = r.getCustomer().getLoginID(); arriveT = txtArrive.Text = r.getTripInfo().getArrive().ToString(); code = txtCode.Text = r.getTripInfo().getCode().ToString(); departT = txtDepart.Text = r.getTripInfo().getDepart().ToString(); dest = txtDest.Text = r.getTripInfo().getDestination().ToString(); name = txtName.Text = r.getCustomer().getCustomerName(); origin = txtOrigin.Text = r.getTripInfo().getDepartFrom(); payment = txtPrice.Text = r.getTripInfo().getPrice().ToString(); }
private void btnConfirm_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Confirm booking", "Confirmation", MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.OK) { try { reservationConn.Open(); string selectString = "Select * from Trip where Code = @fc"; OleDbDataAdapter da = new OleDbDataAdapter(selectString, reservationConn); da.SelectCommand.Parameters.AddWithValue("@fc", flightCode); OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(da); DataTable dataTable = new DataTable(); da.Fill(dataTable); if (dataTable.Rows.Count > 0) { unitPrice = Convert.ToDouble(dataTable.Rows[0][5].ToString()); } reservationConn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); reservationConn.Close(); } try { for (int i = 0; i < seatName.Count; i++) { int col = Convert.ToInt32(seatName[i].Substring(1, 1)); char row = Convert.ToChar(seatName[i].Substring(0, 1)); reservationConn.Open(); cmd.Connection = reservationConn; cmd.CommandText = "INSERT INTO ReservationDetail ([LoginID], [FlightCode], [SeatRow], [SeatNumber])" + "VALUES('" + customer.getLoginID() + "','" + flightCode + "','" + row + "','" + col + "')"; int temp = cmd.ExecuteNonQuery(); if (temp > 0) { //MessageBox.Show("Update Seat Successfully!"); } else { MessageBox.Show("Not Able to update seat!"); } totalPrice += unitPrice; reservationConn.Close(); } MessageBox.Show("Update Seat Successfully!"); } catch (Exception err) { MessageBox.Show(err.Message); reservationConn.Close(); } this.Hide(); this.ti.setPrice(totalPrice); Reservation r = new Reservation(customer, this.ti, ""); ReservationDetail st = new ReservationDetail(r); st.ShowDialog(); } }
public abstract void addReserveList(Reservation reserve);