FlowRun.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:7k
- //------------------------------------------------------------------------------
- // 创建标识: Copyright (C) 2009 Socansoft.com 版权所有
- // 创建描述: SocanCode代码生成器 V4.3.2.3 自动创建于 2009-12-17 20:15:58
- //
- // 功能描述:
- //
- // 修改标识:
- // 修改描述:
- //------------------------------------------------------------------------------
- using System;
- using System.Data;
- using System.Data.Common;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- namespace SqlServerDAL
- {
- /// <summary>
- /// 数据访问类 FlowRun
- /// </summary>
- public class FlowRun : DALHelper
- {
- /// <summary>
- /// 增加一条数据
- /// </summary>
- public int Add(Model.FlowRun model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("INSERT INTO FlowRun(");
- strSql.Append("FQR,XBR,JSR,BZID,LCID,BDNR,FQSJ,ZHCZSJ,JSSJ,YXZT)");
- strSql.Append(" VALUES (");
- strSql.Append("@in_FQR,@in_XBR,@in_JSR,@in_BZID,@in_LCID,@in_BDNR,@in_FQSJ,@in_ZHCZSJ,@in_JSSJ,@in_YXZT)");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_FQR", DbType.AnsiString, model.FQR),
- DataBaseOAHelper.CreateInDbParameter("@in_XBR", DbType.AnsiString, model.XBR),
- DataBaseOAHelper.CreateInDbParameter("@in_JSR", DbType.AnsiString, model.JSR),
- DataBaseOAHelper.CreateInDbParameter("@in_BZID", DbType.Int32, model.BZID),
- DataBaseOAHelper.CreateInDbParameter("@in_LCID", DbType.Int32, model.LCID),
- DataBaseOAHelper.CreateInDbParameter("@in_BDNR", DbType.String, model.BDNR),
- DataBaseOAHelper.CreateInDbParameter("@in_FQSJ", DbType.String, model.FQSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_ZHCZSJ", DbType.String, model.ZHCZSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_JSSJ", DbType.String, model.JSSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_YXZT", DbType.String, model.YXZT)};
- return DataBaseOAHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms);
- }
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public int Update(Model.FlowRun model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("UPDATE FlowRun SET ");
- strSql.Append("FQR=@in_FQR,");
- strSql.Append("XBR=@in_XBR,");
- strSql.Append("JSR=@in_JSR,");
- strSql.Append("BZID=@in_BZID,");
- strSql.Append("LCID=@in_LCID,");
- strSql.Append("BDNR=@in_BDNR,");
- strSql.Append("FQSJ=@in_FQSJ,");
- strSql.Append("ZHCZSJ=@in_ZHCZSJ,");
- strSql.Append("JSSJ=@in_JSSJ,");
- strSql.Append("YXZT=@in_YXZT");
- strSql.Append(" WHERE ID=@in_ID");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_FQR", DbType.AnsiString, model.FQR),
- DataBaseOAHelper.CreateInDbParameter("@in_XBR", DbType.AnsiString, model.XBR),
- DataBaseOAHelper.CreateInDbParameter("@in_JSR", DbType.AnsiString, model.JSR),
- DataBaseOAHelper.CreateInDbParameter("@in_BZID", DbType.Int32, model.BZID),
- DataBaseOAHelper.CreateInDbParameter("@in_LCID", DbType.Int32, model.LCID),
- DataBaseOAHelper.CreateInDbParameter("@in_BDNR", DbType.String, model.BDNR),
- DataBaseOAHelper.CreateInDbParameter("@in_FQSJ", DbType.String, model.FQSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_ZHCZSJ", DbType.String, model.ZHCZSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_JSSJ", DbType.String, model.JSSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_YXZT", DbType.String, model.YXZT),
- 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 FlowRun ");
- 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 FlowRun", null);
- return DataBaseOAHelper.GetInt(obj);
- }
- /// <summary>
- /// 是否存在该记录
- /// </summary>
- public bool Exists(int ID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("SELECT COUNT(1) FROM FlowRun");
- 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.FlowRun GetModel(int ID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("SELECT * FROM FlowRun ");
- strSql.Append(" WHERE ID=@in_ID");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, ID)};
- Model.FlowRun 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.FlowRun> GetList()
- {
- StringBuilder strSql = new StringBuilder("SELECT * FROM FlowRun");
- using (DbDataReader dr = DataBaseOAHelper.ExecuteReader(CommandType.Text, strSql.ToString(), null))
- {
- List<Model.FlowRun> lst = GetList(dr);
- return lst;
- }
- }
- /// <summary>
- /// 得到数据条数
- /// </summary>
- public int GetCount(string condition)
- {
- return DataBaseOAHelper.GetCount("FlowRun", condition);
- }
- /// <summary>
- /// 分页获取泛型数据列表
- /// </summary>
- public List<Model.FlowRun> GetPageList(int pageSize, int pageIndex, string fldSort, bool fldDir, string condition)
- {
- using (DbDataReader dr = DataBaseOAHelper.GetPageList("FlowRun", pageSize, pageIndex, fldSort, fldDir, condition))
- {
- List<Model.FlowRun> lst = GetList(dr);
- return lst;
- }
- }
- #region -------- 私有方法,通常情况下无需修改 --------
- /// <summary>
- /// 由一行数据得到一个实体
- /// </summary>
- private Model.FlowRun GetModel(DbDataReader dr)
- {
- Model.FlowRun model = new Model.FlowRun();
- model.ID = DataBaseOAHelper.GetInt(dr["ID"]);
- model.FQR = DataBaseOAHelper.GetString(dr["FQR"]);
- model.XBR = DataBaseOAHelper.GetString(dr["XBR"]);
- model.JSR = DataBaseOAHelper.GetString(dr["JSR"]);
- model.BZID = DataBaseOAHelper.GetInt(dr["BZID"]);
- model.LCID = DataBaseOAHelper.GetInt(dr["LCID"]);
- model.BDNR = DataBaseOAHelper.GetString(dr["BDNR"]);
- model.FQSJ = DataBaseOAHelper.GetDateTime(dr["FQSJ"]);
- model.ZHCZSJ = DataBaseOAHelper.GetDateTime(dr["ZHCZSJ"]);
- model.JSSJ = DataBaseOAHelper.GetDateTime(dr["JSSJ"]);
- model.YXZT = DataBaseOAHelper.GetString(dr["YXZT"]);
- return model;
- }
- /// <summary>
- /// 由DbDataReader得到泛型数据列表
- /// </summary>
- private List<Model.FlowRun> GetList(DbDataReader dr)
- {
- List<Model.FlowRun> lst = new List<Model.FlowRun>();
- while (dr.Read())
- {
- lst.Add(GetModel(dr));
- }
- return lst;
- }
- #endregion
- }
- }