You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SYS_SendMessageController.cs 5.3 KiB

4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using Learun.Util;
  2. using System.Data;
  3. using Learun.Application.TwoDevelopment.EducationalAdministration;
  4. using System.Web.Mvc;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using Learun.Application.Organization;
  9. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  13. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2019-02-27 11:51
  16. /// 描 述:内部邮件发件箱
  17. /// </summary>
  18. public class SYS_SendMessageController : MvcControllerBase
  19. {
  20. private SYS_SendMessageIBLL sYS_SendMessageIBLL = new SYS_SendMessageBLL();
  21. private UserIBLL userIbll = new UserBLL();
  22. #region 视图功能
  23. /// <summary>
  24. /// 主页面
  25. /// <summary>
  26. /// <returns></returns>
  27. [HttpGet]
  28. public ActionResult Index()
  29. {
  30. return View();
  31. }
  32. [HttpGet]
  33. public ActionResult FormView()
  34. {
  35. return View();
  36. }
  37. /// <summary>
  38. /// 表单页
  39. /// <summary>
  40. /// <returns></returns>
  41. [HttpGet]
  42. public ActionResult Form()
  43. {
  44. return View();
  45. }
  46. #endregion
  47. #region 获取数据
  48. [HttpGet]
  49. [AjaxOnly]
  50. public ActionResult GetSelectedUserName(string keyValue)
  51. {
  52. return Success("", string.Join(",", userIbll.GetListByUserIds(keyValue).Select(m => m.F_RealName)));
  53. }
  54. /// <summary>
  55. /// 获取页面显示列表数据
  56. /// <summary>
  57. /// <param name="queryJson">查询参数</param>
  58. /// <returns></returns>
  59. [HttpGet]
  60. [AjaxOnly]
  61. public ActionResult GetPageList(string pagination, string queryJson)
  62. {
  63. Pagination paginationobj = pagination.ToObject<Pagination>();
  64. var data = sYS_SendMessageIBLL.GetPageList(paginationobj, queryJson);
  65. var jsonData = new
  66. {
  67. rows = data,
  68. total = paginationobj.total,
  69. page = paginationobj.page,
  70. records = paginationobj.records
  71. };
  72. return Success(jsonData);
  73. }
  74. /// <summary>
  75. /// 获取表单数据
  76. /// <summary>
  77. /// <returns></returns>
  78. [HttpGet]
  79. [AjaxOnly]
  80. public ActionResult GetFormData(string keyValue)
  81. {
  82. var SYS_SendMessageData = sYS_SendMessageIBLL.GetSYS_SendMessageEntity(keyValue);
  83. var jsonData = new
  84. {
  85. SYS_SendMessage = SYS_SendMessageData,
  86. };
  87. return Success(jsonData);
  88. }
  89. [HttpGet]
  90. [AjaxOnly]
  91. public ActionResult GetFormViewData(string keyValue)
  92. {
  93. var SYS_SendMessageData = sYS_SendMessageIBLL.GetSYS_SendMessageEntity(keyValue);
  94. SYS_SendMessageData.CONTENTS = HttpUtility.HtmlDecode(SYS_SendMessageData.CONTENTS);
  95. var jsonData = new
  96. {
  97. SYS_SendMessage = SYS_SendMessageData,
  98. };
  99. return Success(jsonData);
  100. }
  101. #endregion
  102. #region 提交数据
  103. /// <summary>
  104. /// 删除实体数据
  105. /// <param name="keyValue">主键</param>
  106. /// <summary>
  107. /// <returns></returns>
  108. [HttpPost]
  109. [AjaxOnly]
  110. public ActionResult DeleteForm(string keyValue)
  111. {
  112. sYS_SendMessageIBLL.DeleteEntity(keyValue);
  113. return Success("删除成功!");
  114. }
  115. /// <summary>
  116. /// 保存实体数据(新增、修改)
  117. /// <param name="keyValue">主键</param>
  118. /// <summary>
  119. /// <returns></returns>
  120. [HttpPost]
  121. [ValidateAntiForgeryToken]
  122. [AjaxOnly]
  123. [ValidateInput(false)]
  124. public ActionResult SaveForm(string keyValue, string strEntity)
  125. {
  126. UserInfo logInfo = LoginUserInfo.Get();
  127. SYS_SendMessageEntity entity = strEntity.ToObject<SYS_SendMessageEntity>();
  128. entity.SENDERID = logInfo.userId;
  129. entity.SENDER = logInfo.realName;
  130. entity.CONTENTS = WebHelper.HtmlEncode(entity.CONTENTS);
  131. entity.RECEIVER = string.Join(",", userIbll.GetListByUserIds(entity.RECEIVERID).Select(m => m.F_RealName));
  132. if (!string.IsNullOrEmpty(entity.RECEIVERIDToo))
  133. {
  134. entity.RECEIVERToo = string.Join(",", userIbll.GetListByUserIds(entity.RECEIVERIDToo).Select(m => m.F_RealName));
  135. }
  136. if (!string.IsNullOrEmpty(entity.RECEIVERIDS))
  137. {
  138. entity.RECEIVERS = string.Join(",", userIbll.GetListByUserIds(entity.RECEIVERIDS).Select(m => m.F_RealName));
  139. }
  140. entity.SendFLAG = 0;
  141. sYS_SendMessageIBLL.SaveEntity(keyValue, entity);
  142. return Success("保存成功!", new { MESSAGEID = entity.MESSAGEID });
  143. }
  144. [HttpPost]
  145. [AjaxOnly]
  146. public ActionResult Send(string MESSAGEID)
  147. {
  148. if (!string.IsNullOrEmpty(MESSAGEID))
  149. {
  150. sYS_SendMessageIBLL.Send(MESSAGEID);
  151. }
  152. return Success("发送成功!");
  153. }
  154. #endregion
  155. }
  156. }