Rolls.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:10k
- //------------------------------------------------------------------------------
- // 创建标识: Copyright (C) 2009 Socansoft.com 版权所有
- // 创建描述: SocanCode代码生成器 V4.3.2.3 自动创建于 2009-12-7 19:55:37
- //
- // 功能描述:
- //
- // 修改标识:
- // 修改描述:
- //------------------------------------------------------------------------------
- using System;
- using System.Data;
- using System.Data.Common;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- namespace SqlServerDAL
- {
- /// <summary>
- /// 数据访问类 Rolls
- /// </summary>
- public class Rolls : DALHelper
- {
- /// <summary>
- /// 增加一条数据
- /// </summary>
- public int Add(Model.Rolls model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("INSERT INTO Rolls(");
- strSql.Append("JAH,SSJK,QSRQ,SSBM,BGQX,QZH,DAGH,SWH,PZBH1,YS,ANMC,JZND,ZZRQ,BZJG,JAMJ,MLH,BXXH,PZLB,PZBH2,BZ)");
- strSql.Append(" VALUES (");
- strSql.Append("@in_JAH,@in_SSJK,@in_QSRQ,@in_SSBM,@in_BGQX,@in_QZH,@in_DAGH,@in_SWH,@in_PZBH1,@in_YS,@in_ANMC,@in_JZND,@in_ZZRQ,@in_BZJG,@in_JAMJ,@in_MLH,@in_BXXH,@in_PZLB,@in_PZBH2,@in_BZ)");
DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_JAH", DbType.AnsiString, model.JAH),
- DataBaseOAHelper.CreateInDbParameter("@in_SSJK", DbType.AnsiString, model.SSJK),
- DataBaseOAHelper.CreateInDbParameter("@in_QSRQ", DbType.String, model.QSRQ),
- DataBaseOAHelper.CreateInDbParameter("@in_SSBM", DbType.AnsiString, model.SSBM),
- DataBaseOAHelper.CreateInDbParameter("@in_BGQX", DbType.AnsiString, model.BGQX),
- DataBaseOAHelper.CreateInDbParameter("@in_QZH", DbType.AnsiString, model.QZH),
- DataBaseOAHelper.CreateInDbParameter("@in_DAGH", DbType.AnsiString, model.DAGH),
- DataBaseOAHelper.CreateInDbParameter("@in_SWH", DbType.AnsiString, model.SWH),
- DataBaseOAHelper.CreateInDbParameter("@in_PZBH1", DbType.AnsiString, model.PZBH1),
- DataBaseOAHelper.CreateInDbParameter("@in_YS", DbType.Int32, model.YS),
- DataBaseOAHelper.CreateInDbParameter("@in_ANMC", DbType.AnsiString, model.ANMC),
- DataBaseOAHelper.CreateInDbParameter("@in_JZND", DbType.AnsiString, model.JZND),
- DataBaseOAHelper.CreateInDbParameter("@in_ZZRQ", DbType.String, model.ZZRQ),
- DataBaseOAHelper.CreateInDbParameter("@in_BZJG", DbType.AnsiString, model.BZJG),
- DataBaseOAHelper.CreateInDbParameter("@in_JAMJ", DbType.AnsiString, model.JAMJ),
- DataBaseOAHelper.CreateInDbParameter("@in_MLH", DbType.AnsiString, model.MLH),
- DataBaseOAHelper.CreateInDbParameter("@in_BXXH", DbType.AnsiString, model.BXXH),
- DataBaseOAHelper.CreateInDbParameter("@in_PZLB", DbType.AnsiString, model.PZLB),
- DataBaseOAHelper.CreateInDbParameter("@in_PZBH2", DbType.AnsiString, model.PZBH2),
- DataBaseOAHelper.CreateInDbParameter("@in_BZ", DbType.String, model.BZ)};
- return DataBaseOAHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms);
- }
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public int Update(Model.Rolls model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("UPDATE Rolls SET ");
- strSql.Append("JAH=@in_JAH,");
- strSql.Append("SSJK=@in_SSJK,");
- strSql.Append("QSRQ=@in_QSRQ,");
- strSql.Append("SSBM=@in_SSBM,");
- strSql.Append("BGQX=@in_BGQX,");
- strSql.Append("QZH=@in_QZH,");
- strSql.Append("DAGH=@in_DAGH,");
- strSql.Append("SWH=@in_SWH,");
- strSql.Append("PZBH1=@in_PZBH1,");
- strSql.Append("YS=@in_YS,");
- strSql.Append("ANMC=@in_ANMC,");
- strSql.Append("JZND=@in_JZND,");
- strSql.Append("ZZRQ=@in_ZZRQ,");
- strSql.Append("BZJG=@in_BZJG,");
- strSql.Append("JAMJ=@in_JAMJ,");
- strSql.Append("MLH=@in_MLH,");
- strSql.Append("BXXH=@in_BXXH,");
- strSql.Append("PZLB=@in_PZLB,");
- strSql.Append("PZBH2=@in_PZBH2,");
- strSql.Append("BZ=@in_BZ");
- strSql.Append(" WHERE ID=@in_ID");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_JAH", DbType.AnsiString, model.JAH),
- DataBaseOAHelper.CreateInDbParameter("@in_SSJK", DbType.AnsiString, model.SSJK),
- DataBaseOAHelper.CreateInDbParameter("@in_QSRQ", DbType.String, model.QSRQ),
- DataBaseOAHelper.CreateInDbParameter("@in_SSBM", DbType.AnsiString, model.SSBM),
- DataBaseOAHelper.CreateInDbParameter("@in_BGQX", DbType.AnsiString, model.BGQX),
- DataBaseOAHelper.CreateInDbParameter("@in_QZH", DbType.AnsiString, model.QZH),
- DataBaseOAHelper.CreateInDbParameter("@in_DAGH", DbType.AnsiString, model.DAGH),
- DataBaseOAHelper.CreateInDbParameter("@in_SWH", DbType.AnsiString, model.SWH),
- DataBaseOAHelper.CreateInDbParameter("@in_PZBH1", DbType.AnsiString, model.PZBH1),
- DataBaseOAHelper.CreateInDbParameter("@in_YS", DbType.Int32, model.YS),
- DataBaseOAHelper.CreateInDbParameter("@in_ANMC", DbType.AnsiString, model.ANMC),
- DataBaseOAHelper.CreateInDbParameter("@in_JZND", DbType.AnsiString, model.JZND),
- DataBaseOAHelper.CreateInDbParameter("@in_ZZRQ", DbType.String, model.ZZRQ),
- DataBaseOAHelper.CreateInDbParameter("@in_BZJG", DbType.AnsiString, model.BZJG),
- DataBaseOAHelper.CreateInDbParameter("@in_JAMJ", DbType.AnsiString, model.JAMJ),
- DataBaseOAHelper.CreateInDbParameter("@in_MLH", DbType.AnsiString, model.MLH),
- DataBaseOAHelper.CreateInDbParameter("@in_BXXH", DbType.AnsiString, model.BXXH),
- DataBaseOAHelper.CreateInDbParameter("@in_PZLB", DbType.AnsiString, model.PZLB),
- DataBaseOAHelper.CreateInDbParameter("@in_PZBH2", DbType.AnsiString, model.PZBH2),
- DataBaseOAHelper.CreateInDbParameter("@in_BZ", DbType.String, model.BZ),
- 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 Rolls ");
- 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 Rolls", null);
- return DataBaseOAHelper.GetInt(obj);
- }
- /// <summary>
- /// 是否存在该记录
- /// </summary>
- public bool Exists(int ID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("SELECT COUNT(1) FROM Rolls");
- 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.Rolls GetModel(int ID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("SELECT * FROM Rolls ");
- strSql.Append(" WHERE ID=@in_ID");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, ID)};
- Model.Rolls 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.Rolls> GetList()
- {
- StringBuilder strSql = new StringBuilder("SELECT * FROM Rolls");
- using (DbDataReader dr = DataBaseOAHelper.ExecuteReader(CommandType.Text, strSql.ToString(), null))
- {
- List<Model.Rolls> lst = GetList(dr);
- return lst;
- }
- }
- /// <summary>
- /// 得到数据条数
- /// </summary>
- public int GetCount(string condition)
- {
- return DataBaseOAHelper.GetCount("Rolls", condition);
- }
- /// <summary>
- /// 分页获取泛型数据列表
- /// </summary>
- public List<Model.Rolls> GetPageList(int pageSize, int pageIndex, string fldSort, bool fldDir, string condition)
- {
- using (DbDataReader dr = DataBaseOAHelper.GetPageList("Rolls", pageSize, pageIndex, fldSort, fldDir, condition))
- {
- List<Model.Rolls> lst = GetList(dr);
- return lst;
- }
- }
- #region -------- 私有方法,通常情况下无需修改 --------
- /// <summary>
- /// 由一行数据得到一个实体
- /// </summary>
- private Model.Rolls GetModel(DbDataReader dr)
- {
- Model.Rolls model = new Model.Rolls();
- model.ID = DataBaseOAHelper.GetInt(dr["ID"]);
- model.JAH = DataBaseOAHelper.GetString(dr["JAH"]);
- model.SSJK = DataBaseOAHelper.GetString(dr["SSJK"]);
- model.QSRQ = DataBaseOAHelper.GetDateTime(dr["QSRQ"]);
- model.SSBM = DataBaseOAHelper.GetString(dr["SSBM"]);
- model.BGQX = DataBaseOAHelper.GetString(dr["BGQX"]);
- model.QZH = DataBaseOAHelper.GetString(dr["QZH"]);
- model.DAGH = DataBaseOAHelper.GetString(dr["DAGH"]);
- model.SWH = DataBaseOAHelper.GetString(dr["SWH"]);
- model.PZBH1 = DataBaseOAHelper.GetString(dr["PZBH1"]);
- model.YS = DataBaseOAHelper.GetInt(dr["YS"]);
- model.ANMC = DataBaseOAHelper.GetString(dr["ANMC"]);
- model.JZND = DataBaseOAHelper.GetString(dr["JZND"]);
- model.ZZRQ = DataBaseOAHelper.GetDateTime(dr["ZZRQ"]);
- model.BZJG = DataBaseOAHelper.GetString(dr["BZJG"]);
- model.JAMJ = DataBaseOAHelper.GetString(dr["JAMJ"]);
- model.MLH = DataBaseOAHelper.GetString(dr["MLH"]);
- model.BXXH = DataBaseOAHelper.GetString(dr["BXXH"]);
- model.PZLB = DataBaseOAHelper.GetString(dr["PZLB"]);
- model.PZBH2 = DataBaseOAHelper.GetString(dr["PZBH2"]);
- model.BZ = DataBaseOAHelper.GetString(dr["BZ"]);
- return model;
- }
- /// <summary>
- /// 由DbDataReader得到泛型数据列表
- /// </summary>
- private List<Model.Rolls> GetList(DbDataReader dr)
- {
- List<Model.Rolls> lst = new List<Model.Rolls>();
- while (dr.Read())
- {
- lst.Add(GetModel(dr));
- }
- return lst;
- }
- #endregion
- }
- }