/// <summary> /// 获取一个常用意见 /// </summary> /// <param name="Comment"></param> /// <returns></returns> public JsonResult GetFrequentlyUsedComment(string CommentID) { return(this.ExecuteFunctionRun(() => { Organization.FrequentlyUsedComment Comment = Engine.Organization.GetFrequentlyUsedComment(CommentID); List <CommentViewModel> griddata = new List <CommentViewModel>(); griddata.Add(new CommentViewModel() { CommentID = Comment.CommentID + string.Empty, CommentIndex = Comment.SortKey + string.Empty, CommentText = Comment.CommentText + string.Empty }); GridViewModel <CommentViewModel> result = new GridViewModel <CommentViewModel>(1, griddata); return Json(result, JsonRequestBehavior.AllowGet); }, string.Empty)); }
/// <summary> /// 添加、编辑常用意见 /// </summary> /// <param name="SortKeyText">排序号</param> /// <param name="CommentText">意见</param> public JsonResult AddFrequentlyUsedComment(string CommentID, string SortKeyText, string CommentText) { return(this.ExecuteFunctionRun(() => { int SortKey = 0; CommentText = CommentText.Trim(); if (CommentText.Length > 120) { CommentText = CommentText.Substring(0, 120); } int.TryParse(SortKeyText, out SortKey); ActionResult result = new ActionResult(true); if (CommentID == "") { //添加 Organization.FrequentlyUsedComment Comment = new Organization.FrequentlyUsedComment() { CommentText = CommentText, SortKey = SortKey, UserID = this.UserValidator.UserID, CreatedTime = DateTime.Now }; result.Success = Engine.Organization.AddFrequentlyUsedComment(Comment); if (result.Success == false) { result.Message = "FrequentlyUsedComment_AddFailed"; } } else { //编辑 Organization.FrequentlyUsedComment Comment = Engine.Organization.GetFrequentlyUsedComment(CommentID); if (Comment != null) { Comment.SortKey = SortKey; Comment.CommentText = CommentText; } result.Success = Engine.Organization.UpdateFrequentlyUsedComment(Comment); if (result.Success == false) { result.Message = "FrequentlyUsedComment_AddFailed"; } } return Json(result, JsonRequestBehavior.AllowGet); }, string.Empty)); }