12345市长热线标准版-后端

T_Sys_Function.cs 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. using System;
  2. using System.Data;
  3. using System.Collections.Generic;
  4. using CallCenterApi.Model;
  5. namespace CallCenterApi.BLL
  6. {
  7. /// <summary>
  8. /// 1
  9. /// </summary>
  10. public partial class T_Sys_Function
  11. {
  12. private readonly CallCenterApi.DAL.T_Sys_Function dal=new CallCenterApi.DAL.T_Sys_Function();
  13. public T_Sys_Function()
  14. {}
  15. #region Method
  16. /// <summary>
  17. /// 得到最大ID
  18. /// </summary>
  19. public int GetMaxId()
  20. {
  21. return dal.GetMaxId();
  22. }
  23. /// <summary>
  24. /// 是否存在该记录
  25. /// </summary>
  26. public bool Exists(int F_FunctionId)
  27. {
  28. return dal.Exists(F_FunctionId);
  29. }
  30. /// <summary>
  31. /// 由id返回code
  32. /// </summary>
  33. public string GetCodeById(int functionId)
  34. {
  35. return dal.GetCodeById(functionId);
  36. }
  37. /// <summary>
  38. /// 增加一条数据
  39. /// </summary>
  40. public int Add(CallCenterApi.Model.T_Sys_Function model)
  41. {
  42. return dal.Add(model);
  43. }
  44. /// <summary>
  45. /// 更新一条数据
  46. /// </summary>
  47. public bool Update(CallCenterApi.Model.T_Sys_Function model)
  48. {
  49. return dal.Update(model);
  50. }
  51. /// <summary>
  52. /// 删除一条数据
  53. /// </summary>
  54. public bool Delete(int F_FunctionId)
  55. {
  56. return dal.Delete(F_FunctionId);
  57. }
  58. /// <summary>
  59. /// 删除一条数据
  60. /// </summary>
  61. public bool DeleteList(string F_FunctionIdlist )
  62. {
  63. return dal.DeleteList(F_FunctionIdlist );
  64. }
  65. /// <summary>
  66. /// 得到一个对象实体
  67. /// </summary>
  68. public CallCenterApi.Model.T_Sys_Function GetModel(int F_FunctionId)
  69. {
  70. return dal.GetModel(F_FunctionId);
  71. }
  72. /// <summary>
  73. /// 得到一个对象实体,从缓存中
  74. /// </summary>
  75. //public CallCenterApi.Model.T_Sys_Function GetModelByCache(int F_FunctionId)
  76. //{
  77. // string CacheKey = "T_Sys_FunctionModel-" + F_FunctionId;
  78. // object objModel = SZRX.Common.DataCache.GetCache(CacheKey);
  79. // if (objModel == null)
  80. // {
  81. // try
  82. // {
  83. // objModel = dal.GetModel(F_FunctionId);
  84. // if (objModel != null)
  85. // {
  86. // int ModelCache = SZRX.Common.ConfigHelper.GetConfigInt("ModelCache");
  87. // SZRX.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
  88. // }
  89. // }
  90. // catch{}
  91. // }
  92. // return (CallCenterApi.Model.T_Sys_Function)objModel;
  93. //}
  94. /// <summary>
  95. /// 获得数据列表
  96. /// </summary>
  97. public DataSet GetList(string strWhere)
  98. {
  99. return dal.GetList(strWhere);
  100. }
  101. /// <summary>
  102. /// 获得前几行数据
  103. /// </summary>
  104. public DataSet GetList(int Top,string strWhere,string filedOrder)
  105. {
  106. return dal.GetList(Top,strWhere,filedOrder);
  107. }
  108. /// <summary>
  109. /// 获得数据列表
  110. /// </summary>
  111. public List<CallCenterApi.Model.T_Sys_Function> GetModelList(string strWhere)
  112. {
  113. DataSet ds = dal.GetList(strWhere);
  114. return DataTableToList(ds.Tables[0]);
  115. }
  116. /// <summary>
  117. /// 获得数据列表
  118. /// </summary>
  119. public List<CallCenterApi.Model.T_Sys_Function> DataTableToList(DataTable dt)
  120. {
  121. List<CallCenterApi.Model.T_Sys_Function> modelList = new List<CallCenterApi.Model.T_Sys_Function>();
  122. int rowsCount = dt.Rows.Count;
  123. if (rowsCount > 0)
  124. {
  125. CallCenterApi.Model.T_Sys_Function model;
  126. for (int n = 0; n < rowsCount; n++)
  127. {
  128. model = new CallCenterApi.Model.T_Sys_Function();
  129. if(dt.Rows[n]["F_FunctionId"]!=null && dt.Rows[n]["F_FunctionId"].ToString()!="")
  130. {
  131. model.F_FunctionId=int.Parse(dt.Rows[n]["F_FunctionId"].ToString());
  132. }
  133. if(dt.Rows[n]["F_FunctionName"]!=null && dt.Rows[n]["F_FunctionName"].ToString()!="")
  134. {
  135. model.F_FunctionName=dt.Rows[n]["F_FunctionName"].ToString();
  136. }
  137. if(dt.Rows[n]["F_FunctionCode"]!=null && dt.Rows[n]["F_FunctionCode"].ToString()!="")
  138. {
  139. model.F_FunctionCode=dt.Rows[n]["F_FunctionCode"].ToString();
  140. }
  141. if(dt.Rows[n]["F_ParentId"]!=null && dt.Rows[n]["F_ParentId"].ToString()!="")
  142. {
  143. model.F_ParentId=int.Parse(dt.Rows[n]["F_ParentId"].ToString());
  144. }
  145. if(dt.Rows[n]["F_State"]!=null && dt.Rows[n]["F_State"].ToString()!="")
  146. {
  147. model.F_State=int.Parse(dt.Rows[n]["F_State"].ToString());
  148. }
  149. if(dt.Rows[n]["F_Layer"]!=null && dt.Rows[n]["F_Layer"].ToString()!="")
  150. {
  151. model.F_Layer=int.Parse(dt.Rows[n]["F_Layer"].ToString());
  152. }
  153. if(dt.Rows[n]["F_flag"]!=null && dt.Rows[n]["F_flag"].ToString()!="")
  154. {
  155. model.F_flag=int.Parse(dt.Rows[n]["F_flag"].ToString());
  156. }
  157. if(dt.Rows[n]["F_Sort"]!=null && dt.Rows[n]["F_Sort"].ToString()!="")
  158. {
  159. model.F_Sort=int.Parse(dt.Rows[n]["F_Sort"].ToString());
  160. }
  161. if(dt.Rows[n]["F_OptUrl"]!=null && dt.Rows[n]["F_OptUrl"].ToString()!="")
  162. {
  163. model.F_OptUrl=dt.Rows[n]["F_OptUrl"].ToString();
  164. }
  165. if(dt.Rows[n]["F_ImgUrl"]!=null && dt.Rows[n]["F_ImgUrl"].ToString()!="")
  166. {
  167. model.F_ImgUrl=dt.Rows[n]["F_ImgUrl"].ToString();
  168. }
  169. if(dt.Rows[n]["F_Remark"]!=null && dt.Rows[n]["F_Remark"].ToString()!="")
  170. {
  171. model.F_Remark=dt.Rows[n]["F_Remark"].ToString();
  172. }
  173. modelList.Add(model);
  174. }
  175. }
  176. return modelList;
  177. }
  178. /// <summary>
  179. /// 获得数据列表
  180. /// </summary>
  181. public DataSet GetAllList()
  182. {
  183. return GetList("");
  184. }
  185. /// <summary>
  186. /// 分页获取数据列表
  187. /// </summary>
  188. //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
  189. //{
  190. //return dal.GetList(PageSize,PageIndex,strWhere);
  191. //}
  192. #endregion Method
  193. }
  194. }