public List <Chain.Model.SmsTemplate> DataTableToList(DataTable dt) { List <Chain.Model.SmsTemplate> modelList = new List <Chain.Model.SmsTemplate>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.SmsTemplate model = new Chain.Model.SmsTemplate(); if (dt.Rows[i]["TemplateID"] != null && dt.Rows[i]["TemplateID"].ToString() != "") { model.TemplateID = int.Parse(dt.Rows[i]["TemplateID"].ToString()); } if (dt.Rows[i]["TemplateName"] != null && dt.Rows[i]["TemplateName"].ToString() != "") { model.TemplateName = dt.Rows[i]["TemplateName"].ToString(); } if (dt.Rows[i]["TemplateContent"] != null && dt.Rows[i]["TemplateContent"].ToString() != "") { model.TemplateContent = dt.Rows[i]["TemplateContent"].ToString(); } 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()); }
public int Update(Chain.Model.SmsTemplate model) { return(this.dal.Update(model)); }
public int Add(Chain.Model.SmsTemplate model) { return(this.dal.Add(model)); }