FlowBaseStep.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:7k
- //------------------------------------------------------------------------------
- // 创建标识: Copyright (C) 2009 Socansoft.com 版权所有
- // 创建描述: SocanCode代码生成器 V4.3.2.3 自动创建于 2009-12-20 10:43:43
- //
- // 功能描述:
- //
- // 修改标识:
- // 修改描述:
- //------------------------------------------------------------------------------
- using System;
- using System.Data;
- using System.Data.Common;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- namespace SqlServerDAL
- {
- /// <summary>
- /// 数据访问类 FlowBaseStep
- /// </summary>
- public class FlowBaseStep : DALHelper
- {
- /// <summary>
- /// 增加一条数据
- /// </summary>
- public int Add(Model.FlowBaseStep model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("INSERT INTO FlowBaseStep(");
- strSql.Append("LCID,KYZD,BDID,YQLSCCBZRY,BZSXH,XYBXH,BZMC)");
- strSql.Append(" VALUES (");
- strSql.Append("@in_LCID,@in_KYZD,@in_BDID,@in_YQLSCCBZRY,@in_BZSXH,@in_XYBXH,@in_BZMC)");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_LCID", DbType.Int32, model.LCID),
- DataBaseOAHelper.CreateInDbParameter("@in_KYZD", DbType.String, model.KYZD),
- DataBaseOAHelper.CreateInDbParameter("@in_BDID", DbType.Int32, model.BDID),
- DataBaseOAHelper.CreateInDbParameter("@in_YQLSCCBZRY", DbType.String, model.YQLSCCBZRY),
- DataBaseOAHelper.CreateInDbParameter("@in_BZSXH", DbType.Int32, model.BZSXH),
- DataBaseOAHelper.CreateInDbParameter("@in_XYBXH", DbType.AnsiString, model.XYBXH),
- DataBaseOAHelper.CreateInDbParameter("@in_BZMC", DbType.AnsiString, model.BZMC)};
- return DataBaseOAHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms);
- }
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public int Update(Model.FlowBaseStep model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("UPDATE FlowBaseStep SET ");
- strSql.Append("LCID=@in_LCID,");
- strSql.Append("KYZD=@in_KYZD,");
- strSql.Append("BDID=@in_BDID,");
- strSql.Append("YQLSCCBZRY=@in_YQLSCCBZRY,");
- strSql.Append("BZSXH=@in_BZSXH,");
- strSql.Append("XYBXH=@in_XYBXH,");
- strSql.Append("BZMC=@in_BZMC");
- strSql.Append(" WHERE ID=@in_ID");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_LCID", DbType.Int32, model.LCID),
- DataBaseOAHelper.CreateInDbParameter("@in_KYZD", DbType.String, model.KYZD),
- DataBaseOAHelper.CreateInDbParameter("@in_BDID", DbType.Int32, model.BDID),
- DataBaseOAHelper.CreateInDbParameter("@in_YQLSCCBZRY", DbType.String, model.YQLSCCBZRY),
- DataBaseOAHelper.CreateInDbParameter("@in_BZSXH", DbType.Int32, model.BZSXH),
- DataBaseOAHelper.CreateInDbParameter("@in_XYBXH", DbType.AnsiString, model.XYBXH),
- DataBaseOAHelper.CreateInDbParameter("@in_BZMC", DbType.AnsiString, model.BZMC),
- DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, model.ID)};
- return DataBaseOAHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms);
- }
- /// <summary>
- /// 删除一条数据
- /// </summary>
- public int Delete(int ID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("DELETE FROM FlowBaseStep ");
- strSql.Append(" WHERE ID=@in_ID");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, ID)};
- return DataBaseOAHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms);
- }
- /// <summary>
- /// 得到最大ID
- /// </summary>
- public int GetMaxId()
- {
- object obj = DataBaseOAHelper.ExecuteScalar(CommandType.Text, "SELECT MAX(ID) FROM FlowBaseStep", null);
- return DataBaseOAHelper.GetInt(obj);
- }
- /// <summary>
- /// 是否存在该记录
- /// </summary>
- public bool Exists(int ID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("SELECT COUNT(1) FROM FlowBaseStep");
- strSql.Append(" WHERE ID=@in_ID");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, ID)};
- object obj = DataBaseOAHelper.ExecuteScalar(CommandType.Text, strSql.ToString(), cmdParms);
- return DataBaseOAHelper.GetInt(obj) > 0;
- }
- /// <summary>
- /// 得到一个对象实体
- /// </summary>
- public Model.FlowBaseStep GetModel(int ID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("SELECT * FROM FlowBaseStep ");
- strSql.Append(" WHERE ID=@in_ID");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, ID)};
- Model.FlowBaseStep model = null;
- using (DbDataReader dr = DataBaseOAHelper.ExecuteReader(CommandType.Text, strSql.ToString(), cmdParms))
- {
- while (dr.Read())
- {
- model = GetModel(dr);
- }
- return model;
- }
- }
- /// <summary>
- /// 获取泛型数据列表
- /// </summary>
- public List<Model.FlowBaseStep> GetList()
- {
- StringBuilder strSql = new StringBuilder("SELECT * FROM FlowBaseStep");
- using (DbDataReader dr = DataBaseOAHelper.ExecuteReader(CommandType.Text, strSql.ToString(), null))
- {
- List<Model.FlowBaseStep> lst = GetList(dr);
- return lst;
- }
- }
- /// <summary>
- /// 得到数据条数
- /// </summary>
- public int GetCount(string condition)
- {
- return DataBaseOAHelper.GetCount("FlowBaseStep", condition);
- }
- /// <summary>
- /// 分页获取泛型数据列表
- /// </summary>
- public List<Model.FlowBaseStep> GetPageList(int pageSize, int pageIndex, string fldSort, bool fldDir, string condition)
- {
- using (DbDataReader dr = DataBaseOAHelper.GetPageList("FlowBaseStep", pageSize, pageIndex, fldSort, fldDir, condition))
- {
- List<Model.FlowBaseStep> lst = GetList(dr);
- return lst;
- }
- }
- #region -------- 私有方法,通常情况下无需修改 --------
- /// <summary>
- /// 由一行数据得到一个实体
- /// </summary>
- private Model.FlowBaseStep GetModel(DbDataReader dr)
- {
- Model.FlowBaseStep model = new Model.FlowBaseStep();
- model.ID = DataBaseOAHelper.GetInt(dr["ID"]);
- model.LCID = DataBaseOAHelper.GetInt(dr["LCID"]);
- model.KYZD = DataBaseOAHelper.GetString(dr["KYZD"]);
- model.BDID = DataBaseOAHelper.GetInt(dr["BDID"]);
- model.YQLSCCBZRY = DataBaseOAHelper.GetString(dr["YQLSCCBZRY"]);
- model.BZSXH = DataBaseOAHelper.GetInt(dr["BZSXH"]);
- model.XYBXH = DataBaseOAHelper.GetString(dr["XYBXH"]);
- model.BZMC = DataBaseOAHelper.GetString(dr["BZMC"]);
- return model;
- }
- /// <summary>
- /// 由DbDataReader得到泛型数据列表
- /// </summary>
- private List<Model.FlowBaseStep> GetList(DbDataReader dr)
- {
- List<Model.FlowBaseStep> lst = new List<Model.FlowBaseStep>();
- while (dr.Read())
- {
- lst.Add(GetModel(dr));
- }
- return lst;
- }
- #endregion
- }
- }