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.

StampInfoController.cs 6.3 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. using Learun.Application.Base.SystemModule;
  2. using Learun.Application.OA.LR_StampManage;
  3. using Learun.Util;
  4. using System;
  5. using System.IO;
  6. using System.Web;
  7. using System.Web.Mvc;
  8. namespace Learun.Application.Web.Areas.LR_NewWorkFlow.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS V6.1.6.0 力软敏捷开发框架
  12. /// Copyright (c) 2013-2017 上海力软信息技术有限公司
  13. /// 创建人:力软-框架开发组(王飞)
  14. /// 日 期:2018.11.19
  15. /// 描 述:印章管理
  16. /// </summary>
  17. public class StampInfoController : MvcControllerBase
  18. {
  19. private LR_StampManageIBLL lr_StampManageIBLL = new LR_StampManageBLL();
  20. private ImgIBLL imgIBLL = new ImgBLL();
  21. #region 视图功能
  22. /// <summary>
  23. /// 管理页面
  24. /// </summary>
  25. /// <returns></returns>
  26. public ActionResult Index()
  27. {
  28. return View();
  29. }
  30. /// <summary>
  31. /// 表单页面
  32. /// </summary>
  33. /// <returns></returns>
  34. public ActionResult Form()
  35. {
  36. return View();
  37. }
  38. public ActionResult StampDetailIndex()
  39. {
  40. return View();
  41. }
  42. public ActionResult EqualForm()
  43. {
  44. return View();
  45. }
  46. #endregion
  47. #region 获取数据
  48. /// <summary>
  49. /// 分页
  50. /// </summary>
  51. /// <param name="pagination">分页参数</param>
  52. /// <param name="queryJson"></param>
  53. /// <returns></returns>
  54. [HttpGet]
  55. [AjaxOnly]
  56. public ActionResult GetPageList(string pagination, string queryJson)
  57. {
  58. Pagination paginationobj = pagination.ToObject<Pagination>();
  59. var data = lr_StampManageIBLL.GetPageList(paginationobj, queryJson);
  60. var jsonData = new
  61. {
  62. rows = data,
  63. total = paginationobj.total,
  64. page = paginationobj.page,
  65. records = paginationobj.records
  66. };
  67. return Success(jsonData);
  68. }
  69. /// <summary>
  70. /// 获取所有的印章信息
  71. /// </summary>
  72. /// <param name="keyword"></param>
  73. /// <param name="category"></param>
  74. /// <returns></returns>
  75. [HttpGet]
  76. [AjaxOnly]
  77. public ActionResult GetList(string keyword)
  78. {
  79. var data = lr_StampManageIBLL.GetList(keyword);
  80. return Success(data);
  81. }
  82. /// <summary>
  83. /// 获取图片
  84. /// </summary>
  85. /// <param name="parentId"></param>
  86. /// <returns></returns>
  87. [HttpGet]
  88. public ActionResult GetImg(string keyValue)
  89. {
  90. lr_StampManageIBLL.GetImg(keyValue);
  91. return Success("获取成功!");
  92. }
  93. #endregion
  94. #region 提交数据
  95. /// <summary>
  96. /// 保存印章
  97. /// </summary>
  98. /// <param name="keyValue">主键</param>
  99. /// <param name="entity">实体</param>
  100. /// <returns></returns>
  101. [HttpPost]
  102. [ValidateAntiForgeryToken]
  103. [AjaxOnly]
  104. public ActionResult SaveForm(string keyValue, LR_StampManageEntity entity)
  105. {
  106. lr_StampManageIBLL.SaveEntity(keyValue, entity);
  107. return Success("保存成功。");
  108. }
  109. /// <summary>
  110. /// 删除印章
  111. /// </summary>
  112. /// <param name="keyValue">主键</param>
  113. /// <returns></returns>
  114. [HttpPost]
  115. [AjaxOnly]
  116. public ActionResult DeleteForm(string keyValue)
  117. {
  118. lr_StampManageIBLL.DeleteEntity(keyValue);
  119. return Success("删除成功!");
  120. }
  121. #endregion
  122. #region 扩展方法
  123. /// <summary>
  124. /// 图片上传
  125. /// </summary>
  126. /// <param name="keyValue">主键</param>
  127. /// <param name="entity">印章实体</param>
  128. /// <returns></returns>
  129. [HttpPost]
  130. public ActionResult UploadFile(string keyValue, LR_StampManageEntity entity)
  131. {
  132. HttpFileCollection files = System.Web.HttpContext.Current.Request.Files;
  133. if (files[0].ContentLength == 0 || string.IsNullOrEmpty(files[0].FileName))
  134. {
  135. lr_StampManageIBLL.SaveEntity(keyValue, entity);
  136. }
  137. else {
  138. string FileEextension = Path.GetExtension(files[0].FileName);
  139. ImgEntity imgEntity = null;
  140. if (string.IsNullOrEmpty(entity.F_ImgFile))
  141. {
  142. imgEntity = new ImgEntity();
  143. }
  144. else
  145. {
  146. imgEntity = imgIBLL.GetEntity(entity.F_ImgFile);
  147. }
  148. imgEntity.F_Name = files[0].FileName;
  149. imgEntity.F_ExName = FileEextension;
  150. byte[] bytes = new byte[files[0].InputStream.Length];
  151. files[0].InputStream.Read(bytes, 0, bytes.Length);
  152. imgEntity.F_Content = Convert.ToBase64String(bytes);
  153. imgIBLL.SaveEntity(entity.F_ImgFile, imgEntity);
  154. entity.F_ImgFile = imgEntity.F_Id;
  155. lr_StampManageIBLL.SaveEntity(keyValue, entity);
  156. }
  157. return Success("保存成功。");
  158. }
  159. /// <summary>
  160. /// 启用/停用
  161. /// </summary>
  162. /// <param name="keyValue">主键</param>
  163. /// <param name="state">状态 1启用 0禁用</param>
  164. /// <returns></returns>
  165. [HttpPost]
  166. [AjaxOnly]
  167. public ActionResult UpDateSate(string keyValue, int state)
  168. {
  169. lr_StampManageIBLL.UpdateState(keyValue, state);
  170. return Success((state == 1 ? "启用" : "禁用") + "成功!");
  171. }
  172. /// <summary>
  173. /// 密码验证
  174. /// </summary>
  175. /// <param name="keyValue">主键</param>
  176. /// <param name="Password">密码</param>
  177. /// <returns></returns>
  178. [HttpPost]
  179. [AjaxOnly]
  180. public ActionResult EqualForm(string keyValue, string Password)
  181. {
  182. var result = lr_StampManageIBLL.EqualPassword(keyValue, Password);
  183. if (result)
  184. {
  185. return Success("密码验证成功!");
  186. }
  187. else
  188. {
  189. return Fail("密码不正确!");
  190. }
  191. }
  192. #endregion
  193. }
  194. }