public int Update(Chain.Model.MemLevel model) { int result; if (this.Exists(model.LevelID, model.LevelPoint)) { result = -1; } else { result = this.dal.Update(model); } return(result); }
public int Add(Chain.Model.MemLevel model) { int result; if (this.Exists(-1, model.LevelPoint)) { result = -1; } else { result = this.dal.Add(model); } return(result); }
public List <Chain.Model.MemLevel> DataTableToList1(DataTable dt) { List <Chain.Model.MemLevel> modelList = new List <Chain.Model.MemLevel>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.MemLevel model = new Chain.Model.MemLevel(); if (dt.Rows[i]["LevelID"] != null && dt.Rows[i]["LevelID"].ToString() != "") { model.LevelID = int.Parse(dt.Rows[i]["LevelID"].ToString()); } if (dt.Rows[i]["LevelName"] != null && dt.Rows[i]["LevelName"].ToString() != "") { model.LevelName = dt.Rows[i]["LevelName"].ToString(); } if (dt.Rows[i]["LevelPoint"] != null && dt.Rows[i]["LevelPoint"].ToString() != "") { model.LevelPoint = int.Parse(dt.Rows[i]["LevelPoint"].ToString()); } if (dt.Rows[i]["LevelDiscountPercent"] != null && dt.Rows[i]["LevelDiscountPercent"].ToString() != "") { model.LevelDiscountPercent = Convert.ToDecimal(dt.Rows[i]["LevelDiscountPercent"]); } if (dt.Rows[i]["LevelPointPercent"] != null && dt.Rows[i]["LevelPointPercent"].ToString() != "") { model.LevelPointPercent = Convert.ToDecimal(dt.Rows[i]["LevelPointPercent"]); } if (dt.Rows[i]["LevelRechargePointRate"] != null && dt.Rows[i]["LevelRechargePointRate"].ToString() != "") { model.LevelRechargePointRate = Convert.ToInt32(dt.Rows[i]["LevelRechargePointRate"]); } if (dt.Rows[i]["LevellLock"] != null && dt.Rows[i]["LevellLock"].ToString() != "") { if (dt.Rows[i]["LevellLock"].ToString() == "1" || dt.Rows[i]["LevellLock"].ToString().ToLower() == "true") { model.LevellLock = true; } else { model.LevellLock = false; } } modelList.Add(model); } } return(modelList); }
public static string GetSendContent(int intTemplateType, SmsTemplateParameter smsTemplateParameter, int intShopID) { Chain.BLL.SmsTemplate bllTemplate = new Chain.BLL.SmsTemplate(); Chain.Model.SmsTemplate modelTemplate = new Chain.Model.SmsTemplate(); modelTemplate = bllTemplate.GetModel(intTemplateType); StringBuilder strTemplateContent = new StringBuilder(modelTemplate.TemplateContent); strTemplateContent.Replace("{CardID}", smsTemplateParameter.strCardID); strTemplateContent.Replace("{LCardID}", smsTemplateParameter.strCardID.Substring(smsTemplateParameter.strCardID.Length - 3)); strTemplateContent.Replace("{Name}", smsTemplateParameter.strName); strTemplateContent.Replace("{TempMoney}", smsTemplateParameter.dclTempMoney.ToString("0.00")); strTemplateContent.Replace("{Money}", smsTemplateParameter.dclMoney.ToString("0.00")); strTemplateContent.Replace("{Time}", DateTime.Now.ToString("yy年MM月dd日HH时mm分")); strTemplateContent.Replace("{TempPoint}", smsTemplateParameter.intTempPoint.ToString()); strTemplateContent.Replace("{Point}", smsTemplateParameter.intPoint.ToString()); Chain.BLL.MemLevel bllMemLevel = new Chain.BLL.MemLevel(); Chain.Model.MemLevel modelMemLevel = new Chain.Model.MemLevel(); modelMemLevel = bllMemLevel.GetModel(smsTemplateParameter.OldLevelID); strTemplateContent.Replace("{OldLevel}", modelMemLevel.LevelName); modelMemLevel = bllMemLevel.GetModel(smsTemplateParameter.NewLevelID); strTemplateContent.Replace("{NewLevel}", modelMemLevel.LevelName); strTemplateContent.Replace("{MemBirthday}", string.Format("{0}月{1}日", Convert.ToInt32(smsTemplateParameter.MemBirthday.ToString("MM")), Convert.ToInt32(smsTemplateParameter.MemBirthday.ToString("dd")))); strTemplateContent.Replace("{MemPastTime}", smsTemplateParameter.MemPastTime.ToString("yyyy-MM-dd")); strTemplateContent.Replace("{TempGoodsItem}", smsTemplateParameter.CountItemsString); if (modelTemplate.TemplateID < 13) { if (PubFunction.curParameter.bolIsSmsShopName) { if (PubFunction.curParameter.strSmsShopName != "") { strTemplateContent.Append("【" + PubFunction.curParameter.strSmsShopName + "】"); } } else { Chain.BLL.SysShop bllShop = new Chain.BLL.SysShop(); Chain.Model.SysShop modelShop = new Chain.Model.SysShop(); modelShop = bllShop.GetModel(intShopID); if (modelShop.ShopSmsName != "") { strTemplateContent.Append("【" + modelShop.ShopSmsName + "】"); } } } return(strTemplateContent.ToString()); }
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); } } }
public void InitGoodsLevelDiscountByMemLevelID(Chain.Model.MemLevel mdMemLevel) { this.dal.InitGoodsLevelDiscountByMemLevelID(mdMemLevel); }