示例#1
0
    protected void createCoupon_Click(object sender, EventArgs e)
    {
        ViewState["CouponEditing"] = null;
        editCouponPanel.Controls.Clear();
        editCouponPanel.Visible = true;

        CouponType newCouponType =
            CouponType.GetCouponType(int.Parse(ddlCouponTypes.SelectedValue));

        LoadNewCouponEditor(newCouponType);
    }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if ((bool)ViewState["IsNew"])
     {
         PercentOffCoupon pctOffCoupon = new PercentOffCoupon(
             txtCouponCode.Text, CouponType.GetCouponType((int)ViewState["CouponTypeId"]));
         FillCouponValiues(pctOffCoupon);
     }
     else
     {
         PercentOffCoupon pctOffCoupon =
             (PercentOffCoupon)Coupon.GetCoupon(txtCouponCode.Text);
         FillCouponValiues(pctOffCoupon);
     }
 }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         BindCoupons();
         ddlCouponTypes.DataSource = new Query("CSK_CouponTypes").ExecuteReader();
         ddlCouponTypes.DataBind();
     }
     if (ViewState["CouponEditing"] != null)
     {
         string couponCode = (string)ViewState["CouponEditing"];
         LoadCouponEditor(couponCode);
     }
     if (ViewState["NewCouponType"] != null)
     {
         int        newCouponTypeId = (int)ViewState["NewCouponType"];
         CouponType newCouponType   = CouponType.GetCouponType(newCouponTypeId);
         LoadNewCouponEditor(newCouponType);
     }
 }