/// <summary> /// 暂不使用 /// </summary> /// <returns></returns> public JsonResult BatchSend() { ResultRetrun rmodel = new ResultRetrun(); List <MessageRecord> data = msgService.GetAll(new MessageRecordQuery() { SendState = (int)MsgSendState.Unsent }); List <List <MessageRecord> > groupList = GetGroupList(data); for (int i = 0; i < groupList.Count; i++) { rmodel = new ResultRetrun(); try { rmodel.isSuccess = msgService.Send(groupList[i]); } catch (BizException biz) { rmodel.message = biz.Message; } catch (Exception ex) { rmodel.message = "操作失败,原因:" + ex.Message; } Logger.Info(typeof(MessageRecordController), "BatchSend:" + data[i].MessageId + JsonUtils.Serialize(rmodel)); } return(Json(rmodel, JsonRequestBehavior.AllowGet)); }
public JsonResult Edit(CategoryViewModel model) { ResultRetrun rmodel = new ResultRetrun(); rmodel = CheckName(model.Id, model.CategoryName, model.CategoryType); if (!rmodel.isSuccess) { return(Json(rmodel)); } CategoryDictionary data = cdService.Get(model.Id); data.Name = model.CategoryName; data.Type = model.CategoryType; data.Parent = model.ParentId; bool isSuccess = cdService.Update(data); if (!isSuccess) { rmodel.message = "操作失败"; } rmodel.isSuccess = isSuccess; return(Json(rmodel)); }
public JsonResult Send(int id) { ResultRetrun rmodel = new ResultRetrun(); MessageRecord data = msgService.Get(id); if (data.SendState == MsgSendState.SendSuccess) { rmodel.message = "该消息已经发送成功,不能重复发送"; return(Json(rmodel, JsonRequestBehavior.AllowGet)); } try { rmodel.isSuccess = msgService.Send(new List <MessageRecord>() { data }, false); } catch (BizException biz) { rmodel.message = biz.Message; } catch (Exception ex) { rmodel.message = "操作失败,原因:" + ex.Message; } return(Json(rmodel, JsonRequestBehavior.AllowGet)); }
public JsonResult Add(MsgViewModel model) { ResultRetrun rmodel = new ResultRetrun(); if (!ValidateHelper.IsDateTime(model.OrderDate)) { rmodel.message = "订单日期输入有误"; } if (ModelState.IsValid) { MessageRecord msgModel = new MessageRecord() { MessageId = model.Number, OperatorId = UserId, SendState = MsgSendState.Unsent, ToAddress = model.Phone, MsgData = new MsgDataInfo() { OrderDate = Convert.ToDateTime(model.OrderDate), OrderName = model.OrderName } }; rmodel.isSuccess = msgService.Add(msgModel); } return(Json(rmodel)); }
public JsonResult Righting() { ResultRetrun rmodel = new ResultRetrun(); try { msgService.Righting(); rmodel.isSuccess = true; } catch (Exception ex) { rmodel.message = "操作失败,原因:" + ex.Message; } return(Json(rmodel, JsonRequestBehavior.AllowGet)); }
public JsonResult CheckSupportSend(MsgSendState state) { ResultRetrun rmodel = new ResultRetrun(); if (state == MsgSendState.SendSuccess) { rmodel.message = "当前状态不支持批量发送"; return(Json(rmodel.isSuccess, JsonRequestBehavior.AllowGet)); } if (msgService.Count(state) <= 0) { rmodel.message = "没有要发送的数据"; } else { rmodel.isSuccess = true; } return(Json(rmodel, JsonRequestBehavior.AllowGet)); }
public JsonResult Edit(StuViewModel model) { ResultRetrun rmodel = new ResultRetrun(); if (ModelState.IsValid) { StuCertificate data = stuService.Get(model.Id); data.Number = model.Number; data.Name = model.StudentName; data.Category = model.Category; data.State = (PublishState)model.State; data.Gender = model.Gender; data.City = model.City.ToString(); data.Province = model.Province < 1 ? Constant.DEFAULT_PROVINCE : model.Province.ToString(); data.HeadImg = model.HeadImg; rmodel.isSuccess = stuService.Update(data); } return(Json(rmodel)); }
public JsonResult Edit(DownloadViewModel model) { ResultRetrun rmodel = new ResultRetrun(); if (ModelState.IsValid) { FileDownload data = downService.Get(model.Id); data.Title = model.FileTitle; data.Name = model.FileName; data.Description = !string.IsNullOrEmpty(model.Description) ? model.Description.Replace("\r\n", "") : string.Empty; data.Category = model.Category; data.State = (PublishState)model.State; data.HeadImg = model.FileImg; data.Src = model.Src; data.Type = string.IsNullOrEmpty(model.Extension) ? model.FileType : getFileFormat(model.Extension); rmodel.isSuccess = downService.Update(data); } return(Json(rmodel)); }
public JsonResult Edit(MsgViewModel model) { ResultRetrun rmodel = new ResultRetrun(); if (!ValidateHelper.IsDateTime(model.OrderDate)) { rmodel.message = "订单日期输入有误"; } if (ModelState.IsValid) { MessageRecord data = msgService.Get(model.Id); data.MessageId = model.Number; data.ToAddress = model.Phone; data.MsgData.OrderName = model.OrderName; data.MsgData.OrderDate = Convert.ToDateTime(model.OrderDate); data.OperatorId = UserId; rmodel.isSuccess = msgService.Update(data); } return(Json(rmodel)); }
public JsonResult Edit(MemberUnitViewModel model) { ResultRetrun rmodel = new ResultRetrun(); if (ModelState.IsValid) { MemberUnit data = muService.Get(model.Id); data.Name = model.MemberUnitName; data.Description = !string.IsNullOrEmpty(model.Description) ? model.Description.Replace("\r\n", "") : string.Empty; data.Category = model.Category; data.State = (PublishState)model.State; data.HeadImg = model.HeadImg; data.Star = model.Star; data.City = model.City.ToString(); data.Province = model.Province < 1 ? Constant.DEFAULT_PROVINCE : model.Province.ToString(); data.Number = model.Number; rmodel.isSuccess = muService.Update(data); } return(Json(rmodel)); }
public JsonResult Add(StuViewModel model) { ResultRetrun rmodel = new ResultRetrun(); if (ModelState.IsValid) { StuCertificate stuModel = new StuCertificate() { Number = model.Number, Name = model.StudentName, Category = model.Category, State = (PublishState)model.State, Gender = model.Gender, City = model.City.ToString(), Province = model.Province.ToString(), UserId = GetAccount().Id, HeadImg = model.HeadImg }; rmodel.isSuccess = stuService.Add(stuModel); } return(Json(rmodel)); }