DataItemDetailBLL.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using Lottomat.Application.Entity.SystemManage;
  2. using Lottomat.Application.Entity.SystemManage.ViewModel;
  3. using Lottomat.Application.IService.SystemManage;
  4. using Lottomat.Application.Service.SystemManage;
  5. using Lottomat.Cache.Factory;
  6. using Lottomat.Util;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using Lottomat.Utils;
  11. namespace Lottomat.Application.Busines.SystemManage
  12. {
  13. /// <summary>
  14. /// 版 本 1.0
  15. /// Copyright (c) 2016-2017
  16. /// 创建人:赵轶
  17. /// 日 期:2015.11.17 9:56
  18. /// 描 述:数据字典明细
  19. /// </summary>
  20. public class DataItemDetailBLL
  21. {
  22. private IDataItemDetailService service = new DataItemDetailService();
  23. /// <summary>
  24. /// 缓存key
  25. /// </summary>
  26. public string cacheKey = "dataItemCache";
  27. #region 获取数据
  28. /// <summary>
  29. /// 明细列表
  30. /// </summary>
  31. /// <param name="itemId">分类Id</param>
  32. /// <returns></returns>
  33. public IEnumerable<DataItemDetailEntity> GetList(string itemId)
  34. {
  35. return service.GetList(itemId);
  36. }
  37. /// <summary>
  38. /// 明细实体
  39. /// </summary>
  40. /// <param name="keyValue">主键值</param>
  41. /// <returns></returns>
  42. public DataItemDetailEntity GetEntity(string keyValue)
  43. {
  44. return service.GetEntity(keyValue);
  45. }
  46. /// <summary>
  47. /// 数据字典列表
  48. /// </summary>
  49. /// <returns></returns>
  50. public IEnumerable<DataItemModel> GetDataItemList()
  51. {
  52. return service.GetDataItemList();
  53. }
  54. /// <summary>
  55. /// 根据分类ID获取实体对象
  56. /// </summary>
  57. /// <param name="id">ID</param>
  58. /// <returns></returns>
  59. public DataItemDetailEntity GetEntityById(string id)
  60. {
  61. DataItemDetailEntity old = service.GetEntityById(id);
  62. return old;
  63. }
  64. /// <summary>
  65. /// 根据分类ID获取实体对象
  66. /// </summary>
  67. /// <param name="id">ID</param>
  68. /// <returns></returns>
  69. public List<DataItemDetailEntity> GetDataItemListById(string id)
  70. {
  71. List<DataItemDetailEntity> old = service.GetDataItemListById(id).ToList();
  72. return old;
  73. }
  74. #endregion
  75. #region 验证数据
  76. /// <summary>
  77. /// 项目值不能重复
  78. /// </summary>
  79. /// <param name="itemValue">项目值</param>
  80. /// <param name="keyValue">主键</param>
  81. /// <param name="itemId">分类Id</param>
  82. /// <returns></returns>
  83. public bool ExistItemValue(string itemValue, string keyValue, string itemId)
  84. {
  85. return service.ExistItemValue(itemValue, keyValue, itemId);
  86. }
  87. /// <summary>
  88. /// 项目名不能重复
  89. /// </summary>
  90. /// <param name="itemName">项目名</param>
  91. /// <param name="keyValue">主键</param>
  92. /// <param name="itemId">分类Id</param>
  93. /// <returns></returns>
  94. public bool ExistItemName(string itemName, string keyValue, string itemId)
  95. {
  96. return service.ExistItemName(itemName, keyValue, itemId);
  97. }
  98. #endregion
  99. #region 提交数据
  100. /// <summary>
  101. /// 删除明细
  102. /// </summary>
  103. /// <param name="keyValue">主键</param>
  104. public void RemoveForm(string keyValue)
  105. {
  106. try
  107. {
  108. service.RemoveForm(keyValue);
  109. CacheFactory.Cache().RemoveCache(cacheKey);
  110. }
  111. catch (Exception)
  112. {
  113. throw;
  114. }
  115. }
  116. /// <summary>
  117. /// 保存明细表单(新增、修改)
  118. /// </summary>
  119. /// <param name="keyValue">主键值</param>
  120. /// <param name="dataItemDetailEntity">明细实体</param>
  121. /// <returns></returns>
  122. public void SaveForm(string keyValue, DataItemDetailEntity dataItemDetailEntity)
  123. {
  124. try
  125. {
  126. service.SaveForm(keyValue, dataItemDetailEntity);
  127. CacheFactory.Cache().RemoveCache(cacheKey);
  128. }
  129. catch (Exception)
  130. {
  131. throw;
  132. }
  133. }
  134. #endregion
  135. }
  136. }