예제 #1
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.btnAddCoupons.Click += new System.EventHandler(this.btnAddCoupons_Click);
     if (CustomConfigHelper.Instance.IsSanzuo == true || CustomConfigHelper.Instance.BusinessName == "爽爽挝啡")
     {
         hidIsSanZuo.Value = "1";
         List <CategoryQuery> category = new List <CategoryQuery>();
         category = CouponHelper.GetHishop_Categories();
         DDLcategory.Items.Add("未选择");
         foreach (CategoryQuery ca in category)
         {
             ListItem item = new ListItem();
             item.Text  = ca.Name;
             item.Value = ca.CategoryId.ToString();
             DDLcategory.Items.Add(item);
         }
         List <CategoryQuery> clientuser = new List <CategoryQuery>();
         clientuser = CouponHelper.Getaspnet_ManagersClientUserId();
         DDLservice.Items.Add("未选择");
         foreach (CategoryQuery ct in clientuser)
         {
             ListItem item = new ListItem();
             item.Text  = ct.UserName;
             item.Value = ct.ClientUserId.ToString();
             DDLservice.Items.Add(item);
         }
     }
 }
예제 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!int.TryParse(this.Page.Request.QueryString["couponId"], out this.couponId))
            {
                base.GotoResourceNotFound();
            }
            else
            {
                this.btnEditCoupons.Click += new System.EventHandler(this.btnEditCoupons_Click);
                if (!this.Page.IsPostBack)
                {
                    if (CustomConfigHelper.Instance.IsSanzuo == true || CustomConfigHelper.Instance.BrandShow)
                    {
                        hidIsSanZuo.Value = "1";
                        List <CategoryQuery> category = new List <CategoryQuery>();
                        category = CouponHelper.GetHishop_Categories();
                        DDLcategory.Items.Add("未选择");
                        foreach (CategoryQuery ca in category)
                        {
                            ListItem item = new ListItem();
                            item.Text  = ca.Name;
                            item.Value = ca.CategoryId.ToString();
                            DDLcategory.Items.Add(item);
                        }
                        List <CategoryQuery> clientuser = new List <CategoryQuery>();
                        clientuser = CouponHelper.Getaspnet_ManagersClientUserId();
                        DDLservice.Items.Add("未选择");
                        foreach (CategoryQuery ct in clientuser)
                        {
                            ListItem item = new ListItem();
                            item.Text  = ct.UserName;
                            item.Value = ct.ClientUserId.ToString();
                            DDLservice.Items.Add(item);
                        }
                        CouponInfo coupon = CouponHelper.GetCoupon(this.couponId);
                        if (coupon == null)
                        {
                            base.GotoResourceNotFound();
                        }
                        else
                        {
                            if (coupon.ClosingTime.CompareTo(System.DateTime.Now) < 0)
                            {
                                this.ShowMsg("该优惠券已经结束!", false);
                            }
                            else
                            {
                                Globals.EntityCoding(coupon, false);
                                this.lblEditCouponId.Text = coupon.CouponId.ToString();

                                this.txtCouponName.Text = coupon.Name;
                                if (coupon.Amount.HasValue)
                                {
                                    this.txtAmount.Text = string.Format("{0:F2}", coupon.Amount);
                                }
                                this.txtDiscountValue.Text          = coupon.DiscountValue.ToString("F2");
                                this.calendarEndDate.SelectedDate   = new System.DateTime?(coupon.ClosingTime);
                                this.calendarStartDate.SelectedDate = new System.DateTime?(coupon.StartTime);
                                this.DDLcategory.SelectedValue      = coupon.CategoryId.ToString();
                                this.DDLservice.SelectedValue       = coupon.SenderId.ToString();
                                this.txtNeedPoint.Text = coupon.NeedPoint.ToString();
                            }
                        }
                    }
                }
            }
        }