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.
 
 
 
 
 
 

209 lines
6.5 KiB

  1. using Dapper;
  2. using Learun.DataBase.Repository;
  3. using Learun.Util;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Text;
  8. namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2019-06-03 15:52
  15. /// 描 述:收费方式设置
  16. /// </summary>
  17. public class FinaChargeBankService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取页面显示列表数据
  22. /// <summary>
  23. /// <param name="queryJson">查询参数</param>
  24. /// <returns></returns>
  25. public IEnumerable<FinaChargeBankEntity> GetPageList(Pagination pagination, string queryJson)
  26. {
  27. try
  28. {
  29. var strSql = new StringBuilder();
  30. strSql.Append("SELECT ");
  31. strSql.Append(@"
  32. t.ChargeBankID,
  33. t.ChargeBankName,
  34. t.Remark,
  35. t.VirtualFlag,
  36. t.CreateDate,
  37. t.CreateUserId,
  38. t.CreateUserName
  39. ");
  40. strSql.Append(" FROM FinaChargeBank t ");
  41. strSql.Append(" WHERE 1=1 ");
  42. var queryParam = queryJson.ToJObject();
  43. // 虚拟参数
  44. var dp = new DynamicParameters(new { });
  45. if (!queryParam["ChargeBankName"].IsEmpty())
  46. {
  47. dp.Add("ChargeBankName", "%" + queryParam["ChargeBankName"].ToString() + "%", DbType.String);
  48. strSql.Append(" AND t.ChargeBankName Like @ChargeBankName ");
  49. }
  50. return this.BaseRepository("CollegeMIS").FindList<FinaChargeBankEntity>(strSql.ToString(), dp, pagination);
  51. }
  52. catch (Exception ex)
  53. {
  54. if (ex is ExceptionEx)
  55. {
  56. throw;
  57. }
  58. else
  59. {
  60. throw ExceptionEx.ThrowServiceException(ex);
  61. }
  62. }
  63. }
  64. /// <summary>
  65. /// 获取页面显示列表数据
  66. /// <summary>
  67. /// <returns></returns>
  68. public IEnumerable<FinaChargeBankEntity> GetList(string keyword)
  69. {
  70. try
  71. {
  72. var strSql = new StringBuilder();
  73. strSql.Append("select * from FinaChargeBank where 1=1 and ChargeBankName like '%" + keyword + "%' ");
  74. return this.BaseRepository("CollegeMIS").FindList<FinaChargeBankEntity>(strSql.ToString());
  75. }
  76. catch (Exception ex)
  77. {
  78. if (ex is ExceptionEx)
  79. {
  80. throw;
  81. }
  82. else
  83. {
  84. throw ExceptionEx.ThrowServiceException(ex);
  85. }
  86. }
  87. }
  88. /// <summary>
  89. /// 获取FinaChargeBank表实体数据
  90. /// <param name="keyValue">主键</param>
  91. /// <summary>
  92. /// <returns></returns>
  93. public FinaChargeBankEntity GetFinaChargeBankEntity(string keyValue)
  94. {
  95. try
  96. {
  97. //return this.BaseRepository("CollegeMIS").FindEntity<FinaChargeBankEntity>(keyValue);
  98. var keyvalue = Convert.ToInt32(keyValue);
  99. return this.BaseRepository("CollegeMIS").FindEntity<FinaChargeBankEntity>(keyvalue);
  100. }
  101. catch (Exception ex)
  102. {
  103. if (ex is ExceptionEx)
  104. {
  105. throw;
  106. }
  107. else
  108. {
  109. throw ExceptionEx.ThrowServiceException(ex);
  110. }
  111. }
  112. }
  113. /// <summary>
  114. /// 获取FinaChargeBank表实体数据
  115. /// <param name="chargeBankName">收费方式名称</param>
  116. /// <summary>
  117. /// <returns></returns>
  118. public FinaChargeBankEntity GetFinaChargeBankEntityByChargeBankName(string chargeBankName)
  119. {
  120. try
  121. {
  122. return this.BaseRepository("CollegeMIS").FindEntity<FinaChargeBankEntity>(x => x.ChargeBankName.Trim() == chargeBankName.Trim());
  123. }
  124. catch (Exception ex)
  125. {
  126. if (ex is ExceptionEx)
  127. {
  128. throw;
  129. }
  130. else
  131. {
  132. throw ExceptionEx.ThrowServiceException(ex);
  133. }
  134. }
  135. }
  136. #endregion
  137. #region 提交数据
  138. /// <summary>
  139. /// 删除实体数据
  140. /// <param name="keyValue">主键</param>
  141. /// <summary>
  142. /// <returns></returns>
  143. public void DeleteEntity(string keyValue)
  144. {
  145. try
  146. {
  147. //this.BaseRepository("CollegeMIS").Delete<FinaChargeBankEntity>(t => t.ChargeBankID == keyValue);
  148. var keyvalue = Convert.ToInt32(keyValue);
  149. this.BaseRepository("CollegeMIS").Delete<FinaChargeBankEntity>(t => t.ChargeBankID == keyvalue);
  150. }
  151. catch (Exception ex)
  152. {
  153. if (ex is ExceptionEx)
  154. {
  155. throw;
  156. }
  157. else
  158. {
  159. throw ExceptionEx.ThrowServiceException(ex);
  160. }
  161. }
  162. }
  163. /// <summary>
  164. /// 保存实体数据(新增、修改)
  165. /// <param name="keyValue">主键</param>
  166. /// <summary>
  167. /// <returns></returns>
  168. public void SaveEntity(string keyValue, FinaChargeBankEntity entity)
  169. {
  170. try
  171. {
  172. if (!string.IsNullOrEmpty(keyValue))
  173. {
  174. entity.Modify(keyValue);
  175. this.BaseRepository("CollegeMIS").Update(entity);
  176. }
  177. else
  178. {
  179. entity.Create();
  180. this.BaseRepository("CollegeMIS").Insert(entity);
  181. }
  182. }
  183. catch (Exception ex)
  184. {
  185. if (ex is ExceptionEx)
  186. {
  187. throw;
  188. }
  189. else
  190. {
  191. throw ExceptionEx.ThrowServiceException(ex);
  192. }
  193. }
  194. }
  195. #endregion
  196. }
  197. }