Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

122 righe
4.2 KiB

  1. using Nancy;
  2. using Learun.Util;
  3. using System.Collections.Generic;
  4. using Learun.Application.TwoDevelopment.EducationalAdministration;
  5. using Learun.Application.TwoDevelopment.PersonnelManagement;
  6. namespace Learun.Application.WebApi.Modules
  7. {
  8. /// <summary>
  9. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  10. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  11. /// 创 建:超级管理员
  12. /// 日 期:2019-12-24 17:07
  13. /// 描 述:图书借阅
  14. /// </summary>
  15. public class DutyScheduleApi : BaseApi
  16. {
  17. private DutyScheduleIBLL dutyScheduleIBLL = new DutyScheduleBLL();
  18. /// <summary>
  19. /// 注册接口
  20. /// <summary>
  21. public DutyScheduleApi()
  22. : base("/learun/adms/PersonnelManagement/DutySchedule")
  23. {
  24. Get["/pagelist"] = GetPageList;
  25. Get["/list"] = GetList;
  26. Get["/form"] = GetForm;
  27. Post["/save"] = SaveForm;
  28. Post["/delete"] = DeleteForm;
  29. }
  30. #region 获取数据
  31. /// <summary>
  32. /// 获取页面显示列表分页数据
  33. /// <summary>
  34. /// <param name="_"></param>
  35. /// <returns></returns>
  36. public Response GetPageList(dynamic _)
  37. {
  38. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  39. var data = dutyScheduleIBLL.GetPageList(parameter.pagination, parameter.queryJson);
  40. var jsonData = new
  41. {
  42. rows = data,
  43. total = parameter.pagination.total,
  44. page = parameter.pagination.page,
  45. records = parameter.pagination.records
  46. };
  47. return Success(jsonData);
  48. }
  49. /// <summary>
  50. /// 获取页面显示列表数据
  51. /// <summary>
  52. /// <param name="_"></param>
  53. /// <returns></returns>
  54. public Response GetList(dynamic _)
  55. {
  56. string queryJson = this.GetReqData();
  57. var data = dutyScheduleIBLL.GetList();
  58. return Success(data);
  59. }
  60. /// <summary>
  61. /// 获取表单数据
  62. /// <summary>
  63. /// <param name="_"></param>
  64. /// <returns></returns>
  65. public Response GetForm(dynamic _)
  66. {
  67. string keyValue = this.GetReqData();
  68. var ScheduleData = dutyScheduleIBLL.GetDutyScheduleEntity(keyValue);
  69. //ScheduleData.StartTime = Convert.ToDateTime((ScheduleData.StartTime.ToDate().ToString("yyyy-MM-dd") + " " + ScheduleData.StartTime.Substring(0, 2) + ":" + ScheduleData.StartTime.Substring(2, 2)).ToDate().ToString("yyyy-MM-dd HH:mm"));
  70. //ScheduleData.EndTime = Convert.ToDateTime((ScheduleData.EndTime.ToDate().ToString("yyyy-MM-dd") + " " + ScheduleData.EndTime.Substring(0, 2) + ":" + ScheduleData.F_EndTime.Substring(2, 2)).ToDate().ToString("yyyy-MM-dd HH:mm"));
  71. var jsonData = new
  72. {
  73. Schedule = ScheduleData,
  74. };
  75. return Success(jsonData);
  76. }
  77. #endregion
  78. #region 提交数据
  79. /// <summary>
  80. /// 保存实体数据(新增、修改)
  81. /// <param name="_"></param>
  82. /// <summary>
  83. /// <returns></returns>
  84. public Response SaveForm(dynamic _)
  85. {
  86. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  87. DutyScheduleEntity entity = parameter.strEntity.ToObject<DutyScheduleEntity>();
  88. dutyScheduleIBLL.SaveEntity(parameter.keyValue, entity);
  89. return Success("保存成功!");
  90. }
  91. /// <summary>
  92. /// 删除实体数据
  93. /// <param name="_"></param>
  94. /// <summary>
  95. /// <returns></returns>
  96. public Response DeleteForm(dynamic _)
  97. {
  98. string keyValue = this.GetReqData();
  99. dutyScheduleIBLL.DeleteEntity(keyValue);
  100. return Success("删除成功!");
  101. }
  102. #endregion
  103. #region 私有类
  104. /// <summary>
  105. /// 表单实体类
  106. /// <summary>
  107. private class ReqFormEntity
  108. {
  109. public string keyValue { get; set; }
  110. public string strEntity { get; set; }
  111. }
  112. #endregion
  113. }
  114. }