/DocSrvQuartz_V2/DocSrv.Core/DaWordsrvstatus.auto.cs
http://sgsoft-las.googlecode.com/ · C# · 298 lines · 217 code · 60 blank · 21 comment · 4 complexity · 2a111702d0a289ffb31bc732d043b622 MD5 · raw file
- #region DaWordsrvstatus
- /*----------------------------------------------------------------
- // ????DaWordsrvstatus.cs
- // ??????Wordsrvstatus??????
- //
- //
- // ?????2009-05-03 DtataAccess template . Ver 5.0.20090413
- //
- // ?????
- // ?????
- //----------------------------------------------------------------*/
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Data;
- using System.Globalization;
- using System.Text;
- using System.Data.Common;
- using Microsoft.Practices.EnterpriseLibrary.Data;
- using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
-
- using DocSrv.Model;
-
-
- namespace DocSrv.Dal
- {
- ///?????????,IWordsrvstatus ,???????DaBase?
- ///DaBase????DbException????????
- public partial class DaWordsrvstatus:DaBase<MoWordsrvstatus>
- {
- #region SQL const
- internal const string TABLE_COLUMNS=" TR_ID ,RC ,UPDATE_TIME ,DESCRIPTION ";
-
- internal const string SQL_INSERT="INSERT INTO WORDSRVSTATUS ("+TABLE_COLUMNS+") VALUES (@TrId,@Rc,@UpdateTime,@Description)";
- internal const string SQL_SELECT="SELECT "+TABLE_COLUMNS+" FROM WORDSRVSTATUS ";
- internal const string SQL_SELECT_ONE=SQL_SELECT+" WHERE TR_ID=@TrId";
-
- internal const string SQL_EXIST="SELECT COUNT(*) FROM WORDSRVSTATUS WHERE TR_ID=@TrId ";
- internal const string SQL_UPDATE="UPDATE WORDSRVSTATUS SET RC=@Rc, UPDATE_TIME=@UpdateTime, DESCRIPTION=@Description WHERE TR_ID=@TrId";
-
- internal const string SQL_DELETE_DEFAULT = "DELETE FROM WORDSRVSTATUS ";
- internal const string SQL_DELETE="DELETE FROM WORDSRVSTATUS WHERE TR_ID=@TrId";
-
- internal const string SQL_COUNT="SELECT COUNT(*) FROM WordSrvStatus";
- #endregion
-
- #region Constructor
-
- /// <summary>
- /// ???????????????????????
- /// </summary>
- public DaWordsrvstatus ()
- {
- this.db=DatabaseFactory.CreateDatabase();
- }
- /// <summary>
- /// ?????databaseName??????
- /// </summary>
- /// <param name="databaseName">??????????????</param>
- public DaWordsrvstatus (string databaseName)
- {
- this.db = DatabaseFactory.CreateDatabase(databaseName);
- }
-
- public DaWordsrvstatus (Database db)
- {
- this.db = db;
- }
-
- #endregion
-
- //???CRUD??????????????????
-
- #region ?????
-
- protected override MoWordsrvstatus ConstructT()
- {
- return new MoWordsrvstatus();
- }
- #endregion
-
-
-
- #region Add?? Helper
-
- ///build the command object.It never throw exception.
- protected override DbCommand ConstructAddCommand(Database db)
- {
- DbCommand dbCommand = db.GetSqlStringCommand(SQL_INSERT);
-
- db.AddInParameter(dbCommand,"TrId",DbType.AnsiString);
- db.AddInParameter(dbCommand,"Rc",DbType.Int32);
- db.AddInParameter(dbCommand,"UpdateTime",DbType.DateTime);
- db.AddInParameter(dbCommand,"Description",DbType.String);
- return dbCommand;
- }
- protected override DbCommand ConstructAddCommand(Database db,MoWordsrvstatus entity)
- {
- DbCommand dbCommand=db.GetSqlStringCommand(SQL_INSERT);
- db.AddInParameter(dbCommand,"TrId",DbType.AnsiString,entity.PkId);
- db.AddInParameter(dbCommand,"Rc",DbType.Int32,entity.Rc);
- db.AddInParameter(dbCommand,"UpdateTime",DbType.DateTime,entity.UpdateTime);
- db.AddInParameter(dbCommand,"Description",DbType.String,entity.Description);
- return dbCommand;
- }
-
- protected override DbCommand PopulateAddCommandParameters(Database db,DbCommand addCmd,MoWordsrvstatus entity)
- {
- db.SetParameterValue(addCmd,"TrId",entity.PkId);
- db.SetParameterValue(addCmd,"Rc",entity.Rc);
- db.SetParameterValue(addCmd,"UpdateTime",entity.UpdateTime);
- db.SetParameterValue(addCmd,"Description",entity.Description);
- return addCmd;
- }
-
- protected override DbCommand PopulateAddCommandParameters(Database db,DbCommand addCmd,DataRow row)
- {
- db.SetParameterValue(addCmd,"TrId",row["TrId"]);
- db.SetParameterValue(addCmd,"Rc",row["Rc"]);
- db.SetParameterValue(addCmd,"UpdateTime",row["UpdateTime"]);
- db.SetParameterValue(addCmd,"Description",row["Description"]);
- return addCmd;
- }
-
- #endregion
-
- #region Update?? Helper
-
- protected override DbCommand ConstructUpdateCommand(Database db)
- {
- DbCommand dbCommand=db.GetSqlStringCommand(SQL_UPDATE);
- db.AddInParameter(dbCommand,"Rc",DbType.Int32);
- db.AddInParameter(dbCommand,"UpdateTime",DbType.DateTime);
- db.AddInParameter(dbCommand,"Description",DbType.String);
- db.AddInParameter(dbCommand,"TrId",DbType.AnsiString);
-
- return dbCommand;
- }
- protected override DbCommand ConstructUpdateCommand(Database db,MoWordsrvstatus entity)
- {
- DbCommand dbCommand=db.GetSqlStringCommand(SQL_UPDATE);
- db.AddInParameter(dbCommand,"Rc",DbType.Int32,entity.Rc);
- db.AddInParameter(dbCommand,"UpdateTime",DbType.DateTime,entity.UpdateTime);
- db.AddInParameter(dbCommand,"Description",DbType.String,entity.Description);
- db.AddInParameter(dbCommand,"TrId",DbType.AnsiString,entity.PkId);
-
- return dbCommand;
- }
-
- protected override DbCommand PopulateUpdateCommandParameters(Database db,DbCommand updateCmd,MoWordsrvstatus entity)
- {
- db.SetParameterValue(updateCmd,"Rc",entity.Rc);
- db.SetParameterValue(updateCmd,"UpdateTime",entity.UpdateTime);
- db.SetParameterValue(updateCmd,"Description",entity.Description);
- db.SetParameterValue(updateCmd,"TrId",entity.PkId);
- return updateCmd;
- }
- protected override DbCommand PopulateUpdateCommandParameters(Database db,DbCommand updateCmd,DataRow row)
- {
- db.SetParameterValue(updateCmd,"Rc",row["Rc"]);
- db.SetParameterValue(updateCmd,"UpdateTime",row["UpdateTime"]);
- db.SetParameterValue(updateCmd,"Description",row["Description"]);
- db.SetParameterValue(updateCmd,"TrId",row["TrId"]);
- return updateCmd;
- }
-
- protected override void PrepareDataAdapterCommand(Database db,out DbCommand dbInsertCommand,
- out DbCommand dbUpdateCommand,out DbCommand dbDeleteCommand)
- {
- dbInsertCommand = db.GetSqlStringCommand(SQL_INSERT);
- #region set insert cmd parameters
- db.AddInParameter(dbInsertCommand, "TrId",DbType.AnsiString, "TR_ID", DataRowVersion.Current);
- db.AddInParameter(dbInsertCommand, "Rc",DbType.Int32, "RC", DataRowVersion.Current);
- db.AddInParameter(dbInsertCommand, "UpdateTime",DbType.DateTime, "UPDATE_TIME", DataRowVersion.Current);
- db.AddInParameter(dbInsertCommand, "Description",DbType.String, "DESCRIPTION", DataRowVersion.Current);
- #endregion
- dbUpdateCommand = db.GetSqlStringCommand(SQL_UPDATE);
- #region Set update cmd value parameters
- db.AddInParameter(dbUpdateCommand, "Rc", DbType.Int32, "RC", DataRowVersion.Current);
- db.AddInParameter(dbUpdateCommand, "UpdateTime", DbType.DateTime, "UPDATE_TIME", DataRowVersion.Current);
- db.AddInParameter(dbUpdateCommand, "Description", DbType.String, "DESCRIPTION", DataRowVersion.Current);
- #endregion
- #region set update cmd pk where parameters
- db.AddInParameter(dbUpdateCommand, "TrId", DbType.AnsiString, "TR_ID", DataRowVersion.Current);
- #endregion
- dbDeleteCommand = db.GetSqlStringCommand(SQL_DELETE);
- #region set delete cmd pk where parameters
- db.AddInParameter(dbDeleteCommand, "TrId", DbType.AnsiString, "TR_ID", DataRowVersion.Current);
- #endregion
- }
- #endregion
-
- #region Delete?? Helper
-
- protected override DbCommand ConstructDeleteCommand(Database db)
- {
- DbCommand dbCommand=db.GetSqlStringCommand(SQL_DELETE);
-
- db.AddInParameter(dbCommand,"TrId",DbType.AnsiString);
-
- return dbCommand;
- }
- protected override DbCommand ConstructDeleteCommand(Database db,MoWordsrvstatus entity)
- {
- DbCommand dbCommand=db.GetSqlStringCommand(SQL_DELETE);
-
- db.AddInParameter(dbCommand,"TrId",DbType.AnsiString,entity.PkId);
-
- return dbCommand;
- }
-
- protected override DbCommand ConstructDeleteCommandForWhere(Database db, string where)
- {
- return db.GetSqlStringCommand(SQL_DELETE_DEFAULT + where);
- }
-
- protected override DbCommand PopulateDeleteCommandParameters(Database db, DbCommand deleteCmd, MoWordsrvstatus entity)
- {
- db.SetParameterValue(deleteCmd,"TrId",entity.PkId);
- return deleteCmd;
- }
-
- protected override DbCommand PopulateDeleteCommandParameters(Database db, DbCommand deleteCmd, DataRow row)
- {
- db.SetParameterValue(deleteCmd,"TrId",row["TrId"]);
- return deleteCmd;
- }
-
- #endregion helper
-
- #region Query?? Helper
-
- protected override DbCommand ConstructQueryCommand(string condition)
- {
- return db.GetSqlStringCommand(SQL_SELECT + condition);
- }
-
- #endregion
-
- #region GetEntity(s)?? Helper
-
- protected override DbCommand ConstructSelectOneCommand(Database db,MoWordsrvstatus entity)
- {
- DbCommand dbCommand=db.GetSqlStringCommand(SQL_SELECT_ONE);
-
- db.AddInParameter(dbCommand,"TrId",DbType.AnsiString,entity.PkId);
- return dbCommand;
- }
-
- protected override void PopulateEntityByDataReader(IDataReader reader,ref MoWordsrvstatus entity)
- {
- if (!reader.IsDBNull(0)) entity.PkId = reader.GetString(0);
- if (!reader.IsDBNull(1)) entity.Rc = reader.GetInt32(1);
- if (!reader.IsDBNull(2)) entity.UpdateTime = reader.GetDateTime(2);
- if (!reader.IsDBNull(3)) entity.Description = reader.GetString(3);
- }
-
-
-
- protected override DbCommand ConstructSelectConditionCommand(Database db, string condition)
- {
- return db.GetSqlStringCommand(SQL_SELECT + condition);
- }
-
- #endregion
-
- #region Count?? Helper
-
- protected override DbCommand ConstructCountCommand(Database db)
- {
- return db.GetSqlStringCommand(SQL_COUNT);
- }
-
- protected override DbCommand ConstructCountConditionCommand(Database db, string condition)
- {
- return db.GetSqlStringCommand(SQL_COUNT + condition);
- }
-
- #endregion
-
- #region IsExist?? Helper
-
- protected override DbCommand ConstructIsExistCommand(Database db, MoWordsrvstatus entity)
- {
- DbCommand dbCommand = db.GetSqlStringCommand(SQL_EXIST);
- db.AddInParameter(dbCommand,"TrId",DbType.AnsiString,entity.PkId);
- return dbCommand;
- }
-
- #endregion
-
-
-
- }
- }
- #endregion