Sin descripción

T_SMS_Template.cs 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. class T_SMS_Template
  10. {
  11. private readonly CallCenterApi.DAL.T_SMS_Template dal = new CallCenterApi.DAL.T_SMS_Template();
  12. public T_SMS_Template()
  13. { }
  14. #region Method
  15. /// <summary>
  16. /// 是否存在该记录
  17. /// </summary>
  18. public bool Exists(int ID)
  19. {
  20. return dal.Exists(ID);
  21. }
  22. /// <summary>
  23. /// 增加一条数据
  24. /// </summary>
  25. public int Add(CallCenterApi.Model.T_SMS_Template model)
  26. {
  27. return dal.Add(model);
  28. }
  29. /// <summary>
  30. /// 更新一条数据
  31. /// </summary>
  32. public bool Update(CallCenterApi.Model.T_SMS_Template model)
  33. {
  34. return dal.Update(model);
  35. }
  36. /// <summary>
  37. /// 删除一条数据
  38. /// </summary>
  39. public bool Delete(int ID)
  40. {
  41. return dal.Delete(ID);
  42. }
  43. /// <summary>
  44. /// 批量删除一批数据
  45. /// </summary>
  46. public bool DeleteList(string IDlist)
  47. {
  48. return dal.DeleteList(IDlist);
  49. }
  50. /// <summary>
  51. /// 得到一个对象实体
  52. /// </summary>
  53. public CallCenterApi.Model.T_SMS_Template GetModel(int ID)
  54. {
  55. return dal.GetModel(ID);
  56. }
  57. /// <summary>
  58. /// 获得数据列表
  59. /// </summary>
  60. public DataSet GetList(string strWhere)
  61. {
  62. return dal.GetList(strWhere);
  63. }
  64. /// <summary>
  65. /// 获得前几行数据
  66. /// </summary>
  67. public DataSet GetList(int Top, string strWhere, string filedOrder)
  68. {
  69. return dal.GetList(Top, strWhere, filedOrder);
  70. }
  71. /// <summary>
  72. /// 获得数据列表
  73. /// </summary>
  74. public List<CallCenterApi.Model.T_SMS_Template> GetModelList(string strWhere)
  75. {
  76. DataSet ds = dal.GetList(strWhere);
  77. return DataTableToList(ds.Tables[0]);
  78. }
  79. /// <summary>
  80. /// 获得数据列表
  81. /// </summary>
  82. public List<CallCenterApi.Model.T_SMS_Template> DataTableToList(DataTable dt)
  83. {
  84. List<CallCenterApi.Model.T_SMS_Template> modelList = new List<CallCenterApi.Model.T_SMS_Template>();
  85. int rowsCount = dt.Rows.Count;
  86. if (rowsCount > 0)
  87. {
  88. CallCenterApi.Model.T_SMS_Template model;
  89. for (int n = 0; n < rowsCount; n++)
  90. {
  91. model = new CallCenterApi.Model.T_SMS_Template();
  92. if (dt.Rows[n]["ID"].ToString() != "")
  93. {
  94. model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
  95. }
  96. model.Name = dt.Rows[n]["Name"].ToString();
  97. model.Detail = dt.Rows[n]["Detail"].ToString();
  98. if (dt.Rows[n]["IsEnable"].ToString() != "")
  99. {
  100. model.IsEnable = int.Parse(dt.Rows[n]["IsEnable"].ToString());
  101. }
  102. model.MID = dt.Rows[n]["MID"].ToString();
  103. model.MName = dt.Rows[n]["MName"].ToString();
  104. if (dt.Rows[n]["CreateDate"].ToString() != "")
  105. {
  106. model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString());
  107. }
  108. modelList.Add(model);
  109. }
  110. }
  111. return modelList;
  112. }
  113. /// <summary>
  114. /// 获得数据列表
  115. /// </summary>
  116. public DataSet GetAllList()
  117. {
  118. return GetList("");
  119. }
  120. /// <summary>
  121. /// 分页获取数据列表
  122. /// </summary>
  123. public int GetRecordCount(string strWhere)
  124. {
  125. return dal.GetRecordCount(strWhere);
  126. }
  127. /// <summary>
  128. /// 分页获取数据列表
  129. /// </summary>
  130. public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
  131. {
  132. return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
  133. }
  134. #endregion
  135. }
  136. }