protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { User us = (User)Session["user"]; if (Session["user"] != null) { GridTransactionHistory.Columns[0].Visible = false; if (us.RoleID == 1) { // admin do something GridTransactionHistory.Columns[0].Visible = true; GridTransactionHistory.DataSource = TransactionHistoryController.getAllTransactionHistory(); GridTransactionHistory.DataBind(); } else { int userID = us.UserID; GridTransactionHistory.DataSource = TransactionHistoryController.getTransactionHistory(userID); GridTransactionHistory.DataBind(); } } else { Response.Redirect("home.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] != null) { int userId = Convert.ToInt32(Session["user"]); if (UserController.isAdmin(userId) == false) { viewTransactionHistory.DataSource = TransactionHistoryController.getAllTransactionHistoryById(userId); viewTransactionHistory.DataBind(); viewTransactionReport.Visible = false; } else { viewTransactionHistory.DataSource = TransactionHistoryController.getAllTransactionHistory(); viewTransactionHistory.DataBind(); } } else { Response.Redirect("/View/Home.aspx"); } }