Tk_GalleryDetailBLL.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. using Lottomat.Application.Entity.BaseManage;
  2. using Lottomat.Application.IService.BaseManage;
  3. using Lottomat.Application.Service.BaseManage;
  4. using Lottomat.Util.WebControl;
  5. using System.Collections.Generic;
  6. using System;
  7. using Lottomat.Application.IService.GalleryManage;
  8. using Lottomat.Application.Service.GalleryManage;
  9. using Lottomat.Application.Entity.GalleryManage;
  10. using System.Linq.Expressions;
  11. using Lottomat.Application.Entity.PublicInfoManage;
  12. using System.Linq;
  13. using Newtonsoft.Json;
  14. namespace Lottomat.Application.Busines.GalleryManage
  15. {
  16. /// <summary>
  17. /// 版 本 1.0
  18. /// Copyright (c) 2016-2017
  19. /// 创 建:开发者账号
  20. /// 日 期:2017-10-19 14:29
  21. /// 描 述:图库详情表
  22. /// </summary>
  23. public class Tk_GalleryDetailBLL
  24. {
  25. private ITk_GalleryDetailIService service = new Tk_GalleryDetailService();
  26. private Tk_GalleryBLL tk_GalleryBLL = new Tk_GalleryBLL();
  27. #region 获取数据
  28. /// <summary>
  29. /// 获取列表
  30. /// </summary>
  31. /// <param name="queryJson">查询参数</param>
  32. /// <returns>返回列表</returns>
  33. public IEnumerable<Tk_GalleryDetail> GetList(string queryJson)
  34. {
  35. return service.GetList(queryJson);
  36. }
  37. public IEnumerable<Tk_GalleryDetail> GetList(Expression<Func<Tk_GalleryDetail, bool>> condition)
  38. {
  39. return service.GetList(condition);
  40. }
  41. /// <summary>
  42. /// 获取实体
  43. /// </summary>
  44. /// <param name="keyValue">主键值</param>
  45. /// <returns></returns>
  46. public Tk_GalleryDetail GetEntity(string keyValue)
  47. {
  48. return service.GetEntity(keyValue);
  49. }
  50. #endregion
  51. #region 提交数据
  52. /// <summary>
  53. /// 删除数据
  54. /// </summary>
  55. /// <param name="keyValue">主键</param>
  56. public void RemoveForm(string keyValue)
  57. {
  58. try
  59. {
  60. service.RemoveForm(keyValue);
  61. }
  62. catch (Exception)
  63. {
  64. throw;
  65. }
  66. }
  67. /// <summary>
  68. /// 保存表单(新增、修改)
  69. /// </summary>
  70. /// <param name="keyValue">主键值</param>
  71. /// <param name="entity">实体对象</param>
  72. /// <returns></returns>
  73. public void SaveForm(string keyValue, Tk_GalleryDetail entity)
  74. {
  75. try
  76. {
  77. service.SaveForm(keyValue, entity);
  78. }
  79. catch (Exception)
  80. {
  81. throw;
  82. }
  83. }
  84. public List<Tk_GalleryDetail> GetPageList(Pagination pagination, string queryJson)
  85. {
  86. try
  87. {
  88. if (!String.IsNullOrEmpty(queryJson))
  89. {
  90. Dictionary<string, string> dict = new Dictionary<string, string>();
  91. dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(queryJson);
  92. List<Tk_Gallery> glist = new List<Tk_Gallery>();
  93. if (dict.Keys.Contains("GalleryName"))
  94. {
  95. string gname = dict["GalleryName"];
  96. List<Tk_Gallery> tlist = tk_GalleryBLL.GetList(w => w.GalleryName == gname).ToList();
  97. if (tlist.Count > 0)
  98. {
  99. dict["GalleryId"] = tlist[0].ID;
  100. queryJson = JsonConvert.SerializeObject(dict);
  101. }
  102. }
  103. }
  104. List<Tk_GalleryDetail> list= service.GetPageList(pagination, queryJson).ToList();
  105. List<string> GalleryIdlist = list.Select(s => s.GalleryId).ToList();
  106. List<Tk_Gallery> gallerylist = tk_GalleryBLL.GetList(w => GalleryIdlist.Contains(w.ID)).ToList() ;
  107. for (int i = 0; i < list.Count; i++)
  108. {
  109. Tk_Gallery tmp = gallerylist.SingleOrDefault(w=>w.ID==list[i].GalleryId);
  110. if (tmp!=null)
  111. {
  112. list[i].GalleryId = tmp.GalleryName;
  113. }
  114. else
  115. {
  116. list[i].GalleryId = "";
  117. }
  118. }
  119. return list;
  120. }
  121. catch (Exception)
  122. {
  123. throw;
  124. }
  125. }
  126. public int MenuNewPeriodsNumber(string menuname)
  127. {
  128. try
  129. {
  130. return service.MenuNewPeriodsNumber(menuname);
  131. }
  132. catch (Exception)
  133. {
  134. throw;
  135. }
  136. }
  137. public int NewPeriodsNumber()
  138. {
  139. try
  140. {
  141. return service.NewPeriodsNumber();
  142. }
  143. catch (Exception)
  144. {
  145. throw;
  146. }
  147. }
  148. public List<Tk_GalleryDetail> QueryDetailByGalleryId(List<string> galleryIds, int periodsNumber)
  149. {
  150. try
  151. {
  152. return service.QueryDetailByGalleryId(galleryIds, periodsNumber);
  153. }
  154. catch (Exception)
  155. {
  156. throw;
  157. }
  158. }
  159. #endregion
  160. }
  161. }