Example #1
0
        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;
            }
        }
Example #2
0
        public void GetReservationsTests()
        {
            ReservationDAO      dao          = new ReservationDAO(connectionString); //arrange
            IList <Reservation> reservations = dao.GetReservations();                //act

            Assert.AreEqual(1, reservations.Count);                                  //assert
        }
Example #3
0
        // GET: Reservations/ReservationsList
        public ActionResult ReservationsList()
        {
            //implement reservationDAO to get list + datatables w edit and delete

            var list = ReservationDAO.GetReservations();

            return(View(list));
        }
Example #4
0
        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);
        }
Example #5
0
        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;
                }
            }
        }