DataItemDetailBLL.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using LeaRun.Application.Entity.SystemManage;
  2. using LeaRun.Application.Entity.SystemManage.ViewModel;
  3. using LeaRun.Application.IService.SystemManage;
  4. using LeaRun.Application.Service.SystemManage;
  5. using LeaRun.Cache.Factory;
  6. using LeaRun.Util;
  7. using System;
  8. using System.Collections.Generic;
  9. namespace LeaRun.Application.Busines.SystemManage
  10. {
  11. /// <summary>
  12. /// 版 本 6.1
  13. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  14. /// 创建人:佘赐雄
  15. /// 日 期:2015.11.17 9:56
  16. /// 描 述:数据字典明细
  17. /// </summary>
  18. public class DataItemDetailBLL
  19. {
  20. private IDataItemDetailService service = new DataItemDetailService();
  21. /// <summary>
  22. /// 缓存key
  23. /// </summary>
  24. public string cacheKey = "dataItemCache";
  25. #region 获取数据
  26. /// <summary>
  27. /// 明细列表
  28. /// </summary>
  29. /// <param name="itemId">分类Id</param>
  30. /// <returns></returns>
  31. public IEnumerable<DataItemDetailEntity> GetList(string itemId)
  32. {
  33. return service.GetList(itemId);
  34. }
  35. /// <summary>
  36. /// 明细实体
  37. /// </summary>
  38. /// <param name="keyValue">主键值</param>
  39. /// <returns></returns>
  40. public DataItemDetailEntity GetEntity(string keyValue)
  41. {
  42. return service.GetEntity(keyValue);
  43. }
  44. /// <summary>
  45. /// 数据字典列表
  46. /// </summary>
  47. /// <returns></returns>
  48. public IEnumerable<DataItemModel> GetDataItemList()
  49. {
  50. return service.GetDataItemList();
  51. }
  52. #endregion
  53. #region 验证数据
  54. /// <summary>
  55. /// 项目值不能重复
  56. /// </summary>
  57. /// <param name="itemValue">项目值</param>
  58. /// <param name="keyValue">主键</param>
  59. /// <param name="itemId">分类Id</param>
  60. /// <returns></returns>
  61. public bool ExistItemValue(string itemValue, string keyValue, string itemId)
  62. {
  63. return service.ExistItemValue(itemValue, keyValue, itemId);
  64. }
  65. /// <summary>
  66. /// 项目名不能重复
  67. /// </summary>
  68. /// <param name="itemName">项目名</param>
  69. /// <param name="keyValue">主键</param>
  70. /// <param name="itemId">分类Id</param>
  71. /// <returns></returns>
  72. public bool ExistItemName(string itemName, string keyValue, string itemId)
  73. {
  74. return service.ExistItemName(itemName, keyValue, itemId);
  75. }
  76. #endregion
  77. #region 提交数据
  78. /// <summary>
  79. /// 删除明细
  80. /// </summary>
  81. /// <param name="keyValue">主键</param>
  82. public void RemoveForm(string keyValue)
  83. {
  84. try
  85. {
  86. service.RemoveForm(keyValue);
  87. CacheFactory.Cache().RemoveCache(cacheKey);
  88. }
  89. catch (Exception)
  90. {
  91. throw;
  92. }
  93. }
  94. /// <summary>
  95. /// 保存明细表单(新增、修改)
  96. /// </summary>
  97. /// <param name="keyValue">主键值</param>
  98. /// <param name="dataItemDetailEntity">明细实体</param>
  99. /// <returns></returns>
  100. public void SaveForm(string keyValue, DataItemDetailEntity dataItemDetailEntity)
  101. {
  102. try
  103. {
  104. dataItemDetailEntity.SimpleSpelling = Str.PinYin(dataItemDetailEntity.ItemName);
  105. service.SaveForm(keyValue, dataItemDetailEntity);
  106. CacheFactory.Cache().RemoveCache(cacheKey);
  107. }
  108. catch (Exception)
  109. {
  110. throw;
  111. }
  112. }
  113. #endregion
  114. }
  115. }