protected void Page_Load(object sender, EventArgs e) { _userDao = new UserDao(); _reservationDAO = new ReservationDAO(); if (!IsPostBack) { ReservationGrid.DataSource = _reservationDAO.ReadAll(Status.Reserved); ReservationGrid.DataBind(); Name.Text = _userDao.GetUserById(int.Parse(Context.User.Identity.Name)).FirstName; } }
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; } }