Beispiel #1
0
 /// <summary>
 /// 获取当前模板内容
 /// </summary>
 /// <param name="orderCode"></param>
 /// <param name="model"></param>
 /// <returns></returns>
 public string GetTemplateContent(string orderCode, SmsTemplateInfo model)
 {
     if (model.TemplateType == "auto")
     {
         DataTable dt    = null;
         SmsSend   ssBll = new SmsSend();
         DataSet   ds    = ssBll.GetSmsParams(orderCode);
         if (ds != null && ds.Tables.Count > 0)
         {
             dt = ds.Tables[0];
         }
         return(GetTemplateContentByAuto(dt, model.SmsContent, model.ParamsCode));
     }
     else if (model.TemplateType == "custom")
     {
         return(string.Format(model.SmsContent, model.ParamsValue.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)));
     }
     else
     {
         return(model.SmsContent);
     }
 }
Beispiel #2
0
        /// <summary>
        /// 获取当前模板的内容
        /// </summary>
        /// <param name="templateId"></param>
        /// <param name="orderCode"></param>
        /// <returns></returns>
        public string GetTemplateContent(object templateId, string orderCode)
        {
            string content = "";
            var    model   = GetModel(templateId);

            if (model == null)
            {
                return("");
            }
            if (model.TemplateType == "auto")
            {
                if (string.IsNullOrEmpty(orderCode))
                {
                    return("");
                }

                DataTable dt      = null;
                SmsSend   smsSend = new SmsSend();
                DataSet   ds      = smsSend.GetSmsParams(orderCode);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    dt = ds.Tables[0];
                }

                return(GetTemplateContentByAuto(dt, model.SmsContent, model.ParamsCode));
            }
            else if (model.TemplateType == "custom")
            {
                content = string.Format(model.SmsContent, model.ParamsValue.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
            }
            else
            {
                content = model.SmsContent;
            }

            return(content);
        }