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.

CrmInvoiceService.cs 4.5 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using Learun.DataBase.Repository;
  2. using Learun.Util;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. namespace Learun.Application.CRM
  7. {
  8. /// <summary>
  9. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  10. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  11. /// 创 建:超级管理员
  12. /// 日 期:2017-07-11 14:47
  13. /// 描 述:开票信息
  14. /// </summary>
  15. public class CrmInvoiceService : RepositoryFactory
  16. {
  17. #region 获取数据
  18. /// <summary>
  19. /// 获取列表
  20. /// </summary>
  21. /// <param name="pagination">分页</param>
  22. /// <param name="queryJson">查询参数</param>
  23. /// <returns>返回分页列表</returns>
  24. public IEnumerable<CrmInvoiceEntity> GetPageList(Pagination pagination, string queryJson)
  25. {
  26. try
  27. {
  28. var expression = LinqExtensions.True<CrmInvoiceEntity>();
  29. var queryParam = queryJson.ToJObject();
  30. //查询条件
  31. if (!queryParam["keyword"].IsEmpty())
  32. {
  33. string keyword = queryParam["keyword"].ToString();
  34. expression = expression.And(t => t.F_CustomerName.Contains(keyword));
  35. }
  36. return this.BaseRepository().FindList(expression, pagination);
  37. }
  38. catch (Exception ex)
  39. {
  40. if (ex is ExceptionEx)
  41. {
  42. throw;
  43. }
  44. else
  45. {
  46. throw ExceptionEx.ThrowServiceException(ex);
  47. }
  48. }
  49. }
  50. /// <summary>
  51. /// 获取列表
  52. /// </summary>
  53. /// <param name="queryJson">查询参数</param>
  54. /// <returns>返回列表</returns>
  55. public IEnumerable<CrmInvoiceEntity> GetList(string queryJson)
  56. {
  57. try
  58. {
  59. return this.BaseRepository().IQueryable<CrmInvoiceEntity>().ToList();
  60. }
  61. catch (Exception ex)
  62. {
  63. if (ex is ExceptionEx)
  64. {
  65. throw;
  66. }
  67. else
  68. {
  69. throw ExceptionEx.ThrowServiceException(ex);
  70. }
  71. }
  72. }
  73. /// <summary>
  74. /// 获取实体
  75. /// </summary>
  76. /// <param name="keyValue">主键值</param>
  77. /// <returns></returns>
  78. public CrmInvoiceEntity GetEntity(string keyValue)
  79. {
  80. try
  81. {
  82. return this.BaseRepository().FindEntity<CrmInvoiceEntity>(keyValue);
  83. }
  84. catch (Exception ex)
  85. {
  86. if (ex is ExceptionEx)
  87. {
  88. throw;
  89. }
  90. else
  91. {
  92. throw ExceptionEx.ThrowServiceException(ex);
  93. }
  94. }
  95. }
  96. #endregion
  97. #region 提交数据
  98. /// <summary>
  99. /// 删除数据
  100. /// </summary>
  101. /// <param name="keyValue">主键</param>
  102. public void DeleteEntity(string keyValue)
  103. {
  104. try
  105. {
  106. this.BaseRepository().Delete(keyValue);
  107. }
  108. catch (Exception ex)
  109. {
  110. if (ex is ExceptionEx)
  111. {
  112. throw;
  113. }
  114. else
  115. {
  116. throw ExceptionEx.ThrowServiceException(ex);
  117. }
  118. }
  119. }
  120. /// <summary>
  121. /// 保存表单(新增、修改)
  122. /// </summary>
  123. /// <param name="keyValue">主键值</param>
  124. /// <param name="entity">实体对象</param>
  125. /// <returns></returns>
  126. public void SaveEntity(string keyValue, CrmInvoiceEntity entity)
  127. {
  128. try
  129. {
  130. if (!string.IsNullOrEmpty(keyValue))
  131. {
  132. entity.Modify(keyValue);
  133. this.BaseRepository().Update(entity);
  134. }
  135. else
  136. {
  137. entity.Create();
  138. this.BaseRepository().Insert(entity);
  139. }
  140. }
  141. catch (Exception ex)
  142. {
  143. if (ex is ExceptionEx)
  144. {
  145. throw;
  146. }
  147. else
  148. {
  149. throw ExceptionEx.ThrowServiceException(ex);
  150. }
  151. }
  152. }
  153. #endregion
  154. }
  155. }