Example #1
0
 //Add new discounts with exception handling
 protected void AddDiscount_Click(object sender, EventArgs e)
 {
     try {
         DiscountGridView.Visible = false;
         BusinessLogic.CreateCategoryDiscount(DiscIDTB.Text, short.Parse(CatDisAmt.Text), Calendar3.SelectedDate, Convert.ToInt32(DisDur.Text), Convert.ToInt32(CategoryDDL.SelectedValue));
         DiscLabel.Text            = "Promo Created!";
         DiscIDTB.Text             = "";
         CatDisAmt.Text            = "";
         DisDur.Text               = "";
         CategoryDDL.SelectedIndex = 0;
         Calendar3.SelectedDate    = DateTime.Today;
         DiscLabel.Text            = "Successfully created discount!";
     }
     catch (Exception)
     { DiscLabel.Text = "Please enter a unique DiscountID"; }
 }