MeetingRun.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:8k
- //------------------------------------------------------------------------------
- // 创建标识: Copyright (C) 2009 Socansoft.com 版权所有
- // 创建描述: SocanCode代码生成器 V4.3.2.3 自动创建于 2009-12-23 10:03:32
- //
- // 功能描述:
- //
- // 修改标识:
- // 修改描述:
- //------------------------------------------------------------------------------
- using System;
- using System.Data;
- using System.Data.Common;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- namespace SqlServerDAL
- {
- /// <summary>
- /// 数据访问类 MeetingRun
- /// </summary>
- public class MeetingRun : DALHelper
- {
- /// <summary>
- /// 增加一条数据
- /// </summary>
- public int Add(Model.MeetingRun model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("INSERT INTO MeetingRun(");
- strSql.Append("MC,ZT,MS,SQR,SQSJ,CXRYNB,CXRYWB,KSSJ,JSSJ,HYS,HYGLY,PZZT)");
- strSql.Append(" VALUES (");
- strSql.Append("@in_MC,@in_ZT,@in_MS,@in_SQR,@in_SQSJ,@in_CXRYNB,@in_CXRYWB,@in_KSSJ,@in_JSSJ,@in_HYS,@in_HYGLY,@in_PZZT)");
DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_MC", DbType.AnsiString, model.MC),
- DataBaseOAHelper.CreateInDbParameter("@in_ZT", DbType.AnsiString, model.ZT),
- DataBaseOAHelper.CreateInDbParameter("@in_MS", DbType.AnsiString, model.MS),
- DataBaseOAHelper.CreateInDbParameter("@in_SQR", DbType.AnsiString, model.SQR),
- DataBaseOAHelper.CreateInDbParameter("@in_SQSJ", DbType.String, model.SQSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_CXRYNB", DbType.String, model.CXRYNB),
- DataBaseOAHelper.CreateInDbParameter("@in_CXRYWB", DbType.String, model.CXRYWB),
- DataBaseOAHelper.CreateInDbParameter("@in_KSSJ", DbType.String, model.KSSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_JSSJ", DbType.String, model.JSSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_HYS", DbType.Int32, model.HYS),
- DataBaseOAHelper.CreateInDbParameter("@in_HYGLY", DbType.AnsiString, model.HYGLY),
- DataBaseOAHelper.CreateInDbParameter("@in_PZZT", DbType.AnsiString, model.PZZT)};
- return DataBaseOAHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms);
- }
- /// <summary>
- /// 更新一条数据
- /// </summary>
- public int Update(Model.MeetingRun model)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("UPDATE MeetingRun SET ");
- strSql.Append("MC=@in_MC,");
- strSql.Append("ZT=@in_ZT,");
- strSql.Append("MS=@in_MS,");
- strSql.Append("SQR=@in_SQR,");
- strSql.Append("SQSJ=@in_SQSJ,");
- strSql.Append("CXRYNB=@in_CXRYNB,");
- strSql.Append("CXRYWB=@in_CXRYWB,");
- strSql.Append("KSSJ=@in_KSSJ,");
- strSql.Append("JSSJ=@in_JSSJ,");
- strSql.Append("HYS=@in_HYS,");
- strSql.Append("HYGLY=@in_HYGLY,");
- strSql.Append("PZZT=@in_PZZT");
- strSql.Append(" WHERE ID=@in_ID");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_MC", DbType.AnsiString, model.MC),
- DataBaseOAHelper.CreateInDbParameter("@in_ZT", DbType.AnsiString, model.ZT),
- DataBaseOAHelper.CreateInDbParameter("@in_MS", DbType.AnsiString, model.MS),
- DataBaseOAHelper.CreateInDbParameter("@in_SQR", DbType.AnsiString, model.SQR),
- DataBaseOAHelper.CreateInDbParameter("@in_SQSJ", DbType.String, model.SQSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_CXRYNB", DbType.String, model.CXRYNB),
- DataBaseOAHelper.CreateInDbParameter("@in_CXRYWB", DbType.String, model.CXRYWB),
- DataBaseOAHelper.CreateInDbParameter("@in_KSSJ", DbType.String, model.KSSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_JSSJ", DbType.String, model.JSSJ),
- DataBaseOAHelper.CreateInDbParameter("@in_HYS", DbType.Int32, model.HYS),
- DataBaseOAHelper.CreateInDbParameter("@in_HYGLY", DbType.AnsiString, model.HYGLY),
- DataBaseOAHelper.CreateInDbParameter("@in_PZZT", DbType.AnsiString, model.PZZT),
- 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 MeetingRun ");
- 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 MeetingRun", null);
- return DataBaseOAHelper.GetInt(obj);
- }
- /// <summary>
- /// 是否存在该记录
- /// </summary>
- public bool Exists(int ID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("SELECT COUNT(1) FROM MeetingRun");
- 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.MeetingRun GetModel(int ID)
- {
- StringBuilder strSql = new StringBuilder();
- strSql.Append("SELECT * FROM MeetingRun ");
- strSql.Append(" WHERE ID=@in_ID");
- DbParameter[] cmdParms = {
- DataBaseOAHelper.CreateInDbParameter("@in_ID", DbType.Int32, ID)};
- Model.MeetingRun 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.MeetingRun> GetList()
- {
- StringBuilder strSql = new StringBuilder("SELECT * FROM MeetingRun");
- using (DbDataReader dr = DataBaseOAHelper.ExecuteReader(CommandType.Text, strSql.ToString(), null))
- {
- List<Model.MeetingRun> lst = GetList(dr);
- return lst;
- }
- }
- /// <summary>
- /// 得到数据条数
- /// </summary>
- public int GetCount(string condition)
- {
- return DataBaseOAHelper.GetCount("MeetingRun", condition);
- }
- /// <summary>
- /// 分页获取泛型数据列表
- /// </summary>
- public List<Model.MeetingRun> GetPageList(int pageSize, int pageIndex, string fldSort, bool fldDir, string condition)
- {
- using (DbDataReader dr = DataBaseOAHelper.GetPageList("MeetingRun", pageSize, pageIndex, fldSort, fldDir, condition))
- {
- List<Model.MeetingRun> lst = GetList(dr);
- return lst;
- }
- }
- #region -------- 私有方法,通常情况下无需修改 --------
- /// <summary>
- /// 由一行数据得到一个实体
- /// </summary>
- private Model.MeetingRun GetModel(DbDataReader dr)
- {
- Model.MeetingRun model = new Model.MeetingRun();
- model.ID = DataBaseOAHelper.GetInt(dr["ID"]);
- model.MC = DataBaseOAHelper.GetString(dr["MC"]);
- model.ZT = DataBaseOAHelper.GetString(dr["ZT"]);
- model.MS = DataBaseOAHelper.GetString(dr["MS"]);
- model.SQR = DataBaseOAHelper.GetString(dr["SQR"]);
- model.SQSJ = DataBaseOAHelper.GetDateTime(dr["SQSJ"]);
- model.CXRYNB = DataBaseOAHelper.GetString(dr["CXRYNB"]);
- model.CXRYWB = DataBaseOAHelper.GetString(dr["CXRYWB"]);
- model.KSSJ = DataBaseOAHelper.GetDateTime(dr["KSSJ"]);
- model.JSSJ = DataBaseOAHelper.GetDateTime(dr["JSSJ"]);
- model.HYS = DataBaseOAHelper.GetInt(dr["HYS"]);
- model.HYGLY = DataBaseOAHelper.GetString(dr["HYGLY"]);
- model.PZZT = DataBaseOAHelper.GetString(dr["PZZT"]);
- return model;
- }
- /// <summary>
- /// 由DbDataReader得到泛型数据列表
- /// </summary>
- private List<Model.MeetingRun> GetList(DbDataReader dr)
- {
- List<Model.MeetingRun> lst = new List<Model.MeetingRun>();
- while (dr.Read())
- {
- lst.Add(GetModel(dr));
- }
- return lst;
- }
- #endregion
- }
- }