public ActionResult AddAttention(wx_request_content entity) { try { var requestRule = Wx_RequestRuleService.LoadEntities(r => r.request_type == (int)WXRequestState.关注时回复).FirstOrDefault(); entity.add_time = DateTime.Now; if (Wx_RequestRuleService.AddAttentionMsg(requestRule, entity)) { SaveSyslog("添加关注时回复成功", SysLogType.后台日志, nowManager.name); return(Json(SysEnum.成功, "添加成功")); } else { SaveSyslog("添加关注时回复失败", SysLogType.后台日志, nowManager.name); return(Json(SysEnum.失败, "添加失败")); } } catch (Exception) { return(Json(SysEnum.失败, "系统异常")); } }
/// <summary> /// 修改内容图文 /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public ActionResult EditTeletext(wx_request_content entity) { var srcWX_Content = Wx_RequestContentService.LoadEntities(w => w.id == entity.id).FirstOrDefault(); if (srcWX_Content == null) { return(Json(SysEnum.失败, "数据错误")); } srcWX_Content.req_title = entity.req_title; srcWX_Content.detail_url = entity.detail_url; srcWX_Content.pic_url = entity.pic_url; srcWX_Content.media_url = entity.media_url; srcWX_Content.req_content = entity.req_content; srcWX_Content.add_time = DateTime.Now; srcWX_Content.sort = entity.sort; if (Wx_RequestContentService.EditEntity(srcWX_Content)) { SaveSyslog("修改微信消息图文成功", SysLogType.后台日志, nowManager.name); return(Json(SysEnum.成功, "修改成功")); } else { SaveSyslog("修改微信消息图文失败", SysLogType.后台日志, nowManager.name); return(Json(SysEnum.失败, "修改失败")); } }
/// <summary> /// 添加图文 /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public ActionResult AddTeletext(wx_request_content entity) { var wx_Reque = Wx_RequestRuleService.LoadEntities(w => w.id == entity.rule_id).FirstOrDefault(); wx_request_content newWx_Content = new wx_request_content(); newWx_Content.req_title = entity.req_title; newWx_Content.detail_url = entity.detail_url; newWx_Content.pic_url = entity.pic_url; newWx_Content.media_url = entity.media_url; newWx_Content.req_content = entity.req_content; newWx_Content.add_time = DateTime.Now; newWx_Content.sort = entity.sort; newWx_Content.type_msg = (int)WXRequestType.图文; if (Wx_RequestRuleService.AddTeletext(wx_Reque, newWx_Content)) { SaveSyslog("添加微信消息关键字图文成功", SysLogType.后台日志, nowManager.name); return(Json(SysEnum.成功, "添加成功")); } else { SaveSyslog("添加微信消息关键字图文失败", SysLogType.后台日志, nowManager.name); return(Json(SysEnum.失败, "添加失败")); } }
public bool DelEntity(wx_request_content wx_Content) { var wx_Rule = wx_Content.wx_request_rule; base.GetDbSession.wx_request_ruleDal.DeleteEntity(wx_Rule); base.GetDbSession.wx_request_contentDal.DeleteEntity(wx_Content); return(base.GetDbSession.SaveChanges()); }
public bool AddAttentionMsg(wx_request_rule wx_Rule, wx_request_content wx_Content) { wx_Rule.response_type = wx_Content.type_msg; base.GetDbSession.wx_request_ruleDal.EditEntity(wx_Rule); // var wx_Contents = wx_Content.type_msg == 3 ? wx_Rule.wx_request_content.Where(w => w.type_msg != 3).ToList() : wx_Rule.wx_request_content.ToList(); for (int i = 0; i < wx_Contents.Count(); i++) { var item = wx_Contents[i]; base.GetDbSession.wx_request_contentDal.DeleteEntity(item); } wx_Rule.wx_request_content.Add(wx_Content); return(base.GetDbSession.SaveChanges()); }
public ActionResult AddKeyword(wx_request_content entity) { string keywords = Request["keywords"]; var wx_Reque = Wx_RequestRuleService.LoadEntities(w => w.req_keywords.Equals(keywords)).FirstOrDefault(); if (wx_Reque != null) { return(Json(SysEnum.失败, "此关键字已存在")); } wx_request_rule newWx_Rule = new wx_request_rule(); newWx_Rule.rule_name = Request["RuleName"]; newWx_Rule.req_keywords = keywords; newWx_Rule.request_type = (int)WXRequestState.关键字回复; newWx_Rule.response_type = int.Parse(Request["ResponseType"]); newWx_Rule.add_time = DateTime.Now; wx_request_content newWx_Content = new wx_request_content(); newWx_Content.req_title = entity.req_title; newWx_Content.detail_url = entity.detail_url; newWx_Content.pic_url = entity.pic_url; newWx_Content.media_url = entity.media_url; newWx_Content.req_content = entity.req_content; newWx_Content.add_time = DateTime.Now; newWx_Content.type_msg = int.Parse(Request["ResponseType"]); newWx_Content.remark = entity.remark; //newWx_Content.RId = newWx_Rule.RId; if (Wx_RequestRuleService.AddEntity(newWx_Rule, newWx_Content)) { SaveSyslog("添加微信消息关键字成功", SysLogType.后台日志, nowManager.name); return(Json(SysEnum.成功, "添加成功")); } else { SaveSyslog("添加微信消息关键字失败", SysLogType.后台日志, nowManager.name); return(Json(SysEnum.失败, "添加失败")); } }
/// <summary> /// 修改关键字与回复 /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public ActionResult EditKeyword(wx_request_content entity) { var wx_Reque = Wx_RequestRuleService.LoadEntities(w => w.id == entity.rule_id).FirstOrDefault(); if (wx_Reque == null) { return(Json(SysEnum.失败, "数据不存在")); } var keywords = Request["keywords"]; var wx_RequeTwo = Wx_RequestRuleService.LoadEntities(w => w.req_keywords.Equals(keywords) && w.id != entity.rule_id).FirstOrDefault(); if (wx_RequeTwo != null) { return(Json(SysEnum.失败, "此关键字已存在")); } wx_Reque.req_keywords = keywords; var wx_Content = Wx_RequestContentService.LoadEntities(w => w.id == entity.id).FirstOrDefault(); wx_Content.req_title = entity.req_title; wx_Content.detail_url = entity.detail_url; wx_Content.pic_url = entity.pic_url; wx_Content.media_url = entity.media_url; wx_Content.req_content = entity.req_content; wx_Content.remark = entity.remark; if (Wx_RequestRuleService.EditEntity(wx_Reque, wx_Content)) { SaveSyslog("修改微信消息关键字成功", SysLogType.后台日志, nowManager.name); return(Json(SysEnum.成功, "修改成功")); } else { SaveSyslog("修改微信消息关键字失败", SysLogType.后台日志, nowManager.name); return(Json(SysEnum.失败, "修改失败")); } }
public bool AddTeletext(wx_request_rule wx_Rule, wx_request_content wx_Content) { wx_Rule.wx_request_content.Add(wx_Content); return(base.GetDbSession.SaveChanges()); }
public bool EditEntity(wx_request_rule wx_Rule, wx_request_content wx_Content) { base.GetDbSession.wx_request_ruleDal.EditEntity(wx_Rule); base.GetDbSession.wx_request_contentDal.EditEntity(wx_Content); return(base.GetDbSession.SaveChanges()); }
public bool AddEntity(wx_request_rule wx_Rule, wx_request_content wx_Content) { base.GetDbSession.wx_request_ruleDal.AddEntity(wx_Rule); wx_Rule.wx_request_content.Add(wx_Content); return(base.GetDbSession.SaveChanges()); }