FlowBaseFormContent.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:6k
源码类别:

OA系统

开发平台:

C#

  1. //------------------------------------------------------------------------------
  2. // 创建标识: Copyright (C) 2009 Socansoft.com 版权所有
  3. // 创建描述: SocanCode代码生成器 V4.3.2.3 自动创建于 2009-12-17 20:15:58
  4. //
  5. // 功能描述: 
  6. //
  7. // 修改标识: 
  8. // 修改描述: 
  9. //------------------------------------------------------------------------------
  10. using System;
  11. using System.Data;
  12. using System.Data.Common;
  13. using System.Text;
  14. using System.Collections;
  15. using System.Collections.Generic;
  16. namespace SqlServerDAL
  17. {
  18. /// <summary>
  19. /// 数据访问类 FlowBaseFormContent
  20. /// </summary>
  21. public class FlowBaseFormContent : DALHelper
  22. {
  23. /// <summary>
  24. /// 增加一条数据
  25. /// </summary>
  26. public int Add(Model.FlowBaseFormContent model)
  27. {
  28. StringBuilder strSql = new StringBuilder();
  29. strSql.Append("INSERT INTO FlowBaseFormContent(");
  30.             strSql.Append("BDNR,BDMC,LCLX)");
  31. strSql.Append(" VALUES (");
  32.             strSql.Append("@in_BDNR,@in_BDMC,@in_LCLX)");
  33. DbParameter[] cmdParms = {
  34. DataBaseOAHelper.CreateInDbParameter("@in_BDNR", DbType.String, model.BDNR),
  35. DataBaseOAHelper.CreateInDbParameter("@in_BDMC", DbType.AnsiString, model.BDMC),
  36. DataBaseOAHelper.CreateInDbParameter("@in_LCLX", DbType.Int32, model.LCLX)};
  37. return DataBaseOAHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms);
  38. }
  39. /// <summary>
  40. /// 更新一条数据
  41. /// </summary>
  42. public int Update(Model.FlowBaseFormContent model)
  43. {
  44. StringBuilder strSql = new StringBuilder();
  45. strSql.Append("UPDATE FlowBaseFormContent SET ");
  46. strSql.Append("BDNR=@in_BDNR,");
  47. strSql.Append("BDMC=@in_BDMC,");
  48. strSql.Append("LCLX=@in_LCLX");
  49. strSql.Append(" WHERE ID=@in_ID");
  50. DbParameter[] cmdParms = {
  51. DataBaseOAHelper.CreateInDbParameter("@in_BDNR", DbType.String, model.BDNR),
  52. DataBaseOAHelper.CreateInDbParameter("@in_BDMC", DbType.AnsiString, model.BDMC),
  53. DataBaseOAHelper.CreateInDbParameter("@in_LCLX", DbType.Int32, model.LCLX),
  54. DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, model.ID)};
  55. return DataBaseOAHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms);
  56. }
  57. /// <summary>
  58. /// 删除一条数据
  59. /// </summary>
  60. public int Delete(int ID)
  61. {
  62. StringBuilder strSql = new StringBuilder();
  63. strSql.Append("DELETE FROM FlowBaseFormContent ");
  64. strSql.Append(" WHERE ID=@in_ID");
  65. DbParameter[] cmdParms = {
  66. DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, ID)};
  67. return DataBaseOAHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms);
  68. }
  69. /// <summary>
  70. /// 得到最大ID
  71. /// </summary>
  72. public int GetMaxId()
  73. {
  74. object obj = DataBaseOAHelper.ExecuteScalar(CommandType.Text, "SELECT MAX(ID) FROM FlowBaseFormContent", null);
  75. return DataBaseOAHelper.GetInt(obj);
  76. }
  77. /// <summary>
  78. /// 是否存在该记录
  79. /// </summary>
  80. public bool Exists(int ID)
  81. {
  82. StringBuilder strSql = new StringBuilder();
  83. strSql.Append("SELECT COUNT(1) FROM FlowBaseFormContent");
  84. strSql.Append(" WHERE ID=@in_ID");
  85. DbParameter[] cmdParms = {
  86. DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, ID)};
  87. object obj = DataBaseOAHelper.ExecuteScalar(CommandType.Text, strSql.ToString(), cmdParms);
  88. return DataBaseOAHelper.GetInt(obj) > 0;
  89. }
  90. /// <summary>
  91. /// 得到一个对象实体
  92. /// </summary>
  93. public Model.FlowBaseFormContent GetModel(int ID)
  94. {
  95. StringBuilder strSql = new StringBuilder();
  96. strSql.Append("SELECT * FROM FlowBaseFormContent ");
  97. strSql.Append(" WHERE ID=@in_ID");
  98. DbParameter[] cmdParms = {
  99. DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, ID)};
  100. Model.FlowBaseFormContent model = null;
  101. using (DbDataReader dr = DataBaseOAHelper.ExecuteReader(CommandType.Text, strSql.ToString(), cmdParms))
  102. {
  103. while (dr.Read())
  104. {
  105. model = GetModel(dr);
  106. }
  107. return model;
  108. }
  109. }
  110. /// <summary>
  111. /// 获取泛型数据列表
  112. /// </summary>
  113. public List<Model.FlowBaseFormContent> GetList()
  114. {
  115. StringBuilder strSql = new StringBuilder("SELECT * FROM FlowBaseFormContent");
  116. using (DbDataReader dr = DataBaseOAHelper.ExecuteReader(CommandType.Text, strSql.ToString(), null))
  117. {
  118. List<Model.FlowBaseFormContent> lst = GetList(dr);
  119. return lst;
  120. }
  121. }
  122. /// <summary>
  123. /// 得到数据条数
  124. /// </summary>
  125. public int GetCount(string condition)
  126. {
  127. return DataBaseOAHelper.GetCount("FlowBaseFormContent", condition);
  128. }
  129. /// <summary>
  130. /// 分页获取泛型数据列表
  131. /// </summary>
  132. public List<Model.FlowBaseFormContent> GetPageList(int pageSize, int pageIndex, string fldSort, bool fldDir, string condition)
  133. {
  134. using (DbDataReader dr = DataBaseOAHelper.GetPageList("FlowBaseFormContent", pageSize, pageIndex, fldSort, fldDir, condition))
  135. {
  136. List<Model.FlowBaseFormContent> lst = GetList(dr);
  137. return lst;
  138. }
  139. }
  140. #region -------- 私有方法,通常情况下无需修改 --------
  141. /// <summary>
  142. /// 由一行数据得到一个实体
  143. /// </summary>
  144. private Model.FlowBaseFormContent GetModel(DbDataReader dr)
  145. {
  146. Model.FlowBaseFormContent model = new Model.FlowBaseFormContent();
  147. model.ID = DataBaseOAHelper.GetInt(dr["ID"]);
  148. model.BDNR = DataBaseOAHelper.GetString(dr["BDNR"]);
  149. model.BDMC = DataBaseOAHelper.GetString(dr["BDMC"]);
  150. model.LCLX = DataBaseOAHelper.GetInt(dr["LCLX"]);
  151. return model;
  152. }
  153. /// <summary>
  154. /// 由DbDataReader得到泛型数据列表
  155. /// </summary>
  156. private List<Model.FlowBaseFormContent> GetList(DbDataReader dr)
  157. {
  158. List<Model.FlowBaseFormContent> lst = new List<Model.FlowBaseFormContent>();
  159. while (dr.Read())
  160. {
  161. lst.Add(GetModel(dr));
  162. }
  163. return lst;
  164. }
  165. #endregion
  166. }
  167. }