Beispiel #1
0
        public virtual DataSet GetDataSetByID(int iObjectID)
        {
            DbCommand storedProcedure = SqlDatabaseHelper.GetStoredProcedure(this.GenerateSelectByPrimaryKeyStoredProcedureName());

            SqlDatabaseHelper.AddInParameter(storedProcedure, SqlDatabaseHelper.GetPrimaryKeyColumn(this.TableName), SqlDbType.Int, (object)iObjectID);
            return(SqlDatabaseHelper.RunStoredProcedure(storedProcedure));
        }
Beispiel #2
0
        public virtual void DeleteObject(int iObjectID)
        {
            DbCommand storedProcedure = SqlDatabaseHelper.GetStoredProcedure(this.GenerateDeleteStoredProcedureName());

            SqlDatabaseHelper.AddInParameter(storedProcedure, SqlDatabaseHelper.GetPrimaryKeyColumn(this.TableName), SqlDbType.Int, (object)iObjectID);
            SqlDatabaseHelper.RunStoredProcedure(storedProcedure);
        }
Beispiel #3
0
        public virtual object GetDeletedObjectByID(int iObjectID)
        {
            DbCommand storedProcedure = SqlDatabaseHelper.GetStoredProcedure(this.GenerateSelectDeletedByPrimayKeyStoredProcedureName());

            SqlDatabaseHelper.AddInParameter(storedProcedure, SqlDatabaseHelper.GetPrimaryKeyColumn(this.TableName), SqlDbType.Int, (object)iObjectID);
            DataSet dataSet = SqlDatabaseHelper.RunStoredProcedure(storedProcedure);

            if (dataSet.Tables.Count <= 0)
            {
                return((object)null);
            }
            return(SqlDatabaseHelper.GetSingleObject(dataSet.Tables[0], this.ObjectType));
        }
Beispiel #4
0
 public virtual void DeleteObject(int iObjectID, DbTransaction transaction)
 {
     try
     {
         DbCommand storedProcedure = SqlDatabaseHelper.GetStoredProcedure(this.GenerateDeleteStoredProcedureName());
         SqlDatabaseHelper.AddInParameter(storedProcedure, SqlDatabaseHelper.GetPrimaryKeyColumn(this.TableName), SqlDbType.Int, (object)iObjectID);
         storedProcedure.Transaction = transaction;
         SqlDatabaseHelper.RunStoredProcedure(storedProcedure);
         SqlDatabaseHelper.CommitTransaction(transaction);
     }
     catch (Exception ex)
     {
         SqlDatabaseHelper.RollbackTransaction(transaction);
     }
 }