protected void Page_Load(object sender, EventArgs e) { Member currUser = (Member)Session["userLogin"]; if (Session["userLogin"] == null) { Response.Redirect("Login.aspx"); } else if (currUser.Type == "Customer") { Response.Redirect("Login.aspx"); } else { loadData(); String promoTitle = Request.QueryString["promoTitle"]; if (promoTitle != null) { editPromo = PromotionRepositories.getPromo(promoTitle); if (!Page.IsPostBack) { txtTitle.Text = editPromo.Title; txtDiscount.Text = editPromo.Discount.ToString(); txtDescription.Text = editPromo.Description; } } } }
protected void viewPromotion_RowDeleting(object sender, GridViewDeleteEventArgs e) { String promoTitle = viewPromotion.Rows[e.RowIndex].Cells[0].Text; Promotion x = PromotionRepositories.getPromo(promoTitle); int row = PromotionRepositories.deletePromot(x); lblErrProm.Text = "Deletion Success!"; if (row > 0) { loadData(); } }
public static Promotion getPromo(String title) { return(PromotionRepositories.getPromo(title)); }