BLL_iNethinkCMS_Special.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /*******************************************************************************
  2. * iNethinkCMS - 网站内容管理系统
  3. * Copyright (C) 2012-2013 inethink.com
  4. *
  5. * @author jackyang <69991000@qq.com>
  6. * @website http://cms.inethink.com
  7. * @version 1.3.6.0 (2013-08-14)
  8. *
  9. * This is licensed under the GNU LGPL, version 3.0 or later.
  10. * For details, see: http://www.gnu.org/licenses/gpl-3.0.html
  11. *******************************************************************************/
  12. using System;
  13. using System.Data;
  14. using System.Collections.Generic;
  15. using iNethinkCMS.Command;
  16. using iNethinkCMS.Model;
  17. namespace iNethinkCMS.BLL
  18. {
  19. /// <summary>
  20. /// BLL_iNethinkCMS_Special
  21. /// </summary>
  22. public partial class BLL_iNethinkCMS_Special
  23. {
  24. private readonly iNethinkCMS.DAL.DAL_iNethinkCMS_Special dal = new iNethinkCMS.DAL.DAL_iNethinkCMS_Special();
  25. public BLL_iNethinkCMS_Special()
  26. {
  27. }
  28. #region Method
  29. /// <summary>
  30. /// 是否存在该记录
  31. /// </summary>
  32. public bool Exists(int ID)
  33. {
  34. return dal.Exists(ID);
  35. }
  36. /// <summary>
  37. /// MaxID
  38. /// </summary>
  39. public int GetMaxID()
  40. {
  41. return dal.GetMaxID();
  42. }
  43. /// <summary>
  44. /// 增加一条数据
  45. /// </summary>
  46. public int Add(iNethinkCMS.Model.Model_iNethinkCMS_Special model)
  47. {
  48. return dal.Add(model);
  49. }
  50. /// <summary>
  51. /// 更新一条数据
  52. /// </summary>
  53. public bool Update(iNethinkCMS.Model.Model_iNethinkCMS_Special model)
  54. {
  55. return dal.Update(model);
  56. }
  57. /// <summary>
  58. /// 删除一条数据
  59. /// </summary>
  60. public bool Delete(int ID)
  61. {
  62. return dal.Delete(ID);
  63. }
  64. /// <summary>
  65. /// 删除一条数据
  66. /// </summary>
  67. public bool DeleteList(string IDlist)
  68. {
  69. return dal.DeleteList(IDlist);
  70. }
  71. /// <summary>
  72. /// 得到一个对象实体
  73. /// </summary>
  74. public iNethinkCMS.Model.Model_iNethinkCMS_Special GetModel(int ID)
  75. {
  76. return dal.GetModel(ID);
  77. }
  78. /// <summary>
  79. /// 得到一个对象实体,从缓存中
  80. /// </summary>
  81. public iNethinkCMS.Model.Model_iNethinkCMS_Special GetModelByCache(int ID)
  82. {
  83. string CacheKey = iNethinkCMS.Command.Command_Configuration.GetConfigString("CacheKey");
  84. CacheKey = CacheKey + "_Model_iNethinkCMS_SpecialModel_" + ID;
  85. object objModel = iNethinkCMS.Command.Command_DataCache.GetCache(CacheKey);
  86. if (objModel == null)
  87. {
  88. try
  89. {
  90. objModel = dal.GetModel(ID);
  91. if (objModel != null)
  92. {
  93. int ModelCache = iNethinkCMS.Command.Command_Configuration.GetConfigInt("CacheTime");
  94. iNethinkCMS.Command.Command_DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddSeconds(ModelCache), TimeSpan.Zero);
  95. }
  96. }
  97. catch
  98. {
  99. }
  100. }
  101. return (iNethinkCMS.Model.Model_iNethinkCMS_Special)objModel;
  102. }
  103. /// <summary>
  104. /// 获得数据列表
  105. /// </summary>
  106. public DataSet GetList(string strWhere)
  107. {
  108. return dal.GetList(strWhere);
  109. }
  110. /// <summary>
  111. /// 获得前几行数据
  112. /// </summary>
  113. public DataSet GetList(int Top, string strWhere, string filedOrder)
  114. {
  115. return dal.GetList(Top, strWhere, filedOrder);
  116. }
  117. /// <summary>
  118. /// 获得数据列表
  119. /// </summary>
  120. public List<iNethinkCMS.Model.Model_iNethinkCMS_Special> GetModelList(string strWhere)
  121. {
  122. DataSet ds = dal.GetList(strWhere);
  123. return DataTableToList(ds.Tables[0]);
  124. }
  125. /// <summary>
  126. /// 获得数据列表
  127. /// </summary>
  128. public List<iNethinkCMS.Model.Model_iNethinkCMS_Special> DataTableToList(DataTable dt)
  129. {
  130. List<iNethinkCMS.Model.Model_iNethinkCMS_Special> modelList = new List<iNethinkCMS.Model.Model_iNethinkCMS_Special>();
  131. int rowsCount = dt.Rows.Count;
  132. if (rowsCount > 0)
  133. {
  134. iNethinkCMS.Model.Model_iNethinkCMS_Special model;
  135. for (int n = 0; n < rowsCount; n++)
  136. {
  137. model = new iNethinkCMS.Model.Model_iNethinkCMS_Special();
  138. if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
  139. {
  140. model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
  141. }
  142. if (dt.Rows[n]["SpecialName"] != null && dt.Rows[n]["SpecialName"].ToString() != "")
  143. {
  144. model.SpecialName = dt.Rows[n]["SpecialName"].ToString();
  145. }
  146. if (dt.Rows[n]["SpecialTitle"] != null && dt.Rows[n]["SpecialTitle"].ToString() != "")
  147. {
  148. model.SpecialTitle = dt.Rows[n]["SpecialTitle"].ToString();
  149. }
  150. if (dt.Rows[n]["SpecialKeyword"] != null && dt.Rows[n]["SpecialKeyword"].ToString() != "")
  151. {
  152. model.SpecialKeyword = dt.Rows[n]["SpecialKeyword"].ToString();
  153. }
  154. if (dt.Rows[n]["SpecialDescription"] != null && dt.Rows[n]["SpecialDescription"].ToString() != "")
  155. {
  156. model.SpecialDescription = dt.Rows[n]["SpecialDescription"].ToString();
  157. }
  158. if (dt.Rows[n]["SpecialTemplate"] != null && dt.Rows[n]["SpecialTemplate"].ToString() != "")
  159. {
  160. model.SpecialTemplate = dt.Rows[n]["SpecialTemplate"].ToString();
  161. }
  162. if (dt.Rows[n]["SpecialUrl"] != null && dt.Rows[n]["SpecialUrl"].ToString() != "")
  163. {
  164. model.SpecialUrl = dt.Rows[n]["SpecialUrl"].ToString();
  165. }
  166. if (dt.Rows[n]["SpecialPic"] != null && dt.Rows[n]["SpecialPic"].ToString() != "")
  167. {
  168. model.SpecialPic = dt.Rows[n]["SpecialPic"].ToString();
  169. }
  170. if (dt.Rows[n]["SpecialContent"] != null && dt.Rows[n]["SpecialContent"].ToString() != "")
  171. {
  172. model.SpecialContent = dt.Rows[n]["SpecialContent"].ToString();
  173. }
  174. if (dt.Rows[n]["Display"] != null && dt.Rows[n]["Display"].ToString() != "")
  175. {
  176. model.Display = int.Parse(dt.Rows[n]["Display"].ToString());
  177. }
  178. if (dt.Rows[n]["OrderNum"] != null && dt.Rows[n]["OrderNum"].ToString() != "")
  179. {
  180. model.OrderNum = int.Parse(dt.Rows[n]["OrderNum"].ToString());
  181. }
  182. modelList.Add(model);
  183. }
  184. }
  185. return modelList;
  186. }
  187. /// <summary>
  188. /// 获得数据列表
  189. /// </summary>
  190. public DataSet GetAllList()
  191. {
  192. return GetList("");
  193. }
  194. /// <summary>
  195. /// 分页获取数据列表
  196. /// </summary>
  197. public int GetRecordCount(string strWhere)
  198. {
  199. return dal.GetRecordCount(strWhere);
  200. }
  201. /// <summary>
  202. /// 分页获取数据列表
  203. /// </summary>
  204. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  205. {
  206. return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
  207. }
  208. #endregion Method
  209. }
  210. }