新野县12345_后端

T_Sys_Address.cs 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace CallCenterApi.BLL
  8. {
  9. public partial class T_Sys_Address
  10. {
  11. private readonly DAL.T_Sys_Address dal = new DAL.T_Sys_Address();
  12. public T_Sys_Address()
  13. { }
  14. #region BasicMethod
  15. /// <summary>
  16. /// 得到最大ID
  17. /// </summary>
  18. public int GetMaxId()
  19. {
  20. return dal.GetMaxId();
  21. }
  22. /// <summary>
  23. /// 是否存在该记录
  24. /// </summary>
  25. public bool Exists(int ID, string Code)
  26. {
  27. return dal.Exists(ID, Code);
  28. }
  29. /// <summary>
  30. /// 增加一条数据
  31. /// </summary>
  32. public bool Add(Model.T_Sys_Address model)
  33. {
  34. return dal.Add(model);
  35. }
  36. /// <summary>
  37. /// 更新一条数据
  38. /// </summary>
  39. public bool Update(Model.T_Sys_Address model)
  40. {
  41. return dal.Update(model);
  42. }
  43. /// <summary>
  44. /// 删除一条数据
  45. /// </summary>
  46. public bool Delete(int ID, string Code)
  47. {
  48. return dal.Delete(ID, Code);
  49. }
  50. /// <summary>
  51. /// 得到一个对象实体
  52. /// </summary>
  53. public Model.T_Sys_Address GetModel(int ID, string Code)
  54. {
  55. return dal.GetModel(ID, Code);
  56. }
  57. ///// <summary>
  58. ///// 得到一个对象实体,从缓存中
  59. ///// </summary>
  60. //public Model.T_Sys_Address GetModelByCache(int ID, string Code)
  61. //{
  62. // string CacheKey = "T_Sys_AddressModel-" + ID + Code;
  63. // object objModel = System.Data.Common.DataCache.GetCache(CacheKey);
  64. // if (objModel == null)
  65. // {
  66. // try
  67. // {
  68. // objModel = dal.GetModel(ID, Code);
  69. // if (objModel != null)
  70. // {
  71. // int ModelCache = Common.ConfigHelper.GetConfigInt("ModelCache");
  72. // Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
  73. // }
  74. // }
  75. // catch { }
  76. // }
  77. // return (Model.T_Sys_Address)objModel;
  78. //}
  79. /// <summary>
  80. /// 获得数据列表
  81. /// </summary>
  82. public DataSet GetList(string strWhere)
  83. {
  84. return dal.GetList(strWhere);
  85. }
  86. /// <summary>
  87. /// 获得前几行数据
  88. /// </summary>
  89. public DataSet GetList(int Top, string strWhere, string filedOrder)
  90. {
  91. return dal.GetList(Top, strWhere, filedOrder);
  92. }
  93. /// <summary>
  94. /// 获得数据列表
  95. /// </summary>
  96. public List<Model.T_Sys_Address> GetModelList(string strWhere)
  97. {
  98. DataSet ds = dal.GetList(strWhere);
  99. return DataTableToList(ds.Tables[0]);
  100. }
  101. /// <summary>
  102. /// 获得数据列表
  103. /// </summary>
  104. public List<Model.T_Sys_Address> DataTableToList(DataTable dt)
  105. {
  106. List<Model.T_Sys_Address> modelList = new List<Model.T_Sys_Address>();
  107. int rowsCount = dt.Rows.Count;
  108. if (rowsCount > 0)
  109. {
  110. Model.T_Sys_Address model;
  111. for (int n = 0; n < rowsCount; n++)
  112. {
  113. model = dal.DataRowToModel(dt.Rows[n]);
  114. if (model != null)
  115. {
  116. modelList.Add(model);
  117. }
  118. }
  119. }
  120. return modelList;
  121. }
  122. /// <summary>
  123. /// 获得数据列表
  124. /// </summary>
  125. public DataSet GetAllList()
  126. {
  127. return GetList("");
  128. }
  129. /// <summary>
  130. /// 分页获取数据列表
  131. /// </summary>
  132. public int GetRecordCount(string strWhere)
  133. {
  134. return dal.GetRecordCount(strWhere);
  135. }
  136. /// <summary>
  137. /// 分页获取数据列表
  138. /// </summary>
  139. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  140. {
  141. return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
  142. }
  143. /// <summary>
  144. /// 分页获取数据列表
  145. /// </summary>
  146. //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
  147. //{
  148. //return dal.GetList(PageSize,PageIndex,strWhere);
  149. //}
  150. #endregion BasicMethod
  151. #region ExtensionMethod
  152. #endregion ExtensionMethod
  153. }
  154. }