public static TMSApplicationType Get(System.Int64 adApplicationTypeId)
    {
        DataSet            ds;
        Database           db;
        string             sqlCommand;
        DbCommand          dbCommand;
        TMSApplicationType instance;


        instance = new TMSApplicationType();

        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSApplicationType_SELECT";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, adApplicationTypeId);

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSApplicationType ID:" + adApplicationTypeId.ToString()+ " from Database.");
        // Return results.
        {
            return(null);
        }
        ds.Tables[0].TableName = TABLE_NAME;

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    public static TMSApplicationType[] Search(System.Int64?adApplicationTypeId, System.String adApplicationType, System.DateTime?adApplicationTypeDate, System.Int32?adApplicationTypeStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSApplicationType_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, adApplicationTypeId, adApplicationType, adApplicationTypeDate, adApplicationTypeStatus);

        ds = db.ExecuteDataSet(dbCommand);
        ds.Tables[0].TableName = TABLE_NAME;
        return(TMSApplicationType.MapFrom(ds));
    }
    public static TMSApplicationType[] MapFrom(DataSet ds)
    {
        List <TMSApplicationType> objects;


        // Initialise Collection.
        objects = new List <TMSApplicationType>();

        // Validation.
        if (ds == null)
        {
            throw new ApplicationException("Cannot map to dataset null.");
        }
        else if (ds.Tables[TABLE_NAME].Rows.Count == 0)
        {
            return(objects.ToArray());
        }

        if (ds.Tables[TABLE_NAME] == null)
        {
            throw new ApplicationException("Cannot find table [dbo].[TMS_ApplicationType] in DataSet.");
        }

        if (ds.Tables[TABLE_NAME].Rows.Count < 1)
        {
            throw new ApplicationException("Table [dbo].[TMS_ApplicationType] is empty.");
        }

        // Map DataSet to Instance.
        foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows)
        {
            TMSApplicationType instance = new TMSApplicationType();
            instance.MapFrom(dr);
            objects.Add(instance);
        }

        // Return collection.
        return(objects.ToArray());
    }
 public static TMSApplicationType[] Search(TMSApplicationType searchObject)
 {
     return(Search(searchObject.ADApplicationTypeId, searchObject.ADApplicationType, searchObject.ADApplicationTypeDate, searchObject.ADApplicationTypeStatus));
 }
 public static void Update(TMSApplicationType tMSApplicationType, DbTransaction transaction)
 {
     tMSApplicationType.Update(transaction);
 }
 public static void Update(TMSApplicationType tMSApplicationType)
 {
     tMSApplicationType.Update();
 }
 public static DataSet GetSearch(TMSApplicationType searchObject)
 {
     return(GetSearch(searchObject.ADApplicationTypeId, searchObject.ADApplicationType, searchObject.ADApplicationTypeDate, searchObject.ADApplicationTypeStatus));
 }
 public static DataSet GetSearch(TMSApplicationType searchObject)
 {
     return GetSearch(searchObject.ADApplicationTypeId, searchObject.ADApplicationType, searchObject.ADApplicationTypeDate, searchObject.ADApplicationTypeStatus);
 }