Exemplo n.º 1
0
 //Cancel Edit for DiscountGridView
 protected void DiscountGridView_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
 {
     DiscountGridView.EditIndex  = -1;
     DiscountGridView.DataSource = BusinessLogic.CDiscount();
     DiscountGridView.DataBind();
     Label8.Text = "";
 }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         PromoGridView.DataSource = BusinessLogic.Promos();
         PromoGridView.DataBind();
         DiscountGridView.DataSource = BusinessLogic.CDiscount();
         DiscountGridView.DataBind();
         CategoryDDL.DataSource     = BusinessLogic.Cats();
         CategoryDDL.DataTextField  = "Name";
         CategoryDDL.DataValueField = "CategoryID";
         CategoryDDL.DataBind();
     }
 }
Exemplo n.º 3
0
        //Update Discounts with exception handling
        protected void DiscountGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                GridViewRow row              = DiscountGridView.Rows[e.RowIndex];
                string      discountId       = (row.FindControl("Label1") as Label).Text;
                short       discountAmt      = short.Parse((row.FindControl("TextBox2") as TextBox).Text);
                DateTime    validStart       = (row.FindControl("Calendar3") as Calendar).SelectedDate;
                int         discountDuration = Convert.ToInt32((row.FindControl("TextBox4") as TextBox).Text);
                int         catID            = Convert.ToInt32((row.FindControl("DDL5") as TextBox).Text);

                BusinessLogic.UpdateCategoryDiscount(discountId, discountAmt, validStart, discountDuration, catID);

                DiscountGridView.EditIndex = -1;

                DiscountGridView.DataSource = BusinessLogic.CDiscount();
                DiscountGridView.DataBind();
                Label8.Text = "Update success!";
            }
            catch (Exception)
            {
                Label8.Text = "Please input a valid discount amount, duration and category.";
            }
        }
Exemplo n.º 4
0
 //Unhide DiscountGrid & bind data
 protected void DiscountAmend_Click(object sender, EventArgs e)
 {
     DiscountGridView.DataSource = BusinessLogic.CDiscount();
     DiscountGridView.DataBind();
     DiscountGridView.Visible = true;
 }
Exemplo n.º 5
0
 //Edit DiscountGridView
 protected void DiscountGridView_RowEditing(object sender, GridViewEditEventArgs e)
 {
     DiscountGridView.EditIndex  = e.NewEditIndex;
     DiscountGridView.DataSource = BusinessLogic.CDiscount();
     DiscountGridView.DataBind();
 }