/// <summary>
 /// 增加自动回复消息
 /// </summary>
 /// <param name="message">message实体</param>
 public int AddAutoReplyMessage(WeixinAutoReplyMessageModel message)
 {
     using (var cmd = DataCommandManager.GetDataCommand("AutoReplyMessage_Add"))
     {
         cmd.SetParameterValue("@Keyword", message.Keyword);
         cmd.SetParameterValue("@ReplyContent", message.ReplyContent);
         cmd.SetParameterValue("@CreatorId", message.CreatorId);
         cmd.SetParameterValue("@Status", message.Status);
         cmd.SetParameterValue("@CreateTime", message.CreateTime);
         var result = cmd.ExecuteScalar();
         if (result != null)
         {
             return Convert.ToInt32(result);
         }
         return 0;
     }
 }
예제 #2
0
 public ActionResult WeixinMessage(WeixinAutoReplyMessageModel model)
 {
     model.CreateTime = DateTime.Now;
     model.CreatorId = this.Admin.Id;
     if (model.Id == 0)
     {
         WeiXinService.AutoReplyMessageInsert(model);
     }
     else
     {
         WeiXinService.AutoReplyMessageUpdate(model);
     }
     var autoReplyMessagelist = WeiXinService.AutoReplyMessageGetAll();
     ViewBag.MessageList = autoReplyMessagelist;
     return View();
 }
 public WeixinAutoReplyMessageModel GetAutoReplyMessageByKeyword(string keyword)
 {
     var model = new WeixinAutoReplyMessageModel();
     using (var cmd = DataCommandManager.GetDataCommand("AutoReplyMessage_GetByKeyword"))
     {
         cmd.SetParameterValue("@Keyword", keyword);
         using (var dr = cmd.ExecuteDataReader())
         {
             while (dr.Read())
             {
                 model.Id = !Convert.IsDBNull(dr["Id"]) ? int.Parse(dr["Id"].ToString()) : 0;
                 model.Keyword = !Convert.IsDBNull(dr["Keyword"]) ? dr["Keyword"].ToString() : string.Empty;
                 model.ReplyContent = !Convert.IsDBNull(dr["ReplyContent"]) ? dr["ReplyContent"].ToString() : string.Empty;
                 model.Status = !Convert.IsDBNull(dr["Status"]) ? int.Parse(dr["Status"].ToString()) : 0;
                 model.CreatorId = !Convert.IsDBNull(dr["CreatorId"]) ? int.Parse(dr["CreatorId"].ToString()) : 0;
                 model.CreateTime = !Convert.IsDBNull(dr["CreateTime"]) ? Convert.ToDateTime(dr["CreateTime"]) : DateTime.MinValue;
             }
         }
     }
     return model;
 }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public void Update(WeixinAutoReplyMessageModel message)
 {
     using (var cmd = DataCommandManager.GetDataCommand("AutoReplyMessage_Update"))
     {
         cmd.SetParameterValue("@Id", message.Id);
         cmd.SetParameterValue("@Keyword", message.Keyword);
         cmd.SetParameterValue("@ReplyContent", message.ReplyContent);
         cmd.SetParameterValue("@CreatorId", message.CreatorId);
         cmd.SetParameterValue("@Status", message.Status);
         cmd.SetParameterValue("@CreateTime", message.CreateTime);
         var result = cmd.ExecuteScalar();
     }
 }
        /// <summary>
        /// 转化方法
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private WeixinAutoReplyMessageModel convertRowToWEiXinAutoReplyMessageModel(DataRow dr)
        {
            var model = new WeixinAutoReplyMessageModel();
            model.Id = !Convert.IsDBNull(dr["Id"]) ? int.Parse(dr["Id"].ToString()) : 0;
            model.Keyword = !Convert.IsDBNull(dr["Keyword"]) ? dr["Keyword"].ToString() : string.Empty;
            model.ReplyContent = !Convert.IsDBNull(dr["ReplyContent"]) ? dr["ReplyContent"].ToString() : string.Empty;
            model.Status = !Convert.IsDBNull(dr["Status"]) ? int.Parse(dr["Status"].ToString()) : 0;
            model.CreatorId = !Convert.IsDBNull(dr["CreatorId"]) ? int.Parse(dr["CreatorId"].ToString()) : 0;
            model.CreateTime = !Convert.IsDBNull(dr["CreateTime"]) ? Convert.ToDateTime(dr["CreateTime"]) : DateTime.MinValue;
            return model;

        }
예제 #6
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="model"></param>
 public void AutoReplyMessageUpdate(WeixinAutoReplyMessageModel model)
 {
     messageDataAccess.Update(model);
 }
예제 #7
0
 /// <summary>
 /// 添加自动回复关键字数据
 /// </summary>
 /// <param name="message"></param>
 /// <returns></returns>
 public int AutoReplyMessageInsert(WeixinAutoReplyMessageModel message)
 {
     return messageDataAccess.AddAutoReplyMessage(message);
 }