DAL_AMYields.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using MOKA_Factory_Tools.Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace MOKA_Factory_Tools.DAL
  9. {
  10. public class DAL_AMYields : BaseDAL
  11. {
  12. public DAL_AMYields()
  13. {
  14. this.TableFieldNameString = "";
  15. }
  16. #region 属性和字段
  17. string _tableName = "AMResult";
  18. /// <summary>
  19. /// 获取数据表名
  20. /// </summary>
  21. public override string TableName
  22. {
  23. get { return _tableName; }
  24. set { this._tableName = value; }
  25. }
  26. /// <summary>
  27. /// 获取当前新的数据表模型对象
  28. /// </summary>
  29. public override object ObjModel
  30. {
  31. get
  32. {
  33. return this.CurrentModel;
  34. }
  35. }
  36. /// <summary>
  37. /// 获取当前新的MOdel
  38. /// </summary>
  39. public AMYields CurrentModel
  40. {
  41. get { return new AMYields(); }
  42. }
  43. string _tableFieldNameString = "";
  44. /// <summary>
  45. /// 数据表字段名数组
  46. /// </summary>
  47. public override string TableFieldNameString
  48. {
  49. get { return this._tableFieldNameString; }
  50. set { this._tableFieldNameString = value; }
  51. }
  52. #endregion
  53. #region 检查记录
  54. //基类已经实现
  55. #endregion
  56. #region 增加数据
  57. /// <summary>
  58. /// 增加一条数据
  59. /// </summary>
  60. /// <param name="model">Model对象</param>
  61. /// <returns></returns>
  62. public bool Add(AMYields model)
  63. {
  64. return base.Add(model);
  65. }
  66. /// <summary>
  67. /// 增加一条数据
  68. /// </summary>
  69. /// <param name="model">Model对象</param>
  70. /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
  71. /// <returns></returns>
  72. public bool Add(AMYields model, string overlookFieldList = "ID")
  73. {
  74. return base.Add(model, overlookFieldList);
  75. }
  76. #endregion
  77. #region 删除数据
  78. /// <summary>
  79. /// 删除数据
  80. /// </summary>
  81. /// <param name="model"></param>
  82. /// <returns></returns>
  83. public bool Delete(AMYields model)
  84. {
  85. return base.Delete(model.ID);
  86. }
  87. #endregion
  88. #region 更新数据
  89. /// <summary>
  90. /// 更新一条数据
  91. /// </summary>
  92. public bool Update(AMYields model)
  93. {
  94. return base.Update(model);
  95. }
  96. /// <summary>
  97. /// 根据筛选字段和SQL筛选运算符号更新数据
  98. /// </summary>
  99. /// <param name="model">Model对象</param>
  100. /// <param name="filterFieldName">筛选字段名称</param>
  101. /// <param name="operators">SQL筛选运算符号</param>
  102. /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
  103. /// <returns></returns>
  104. public bool Update(AMYields model, string filterFieldName = "ID", string operators = "=", string overlookFieldList = "ID")
  105. {
  106. return base.Update(model, filterFieldName, operators, overlookFieldList);
  107. }
  108. #endregion
  109. #region 查询数据
  110. /// <summary>
  111. /// 得到一个对象实体
  112. /// </summary>
  113. public AMYields GetModel(int ID)
  114. {
  115. return DataRowToModel(GetDataRow(ID));
  116. }
  117. /// <summary>
  118. /// 得到一个对象实体
  119. /// </summary>
  120. /// <param name="row"></param>
  121. /// <returns></returns>
  122. public AMYields DataRowToModel(DataRow row)
  123. {
  124. return DataRowToModelObject(row) as AMYields;
  125. }
  126. /// <summary>
  127. /// 获得数据Model列表
  128. /// </summary>
  129. /// <param name="strWhere">条件 不包含 where 关键字</param>
  130. public List<AMYields> GetModelList(string strWhere)
  131. {
  132. DataSet ds = base.GetList(strWhere);
  133. return DataTableToList(ds.Tables[0]);
  134. }
  135. /// <summary>
  136. /// 获得数据列表
  137. /// </summary>
  138. /// <param name="dt">DataTable</param>
  139. public List<AMYields> DataTableToList(DataTable dt)
  140. {
  141. List<AMYields> modelList = new List<AMYields>();
  142. List<object> ObjList = base.GetDataTableToOblList(dt);
  143. foreach (object obj in ObjList)
  144. {
  145. modelList.Add((AMYields)obj);
  146. }
  147. return modelList;
  148. }
  149. #endregion
  150. }
  151. }