protected void gvReservations_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "CancelReservation") { Customer CustLoginID = (Customer)Session["login"]; CustomerDAO CustomerDAO = new CustomerDAO(CustLoginID.CustomerId, CustLoginID.Password); int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvReservations.Rows[index]; CustomerDAO.CancelVehicleReservation(row.Cells[0].Text); //re populate grid view here ReservationDAO ReservationDAO = new ReservationDAO(CustLoginID.CustomerId, CustLoginID.Password); gvReservations.DataSource = ReservationDAO.GetReservations(); gvReservations.Columns[0].Visible = true; gvReservations.DataBind(); gvReservations.Columns[0].Visible = false; } if (gvReservations.Rows.Count == 0) { lblNoReservations.Visible = true; gvReservations.Visible = false; } else { lblNoReservations.Visible = false; gvReservations.Visible = true; } }
public void GetReservationsTests() { ReservationDAO dao = new ReservationDAO(connectionString); //arrange IList <Reservation> reservations = dao.GetReservations(); //act Assert.AreEqual(1, reservations.Count); //assert }
// GET: Reservations/ReservationsList public ActionResult ReservationsList() { //implement reservationDAO to get list + datatables w edit and delete var list = ReservationDAO.GetReservations(); return(View(list)); }
public void GetReservations_Test() { // ARRANGE IReserveDAO reservation = new ReservationDAO(connectionString); bool found = false; // ACT IList <Reservation> reservations = reservation.GetReservations(); foreach (Reservation reserve in reservations) { if (reserve.reservation_id == 400) { found = true; break; } } // ASSERT Assert.IsTrue(found); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Customer CustLoginID = (Customer)Session["login"]; if (null != CustLoginID) { lblCustName.Text = "Customer : " + CustLoginID.LastName + ", " + CustLoginID.FirstName; } else { lblCustName.Text = "Customer Information not found."; } //get list of reservations ReservationDAO ReservationDAO = new ReservationDAO(CustLoginID.CustomerId, CustLoginID.Password); gvReservations.DataSource = ReservationDAO.GetReservations(); gvReservations.Columns[0].Visible = true; gvReservations.DataBind(); gvReservations.Columns[0].Visible = false; if (gvReservations.Rows.Count == 0) { lblNoReservations.Visible = true; gvReservations.Visible = false; } else { lblNoReservations.Visible = false; gvReservations.Visible = true; } } }