Пример #1
0
        private void BindMemInfo(int MemID)
        {
            Chain.Model.Mem modelMem = new Chain.BLL.Mem().GetModel(MemID);
            this.spMemCard.InnerHtml = modelMem.MemCard;
            this.spMemName.InnerHtml = modelMem.MemName.ToString();
            List <Chain.Model.SysShopMemLevel> list = new Chain.BLL.SysShopMemLevel().GetModelList(string.Format(" ShopID=1 and MemLeveLID={0} ", modelMem.MemLevelID));

            if (list.Count > 0)
            {
                Chain.Model.MemLevel mdlMemLevel = new Chain.BLL.MemLevel().GetModel(modelMem.MemLevelID);
                if (list[0].ClassRechargePointRate > 0m)
                {
                    this.txtPointRate.Value = list[0].ClassRechargePointRate.ToString();
                }
                else
                {
                    this.txtPointRate.Value = "0";
                }
            }
        }
Пример #2
0
 protected void btnSetLevel_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(base.Request["MemLevelID"]))
     {
         Chain.Model.MemLevel        mdMemLevel        = new Chain.Model.MemLevel();
         Chain.BLL.SysShopMemLevel   ShopMemLevelBLL   = new Chain.BLL.SysShopMemLevel();
         Chain.Model.SysShopMemLevel ModelShopMemLevel = new Chain.Model.SysShopMemLevel();
         mdMemLevel.LevelDiscountPercent = Convert.ToDecimal(this.txtLevelDiscountPercent.Value.Trim()) / 100m;
         if (this.txtLevelPointPercent.Value != "" && this.txtLevelPointPercent.Value != "0")
         {
             mdMemLevel.LevelPointPercent = ((Convert.ToDecimal(this.txtLevelPointPercent.Value.Trim()) == 0m) ? 0m : Convert.ToDecimal(this.txtLevelPointPercent.Value.Trim()));
         }
         else
         {
             base.MessagePageShowError("快速消费-积分比率输入错误,必须为大于等于0的正整数!");
         }
         mdMemLevel.LevelName  = this.txtLevelName.Value.Trim();
         mdMemLevel.LevelPoint = Convert.ToInt32(this.txtLevelPoint.Value.Trim());
         mdMemLevel.LevellLock = this.chkLevellLock.Checked;
         int flag = this.bllMemLevel.Add(mdMemLevel);
         if (flag > 0)
         {
             Chain.BLL.SysShop shop = new Chain.BLL.SysShop();
             for (int i = 1; i < shop.GetMaxId(); i++)
             {
                 ModelShopMemLevel.ShopID                 = i;
                 ModelShopMemLevel.MemLevelID             = this.bllMemLevel.GetMaxId() - 1;
                 ModelShopMemLevel.ClassDiscountPercent   = Convert.ToDecimal(this.txtLevelDiscountPercent.Value.Trim()) / 100m;
                 ModelShopMemLevel.ClassPointPercent      = ((Convert.ToDecimal(this.txtLevelPointPercent.Value.Trim()) == 0m) ? 0m : Convert.ToDecimal(this.txtLevelPointPercent.Value.Trim()));
                 ModelShopMemLevel.ClassRechargePointRate = ((Convert.ToDecimal(this.txtLevelRechargePointRate.Value.Trim()) == 0m) ? 0m : Convert.ToDecimal(this.txtLevelRechargePointRate.Value.Trim()));
                 int dsasd = ShopMemLevelBLL.Add(ModelShopMemLevel);
             }
             ArrayList sqlArray                = new ArrayList();
             string    strSqlColumn            = "INSERT INTO GoodsClassDiscount (GoodsClassID,MemLevelID,ClassDiscountPercent,ClassPointPercent,DiscountShopID) VALUES ('{0}','{1}','{2}','{3}','{4}')";
             string    strAllSql               = string.Empty;
             string    GoodsClassID            = string.Empty;
             int       MemLevelID              = flag;
             string    strClassDiscountPercent = string.Empty;
             decimal   decClassDiscountPercent = 100m;
             string    ClassDiscountPercent    = string.Empty;
             string    strClassPointPercent    = string.Empty;
             decimal   decClassPointPercent    = 1m;
             string    ClassPointPercent       = string.Empty;
             for (int i = 0; i < this.rptShopClassLevel.Items.Count; i++)
             {
                 strAllSql               = strSqlColumn;
                 GoodsClassID            = ((Literal)this.rptShopClassLevel.Items[i].FindControl("ltClassID")).Text;
                 strClassDiscountPercent = ((HtmlInputText)this.rptShopClassLevel.Items[i].FindControl("txtDiscountPercent")).Value.Trim();
                 if (decimal.TryParse(strClassDiscountPercent, out decClassDiscountPercent))
                 {
                     ClassDiscountPercent = (decClassDiscountPercent / 100m).ToString();
                 }
                 else
                 {
                     ClassDiscountPercent = "1.00";
                 }
                 strClassPointPercent = ((HtmlInputText)this.rptShopClassLevel.Items[i].FindControl("txtPointPercent")).Value.Trim();
                 if (decimal.TryParse(strClassPointPercent, out decClassPointPercent))
                 {
                     ClassPointPercent = ((strClassPointPercent == "0") ? "0" : decClassPointPercent.ToString());
                 }
                 else
                 {
                     ClassPointPercent = ((strClassPointPercent == "0") ? "0" : "1");
                 }
                 strAllSql = string.Format(strAllSql, new object[]
                 {
                     GoodsClassID,
                     MemLevelID,
                     ClassDiscountPercent,
                     ClassPointPercent,
                     this._UserShopID
                 });
                 sqlArray.Add(strAllSql);
             }
             if (this.bllGoodsClassDiscount.AddList(sqlArray))
             {
                 string strSql = "INSERT INTO GoodsClassDiscount (GoodsClassID,MemLevelID,DiscountShopID,ClassDiscountPercent,ClassPointPercent) ";
                 strSql += string.Format("(SELECT GoodsClass.ClassID,{0},ShopID,1,1 FROM GoodsClass inner join GoodsClassAuthority on GoodsClass.ClassID = GoodsClassAuthority.ClassID WHERE ShopID <> {1})", MemLevelID, this._UserShopID);
                 DbHelperSQL.ExecuteSql(strSql);
                 this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "message", "<Script Language='JavaScript' defer>art.dialog({title: '系统提示',time: 2,content:'保存成功',close: function () { location.href = 'SetLevel.aspx?PID=5'; }});</script>");
             }
             else
             {
                 this.bllMemLevel.Delete(flag);
                 base.MessagePageShowError("保存失败,请重试!");
             }
         }
         else
         {
             string strError = "保存失败,请重试!";
             if (flag == -1)
             {
                 strError = "已存在所需积分的会员等级,请重新输入!";
             }
             base.MessagePageShowError(strError);
         }
     }
     else
     {
         int MemLevelID     = Convert.ToInt32(base.Request["MemLevelID"]);
         int ShopMemLevelID = Convert.ToInt32(base.Request["ShopMemLevelID"]);
         Chain.Model.MemLevel mdMemLevel = this.bllMemLevel.GetModel(MemLevelID);
         mdMemLevel.LevelName  = this.txtLevelName.Value.Trim();
         mdMemLevel.LevelPoint = Convert.ToInt32(this.txtLevelPoint.Value.Trim());
         mdMemLevel.LevellLock = this.chkLevellLock.Checked;
         int flag = this.bllMemLevel.Update(mdMemLevel);
         Chain.BLL.SysShopMemLevel   shopmemleverBll = new Chain.BLL.SysShopMemLevel();
         Chain.Model.SysShopMemLevel ModelMemLevel   = shopmemleverBll.GetModel(ShopMemLevelID);
         ModelMemLevel.ClassDiscountPercent   = Convert.ToDecimal(this.txtLevelDiscountPercent.Value.Trim()) / 100m;
         ModelMemLevel.ClassPointPercent      = ((Convert.ToDecimal(this.txtLevelPointPercent.Value.Trim()) == 0m) ? 0m : Convert.ToDecimal(this.txtLevelPointPercent.Value.Trim()));
         ModelMemLevel.ClassRechargePointRate = ((Convert.ToDecimal(this.txtLevelRechargePointRate.Value.Trim()) == 0m) ? 0m : Convert.ToDecimal(this.txtLevelRechargePointRate.Value.Trim()));
         bool o = shopmemleverBll.Update(ModelMemLevel);
         if (o && flag > 0)
         {
             ArrayList sqlArray             = new ArrayList();
             string    strSqlColumn         = "UPDATE GoodsClassDiscount SET ClassDiscountPercent = '{0}',ClassPointPercent = '{1}' WHERE ClassDiscountID = '{2}'";
             string    strAllSql            = string.Empty;
             string    ClassDiscountPercent = string.Empty;
             string    ClassPointPercent    = string.Empty;
             string    ClassDiscountID      = string.Empty;
             for (int i = 0; i < this.rptShopClassLevel.Items.Count; i++)
             {
                 ClassDiscountID      = ((Literal)this.rptShopClassLevel.Items[i].FindControl("ltClassDiscountID")).Text;
                 ClassDiscountPercent = (Convert.ToDecimal(((HtmlInputText)this.rptShopClassLevel.Items[i].FindControl("txtDiscountPercent")).Value.Trim()) / 100m).ToString();
                 ClassPointPercent    = ((HtmlInputText)this.rptShopClassLevel.Items[i].FindControl("txtPointPercent")).Value.Trim();
                 ClassPointPercent    = ((ClassPointPercent == "0") ? "0" : Convert.ToDecimal(ClassPointPercent).ToString());
                 strAllSql            = string.Format(strSqlColumn, ClassDiscountPercent, ClassPointPercent, ClassDiscountID);
                 sqlArray.Add(strAllSql);
             }
             if (this.bllGoodsClassDiscount.AddList(sqlArray))
             {
                 this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "message", "<Script Language='JavaScript' defer>art.dialog({title: '系统提示',time: 2,content:'保存成功',close: function () { location.href = 'SetLevel.aspx?PID=5'; }});</script>");
             }
             else
             {
                 base.MessagePageShowError("保存失败,请重试!");
             }
         }
         else
         {
             string strError = "保存失败,请重试!";
             if (flag == -1)
             {
                 strError = "已存在所需积分的会员等级,请重新输入!";
             }
             base.MessagePageShowError(strError);
         }
     }
 }