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.

DemoleaveService.cs 2.8 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using Learun.DataBase.Repository;
  2. using Learun.Util;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace Learun.Application.TwoDevelopment.SystemDemo
  6. {
  7. /// <summary>
  8. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  9. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  10. /// 创建人:陈彬彬
  11. /// 日 期:2017.04.17
  12. /// 描 述:系统表单-请假单
  13. /// </summary>
  14. public class DemoleaveService : RepositoryFactory
  15. {
  16. #region 获取数据
  17. /// <summary>
  18. /// 获取请假数据列表
  19. /// </summary>
  20. /// <param name="pagination">分页</param>
  21. /// <returns></returns>
  22. public IEnumerable<DemoleaveEntity> GetPageList(Pagination pagination)
  23. {
  24. try
  25. {
  26. return this.BaseRepository().FindList<DemoleaveEntity>(pagination);
  27. }
  28. catch (Exception ex)
  29. {
  30. if (ex is ExceptionEx)
  31. {
  32. throw;
  33. }
  34. else
  35. {
  36. throw ExceptionEx.ThrowServiceException(ex);
  37. }
  38. }
  39. }
  40. /// <summary>
  41. /// 根据流程实例获取表单数据
  42. /// </summary>
  43. /// <param name="processId"></param>
  44. /// <returns></returns>
  45. public DemoleaveEntity GetEntity(string processId)
  46. {
  47. try
  48. {
  49. return this.BaseRepository().FindEntity<DemoleaveEntity>(processId);
  50. }
  51. catch (Exception ex)
  52. {
  53. if (ex is ExceptionEx)
  54. {
  55. throw;
  56. }
  57. else
  58. {
  59. throw ExceptionEx.ThrowServiceException(ex);
  60. }
  61. }
  62. }
  63. #endregion
  64. #region 提交数据
  65. /// <summary>
  66. /// 保存更新数据
  67. /// </summary>
  68. /// <param name="keyValue">主键</param>
  69. /// <param name="entity">实体对象</param>
  70. public void SaveEntity(string keyValue, DemoleaveEntity entity)
  71. {
  72. try
  73. {
  74. if (string.IsNullOrEmpty(keyValue))
  75. {
  76. entity.Create();
  77. this.BaseRepository().Insert(entity);
  78. }
  79. else
  80. {
  81. entity.Modify(keyValue);
  82. this.BaseRepository().Update(entity);
  83. }
  84. }
  85. catch (Exception ex)
  86. {
  87. if (ex is ExceptionEx)
  88. {
  89. throw;
  90. }
  91. else
  92. {
  93. throw ExceptionEx.ThrowServiceException(ex);
  94. }
  95. }
  96. }
  97. #endregion
  98. }
  99. }