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.
 
 
 
 
 
 

236 lines
7.2 KiB

  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. /// <summary>
  47. /// 管理页面【个人印章】
  48. /// </summary>
  49. /// <returns></returns>
  50. public ActionResult IndexInPersonal()
  51. {
  52. return View("~/Areas/LR_NewWorkFlow/Views/StampPersonal/Index.cshtml");
  53. }
  54. /// <summary>
  55. /// 表单页面【个人印章】
  56. /// </summary>
  57. /// <returns></returns>
  58. public ActionResult FormInPersonal()
  59. {
  60. return View("~/Areas/LR_NewWorkFlow/Views/StampPersonal/Form.cshtml");
  61. }
  62. /// <summary>
  63. /// 流程审批-个人印章【个人印章】
  64. /// </summary>
  65. /// <returns></returns>
  66. public ActionResult StampDetailIndexInPersonal()
  67. {
  68. return View("~/Areas/LR_NewWorkFlow/Views/StampPersonal/StampDetailIndex.cshtml");
  69. }
  70. #endregion
  71. #region 获取数据
  72. /// <summary>
  73. /// 分页
  74. /// </summary>
  75. /// <param name="pagination">分页参数</param>
  76. /// <param name="queryJson"></param>
  77. /// <returns></returns>
  78. [HttpGet]
  79. [AjaxOnly]
  80. public ActionResult GetPageList(string pagination, string queryJson)
  81. {
  82. Pagination paginationobj = pagination.ToObject<Pagination>();
  83. var data = lr_StampManageIBLL.GetPageList(paginationobj, queryJson);
  84. var jsonData = new
  85. {
  86. rows = data,
  87. total = paginationobj.total,
  88. page = paginationobj.page,
  89. records = paginationobj.records
  90. };
  91. return Success(jsonData);
  92. }
  93. /// <summary>
  94. /// 获取所有的印章信息
  95. /// </summary>
  96. /// <param name="keyword"></param>
  97. /// <param name="category"></param>
  98. /// <returns></returns>
  99. [HttpGet]
  100. [AjaxOnly]
  101. public ActionResult GetList(string keyword, string userId, string category)
  102. {
  103. var data = lr_StampManageIBLL.GetList(keyword,userId,category);
  104. return Success(data);
  105. }
  106. /// <summary>
  107. /// 获取图片
  108. /// </summary>
  109. /// <param name="parentId"></param>
  110. /// <returns></returns>
  111. [HttpGet]
  112. public ActionResult GetImg(string keyValue)
  113. {
  114. lr_StampManageIBLL.GetImg(keyValue);
  115. return Success("获取成功!");
  116. }
  117. #endregion
  118. #region 提交数据
  119. /// <summary>
  120. /// 保存印章
  121. /// </summary>
  122. /// <param name="keyValue">主键</param>
  123. /// <param name="entity">实体</param>
  124. /// <returns></returns>
  125. [HttpPost]
  126. [ValidateAntiForgeryToken]
  127. [AjaxOnly]
  128. public ActionResult SaveForm(string keyValue, LR_StampManageEntity entity)
  129. {
  130. lr_StampManageIBLL.SaveEntity(keyValue, entity);
  131. return Success("保存成功。");
  132. }
  133. /// <summary>
  134. /// 删除印章
  135. /// </summary>
  136. /// <param name="keyValue">主键</param>
  137. /// <returns></returns>
  138. [HttpPost]
  139. [AjaxOnly]
  140. public ActionResult DeleteForm(string keyValue)
  141. {
  142. lr_StampManageIBLL.DeleteEntity(keyValue);
  143. return Success("删除成功!");
  144. }
  145. #endregion
  146. #region 扩展方法
  147. /// <summary>
  148. /// 图片上传
  149. /// </summary>
  150. /// <param name="keyValue">主键</param>
  151. /// <param name="entity">印章实体</param>
  152. /// <returns></returns>
  153. [HttpPost]
  154. public ActionResult UploadFile(string keyValue, LR_StampManageEntity entity)
  155. {
  156. HttpFileCollection files = System.Web.HttpContext.Current.Request.Files;
  157. if (files[0].ContentLength == 0 || string.IsNullOrEmpty(files[0].FileName))
  158. {
  159. lr_StampManageIBLL.SaveEntity(keyValue, entity);
  160. }
  161. else {
  162. string FileEextension = Path.GetExtension(files[0].FileName);
  163. ImgEntity imgEntity = null;
  164. if (string.IsNullOrEmpty(entity.F_ImgFile))
  165. {
  166. imgEntity = new ImgEntity();
  167. }
  168. else
  169. {
  170. imgEntity = imgIBLL.GetEntity(entity.F_ImgFile);
  171. }
  172. imgEntity.F_Name = files[0].FileName;
  173. imgEntity.F_ExName = FileEextension;
  174. byte[] bytes = new byte[files[0].InputStream.Length];
  175. files[0].InputStream.Read(bytes, 0, bytes.Length);
  176. imgEntity.F_Content = Convert.ToBase64String(bytes);
  177. imgIBLL.SaveEntity(entity.F_ImgFile, imgEntity);
  178. entity.F_ImgFile = imgEntity.F_Id;
  179. lr_StampManageIBLL.SaveEntity(keyValue, entity);
  180. }
  181. return Success("保存成功。");
  182. }
  183. /// <summary>
  184. /// 启用/停用
  185. /// </summary>
  186. /// <param name="keyValue">主键</param>
  187. /// <param name="state">状态 1启用 0禁用</param>
  188. /// <returns></returns>
  189. [HttpPost]
  190. [AjaxOnly]
  191. public ActionResult UpDateSate(string keyValue, int state)
  192. {
  193. lr_StampManageIBLL.UpdateState(keyValue, state);
  194. return Success((state == 1 ? "启用" : "禁用") + "成功!");
  195. }
  196. /// <summary>
  197. /// 密码验证
  198. /// </summary>
  199. /// <param name="keyValue">主键</param>
  200. /// <param name="Password">密码</param>
  201. /// <returns></returns>
  202. [HttpPost]
  203. [AjaxOnly]
  204. public ActionResult EqualForm(string keyValue, string Password)
  205. {
  206. var result = lr_StampManageIBLL.EqualPassword(keyValue, Password);
  207. if (result)
  208. {
  209. return Success("密码验证成功!");
  210. }
  211. else
  212. {
  213. return Fail("密码不正确!");
  214. }
  215. }
  216. #endregion
  217. }
  218. }