protected void BtnCheckout_Click(object sender, EventArgs e) { GridView2.Visible = true; LabelChoose.Visible = true; GridView2.DataSource = ViewPaymentTypeController.FetchDataPaymentType(); GridView2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!ViewPaymentTypeController.checkIsUserPermittedToAccess()) { userWarnLbl.Text = "You are not authorized to access this page!"; insertBtn.Visible = false; } else { load_data(); } }
protected void deleteBtn_Click(object sender, EventArgs e) { int id = Convert.ToInt32((sender as LinkButton).CommandArgument); if (ViewPaymentTypeController.requestDelete(id)) { Response.Redirect("./ViewPaymentType.aspx"); } else { warningLbl.Text = "Cannot delete current payment. Still referenced on another table"; } }
private void load_data() { List <PaymentType> vPT = ViewPaymentTypeController.getPaymentTypeList(); if (vPT.Count == 0) { paymentWarning.Text = "No data in database."; } else { paymentGrid.DataSource = vPT; paymentGrid.DataBind(); } }
private void showData() { List <PaymentType> allPaymentType = ViewPaymentTypeController.GetAllPaymentTypeController(); for (int i = 0; i < allPaymentType.Count; i++) { TableRow rows = new TableRow(); paymentTable.Controls.Add(rows); TableCell idCell = new TableCell(); idCell.Controls.Add(new Label() { Text = allPaymentType[i].ID.ToString() }); rows.Cells.Add(idCell); TableCell nameCell = new TableCell(); nameCell.Controls.Add(new Label() { Text = allPaymentType[i].Type.ToString() }); rows.Cells.Add(nameCell); TableCell editBtnCell = new TableCell(); Button editBtn = new Button() { Text = "Update", ID = (i + 1) + "E" }; editBtn.Click += updatePayment; editBtnCell.Controls.Add(editBtn); rows.Cells.Add(editBtnCell); TableCell delBtnCell = new TableCell(); Button delBtn = new Button() { Text = "Delete", ID = (i + 1) + "D" }; delBtn.Click += deletePayment; delBtnCell.Controls.Add(delBtn); rows.Cells.Add(delBtnCell); } }
private void deletePayment(object sender, EventArgs e) { Button currBtn = (Button)sender; int selectedRowIndex = 0; if (int.TryParse(currBtn.ID.Substring(0, currBtn.ID.Length - 1), out selectedRowIndex)) { int id = int.Parse(((Label)paymentTable.Rows[selectedRowIndex].Cells[0].Controls[0]).Text); string errorMessage = ""; if (ViewPaymentTypeController.DeletePaymentTypeController(id, out errorMessage) == false) { Response.Redirect("ViewPaymentType.aspx"); } else { errorMsg.Text = errorMessage; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["LoginSession"] == null) { Response.Redirect("../HomeView/Home.aspx"); } else { String ID = Session["LoginSession"].ToString(); MsUser user = HomeController.FetchDataForHome(ID); if (user.RoleID != "RL1") { Response.Redirect("../HomeView/Home.aspx"); } else { GridView1.DataSource = ViewPaymentTypeController.FetchDataPaymentType(); GridView1.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["user"] != null) { User us = (User)Session["user"]; if (us.RoleID == 1) { GridViewPayment.DataSource = ViewPaymentTypeController.getAllPaymentType(); GridViewPayment.DataBind(); } else { Response.Redirect("Home.aspx"); } } else { Response.Redirect("Home.aspx"); } } }