Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            FormsAuthenticationTicket cookie = FormsAuthentication.Decrypt(HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName].Value);

            _reservationDao            = new ReservationDAO();
            ReservationGrid.DataSource = _reservationDao.GetReservationsByUserId(int.Parse(cookie.Name));
            ReservationGrid.DataBind();
            _userDao = new UserDao();
            foreach (GridViewRow r in ReservationGrid.Rows)
            {
                if (_reservationDao.GetReservationByReservationId(r.Cells[1].Text).Status != Status.Reserved)
                {
                    r.Cells[0].Controls.Clear();
                }
                Name.Text = _userDao.GetUserById(int.Parse(Context.User.Identity.Name)).FirstName;
            }
        }
Example #2
0
        protected void BtnFindReservation_Click(object sender, EventArgs e)
        {
            Reservation r = _reservationDAO.GetReservationByReservationId(TxtReservationId.Text);

            if (r == null)
            {
                ErrResId.Text = "Reservation Does not Exist!";
            }
            else
            {
                resInfo.Visible     = true;
                hostInfo.InnerText  = $"Host: {r.Host.FirstName}  {r.Host.LastName}";
                timeInfo.InnerText  = $"Reservation Date: {r.ReservationDate.Date} {r.ReservationDate.TimeOfDay.Hours - 12}PM";
                tableNum.InnerText  = $"Table Number: {r.TableNumber}";
                appetizer.InnerText = $"Appetizer: {r.Appetizer.Name}";
                main.InnerText      = $"Main: {r.Main.Name}";
                dessert.InnerText   = $"Dessert: {r.Dessert.Name}";
            }
        }