protected void Page_Load(object sender, EventArgs e) { if (Session[SessionVariables.UserIdInSession] == null) { Response.Redirect("~/AccountManagement/Logout.aspx"); } if (Session[SessionVariables.UserIdInSession] != null) { var currentlyLoggedInUser = PageDataService.GetUserByIdInAdoNet(Convert.ToInt32(Session[SessionVariables.UserIdInSession].ToString())); var isAdmin = PageDataService.IsUserAdminEntityFrameWork(currentlyLoggedInUser.UserId); txtStudentDiscount.Enabled = isAdmin; } }
protected override void OnInit(EventArgs e) { if (HttpContext.Current.Session[SessionVariables.UserIdInSession] != null) { var currentlyLoggedInUser = PageDataService.GetUserByIdInAdoNet(Convert.ToInt32(Session[SessionVariables.UserIdInSession].ToString())); var isAdmin = PageDataService.IsUserAdminEntityFrameWork(currentlyLoggedInUser.UserId); if (!isAdmin) { Response.Redirect("/AccountManagement/Logout.aspx", false); } } }
protected void ApproveFeeDetailsOfStudent(object sender, EventArgs e) { var transactionDetail = PageDataService.GetTransactionDetailByTransactionDetailIdAdoNet(Convert.ToInt32(hdnTransactionDetailId.Value)); if (Session[SessionVariables.UserIdInSession] != null && transactionDetail != null) { var currentlyLoggedInUser = PageDataService.GetUserByIdInAdoNet(Convert.ToInt32(Session[SessionVariables.UserIdInSession].ToString())); var isAdmin = PageDataService.IsUserAdminEntityFrameWork(currentlyLoggedInUser.UserId); if (isAdmin && chkReject != null && chkApprove != null) { PageDataService.UpdateTransactionDetailByTransactionIdAdoNet(transactionDetail.TransactionDetailsId, chkReject.Checked, chkApprove.Checked); Response.Redirect(Request.RawUrl, false); } } }