济源12345后端

T_Web_News.cs 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. using System;
  2. using System.Data;
  3. using System.Collections.Generic;
  4. using CallCenterApi.Model;
  5. namespace CallCenterApi.BLL
  6. {
  7. /// <summary>
  8. /// T_Web_News
  9. /// </summary>
  10. public partial class T_Web_News
  11. {
  12. private readonly CallCenterApi.DAL.T_Web_News dal=new CallCenterApi.DAL.T_Web_News();
  13. public T_Web_News()
  14. {}
  15. #region Method
  16. /// <summary>
  17. /// 是否存在该记录
  18. /// </summary>
  19. public bool Exists(int id)
  20. {
  21. return dal.Exists(id);
  22. }
  23. /// <summary>
  24. /// 增加一条数据
  25. /// </summary>
  26. public int Add(CallCenterApi.Model.T_Web_News model)
  27. {
  28. return dal.Add(model);
  29. }
  30. /// <summary>
  31. /// 更新一条数据
  32. /// </summary>
  33. public bool Update(CallCenterApi.Model.T_Web_News model)
  34. {
  35. return dal.Update(model);
  36. }
  37. /// <summary>
  38. /// 删除一条数据
  39. /// </summary>
  40. public bool Delete(int id)
  41. {
  42. return dal.Delete(id);
  43. }
  44. /// <summary>
  45. /// 删除一条数据
  46. /// </summary>
  47. public bool DeleteList(string idlist )
  48. {
  49. return dal.DeleteList(idlist );
  50. }
  51. /// <summary>
  52. /// 得到一个对象实体
  53. /// </summary>
  54. public CallCenterApi.Model.T_Web_News GetModel(int id)
  55. {
  56. return dal.GetModel(id);
  57. }
  58. /// <summary>
  59. /// 获得数据列表
  60. /// </summary>
  61. public DataSet GetList(string strWhere)
  62. {
  63. return dal.GetList(strWhere);
  64. }
  65. /// <summary>
  66. /// 获得前几行数据
  67. /// </summary>
  68. public DataSet GetList(int Top,string strWhere,string filedOrder)
  69. {
  70. return dal.GetList(Top,strWhere,filedOrder);
  71. }
  72. /// <summary>
  73. /// 获得数据列表
  74. /// </summary>
  75. public List<CallCenterApi.Model.T_Web_News> GetModelList(string strWhere)
  76. {
  77. DataSet ds = dal.GetList(strWhere);
  78. return DataTableToList(ds.Tables[0]);
  79. }
  80. /// <summary>
  81. /// 获得数据列表
  82. /// </summary>
  83. public List<CallCenterApi.Model.T_Web_News> DataTableToList(DataTable dt)
  84. {
  85. List<CallCenterApi.Model.T_Web_News> modelList = new List<CallCenterApi.Model.T_Web_News>();
  86. int rowsCount = dt.Rows.Count;
  87. if (rowsCount > 0)
  88. {
  89. CallCenterApi.Model.T_Web_News model;
  90. for (int n = 0; n < rowsCount; n++)
  91. {
  92. model = new CallCenterApi.Model.T_Web_News();
  93. if(dt.Rows[n]["id"]!=null && dt.Rows[n]["id"].ToString()!="")
  94. {
  95. model.id=int.Parse(dt.Rows[n]["id"].ToString());
  96. }
  97. if(dt.Rows[n]["ClassId"]!=null && dt.Rows[n]["ClassId"].ToString()!="")
  98. {
  99. model.ClassId=int.Parse(dt.Rows[n]["ClassId"].ToString());
  100. }
  101. if(dt.Rows[n]["bt"]!=null && dt.Rows[n]["bt"].ToString()!="")
  102. {
  103. model.bt=dt.Rows[n]["bt"].ToString();
  104. }
  105. if(dt.Rows[n]["nr"]!=null && dt.Rows[n]["nr"].ToString()!="")
  106. {
  107. model.nr=dt.Rows[n]["nr"].ToString();
  108. }
  109. if(dt.Rows[n]["sj"]!=null && dt.Rows[n]["sj"].ToString()!="")
  110. {
  111. model.sj=DateTime.Parse(dt.Rows[n]["sj"].ToString());
  112. }
  113. if(dt.Rows[n]["img"]!=null && dt.Rows[n]["img"].ToString()!="")
  114. {
  115. model.img=dt.Rows[n]["img"].ToString();
  116. }
  117. if(dt.Rows[n]["ordernum"]!=null && dt.Rows[n]["ordernum"].ToString()!="")
  118. {
  119. model.ordernum=int.Parse(dt.Rows[n]["ordernum"].ToString());
  120. }
  121. if(dt.Rows[n]["urlname"]!=null && dt.Rows[n]["urlname"].ToString()!="")
  122. {
  123. model.urlname=dt.Rows[n]["urlname"].ToString();
  124. }
  125. if(dt.Rows[n]["zxbh"]!=null && dt.Rows[n]["zxbh"].ToString()!="")
  126. {
  127. model.zxbh=int.Parse(dt.Rows[n]["zxbh"].ToString());
  128. }
  129. if (dt.Rows[n]["source"] != null && dt.Rows[n]["source"].ToString() != "")
  130. {
  131. model.source = dt.Rows[n]["source"].ToString();
  132. }
  133. modelList.Add(model);
  134. }
  135. }
  136. return modelList;
  137. }
  138. /// <summary>
  139. /// 获得数据列表
  140. /// </summary>
  141. public DataSet GetAllList()
  142. {
  143. return GetList("");
  144. }
  145. /// <summary>
  146. /// 分页获取数据列表
  147. /// </summary>
  148. public int GetRecordCount(string strWhere)
  149. {
  150. return dal.GetRecordCount(strWhere);
  151. }
  152. /// <summary>
  153. /// 分页获取数据列表
  154. /// </summary>
  155. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  156. {
  157. return dal.GetListByPage( strWhere, orderby, startIndex, endIndex);
  158. }
  159. /// <summary>
  160. /// 分页获取数据列表
  161. /// </summary>
  162. //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
  163. //{
  164. //return dal.GetList(PageSize,PageIndex,strWhere);
  165. //}
  166. #endregion Method
  167. }
  168. }