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.
 
 
 
 
 
 

172 lines
5.2 KiB

  1. using System;
  2. using Learun.Util;
  3. using System.Data;
  4. using Learun.Application.TwoDevelopment.PersonnelManagement;
  5. using System.Web.Mvc;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  12. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2020-09-03 14:57
  15. /// 描 述:考勤限制
  16. /// </summary>
  17. public class ADR_RestrictionController : MvcControllerBase
  18. {
  19. private ADR_RestrictionIBLL aDR_RestrictionIBLL = new ADR_RestrictionBLL();
  20. #region 视图功能
  21. /// <summary>
  22. /// 主页面
  23. /// <summary>
  24. /// <returns></returns>
  25. [HttpGet]
  26. public ActionResult Index()
  27. {
  28. return View();
  29. }
  30. /// <summary>
  31. /// 表单页
  32. /// <summary>
  33. /// <returns></returns>
  34. [HttpGet]
  35. public ActionResult Form()
  36. {
  37. return View();
  38. }
  39. [HttpGet]
  40. public ActionResult FormDay()
  41. {
  42. return View();
  43. }
  44. #endregion
  45. #region 获取数据
  46. /// <summary>
  47. /// 获取页面显示列表数据
  48. /// </summary>
  49. /// <param name="pagination">分页参数</param>
  50. /// <param name="queryJson">查询参数</param>
  51. /// <returns></returns>
  52. [HttpGet]
  53. [AjaxOnly]
  54. public ActionResult GetPageList(string pagination, string queryJson)
  55. {
  56. Pagination paginationobj = pagination.ToObject<Pagination>();
  57. var data = aDR_RestrictionIBLL.GetPageList(paginationobj, queryJson);
  58. var jsonData = new
  59. {
  60. rows = data,
  61. total = paginationobj.total,
  62. page = paginationobj.page,
  63. records = paginationobj.records
  64. };
  65. return Success(jsonData);
  66. }
  67. /// <summary>
  68. /// 获取表单数据
  69. /// </summary>
  70. /// <param name="keyValue">主键</param>
  71. /// <returns></returns>
  72. [HttpGet]
  73. [AjaxOnly]
  74. public ActionResult GetFormData(string keyValue)
  75. {
  76. var ADR_RestrictionData = aDR_RestrictionIBLL.GetADR_RestrictionEntity(keyValue);
  77. var jsonData = new
  78. {
  79. ADR_Restriction = ADR_RestrictionData,
  80. };
  81. return Success(jsonData);
  82. }
  83. [HttpGet]
  84. [AjaxOnly]
  85. public ActionResult GetFormDayData(string keyValue)
  86. {
  87. var ADR_RestrictionData = aDR_RestrictionIBLL.GetADR_RestrictionDay(keyValue).Select(m=>m.WorkDay.ToString("yyyy-MM-dd"));
  88. var jsonData = new
  89. {
  90. ADR_RestrictionDay = string.Join(",",ADR_RestrictionData)
  91. };
  92. return Success(jsonData);
  93. }
  94. #endregion
  95. #region 提交数据
  96. /// <summary>
  97. /// 删除实体数据
  98. /// </summary>
  99. /// <param name="keyValue">主键</param>
  100. /// <returns></returns>
  101. [HttpPost]
  102. [AjaxOnly]
  103. public ActionResult DeleteForm(string keyValue)
  104. {
  105. aDR_RestrictionIBLL.DeleteEntity(keyValue);
  106. return Success("删除成功!");
  107. }
  108. /// <summary>
  109. /// 启用限制
  110. /// </summary>
  111. /// <param name="keyValue">主键</param>
  112. /// <returns></returns>
  113. [HttpPost]
  114. [AjaxOnly]
  115. public ActionResult Enable(string keyValue)
  116. {
  117. aDR_RestrictionIBLL.Enable(keyValue);
  118. return Success("启用成功!");
  119. }
  120. /// <summary>
  121. /// 保存实体数据(新增、修改)
  122. /// </summary>
  123. /// <param name="keyValue">主键</param>
  124. /// <param name="strEntity">实体</param>
  125. /// <returns></returns>
  126. [HttpPost]
  127. [ValidateAntiForgeryToken]
  128. [AjaxOnly]
  129. public ActionResult SaveForm(string keyValue, string strEntity)
  130. {
  131. ADR_RestrictionEntity entity = strEntity.ToObject<ADR_RestrictionEntity>();
  132. aDR_RestrictionIBLL.SaveEntity(keyValue, entity);
  133. if (string.IsNullOrEmpty(keyValue))
  134. {
  135. }
  136. return Success("保存成功!");
  137. }
  138. [HttpPost]
  139. [ValidateAntiForgeryToken]
  140. [AjaxOnly]
  141. public ActionResult SaveFormDay(string keyValue, string strEntity)
  142. {
  143. List<string> entity = strEntity.ToObject<List<string>>();
  144. List<ADR_RestrictionDayEntity> listday=new List<ADR_RestrictionDayEntity>();
  145. foreach (var item in entity)
  146. {
  147. var ADR_RestrictionDayEntity = new ADR_RestrictionDayEntity();
  148. ADR_RestrictionDayEntity.RId = keyValue;
  149. ADR_RestrictionDayEntity.WorkDay =Convert.ToDateTime(item);
  150. listday.Add(ADR_RestrictionDayEntity);
  151. }
  152. aDR_RestrictionIBLL.SaveFormDay(keyValue, listday);
  153. if (string.IsNullOrEmpty(keyValue))
  154. {
  155. }
  156. return Success("保存成功!");
  157. }
  158. #endregion
  159. }
  160. }