No Description

T_Que_Question_Answer.cs 4.8KB

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