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


        instance = new TMSWelcome();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    public static TMSWelcome[] Search(System.Int64?wdId, System.String wdDescriptipon, System.DateTime?wdDate, System.String wdVideoPath, System.String wdThumb, System.String wdTitle, System.Int32?wdStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSWelcome_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, wdId, wdDescriptipon, wdDate, wdVideoPath, wdThumb, wdTitle, wdStatus);

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


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

        // 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_Welcome] in DataSet.");
        }

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

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

        // Return collection.
        return(objects.ToArray());
    }
 public static void Update(TMSWelcome tMSWelcome, DbTransaction transaction)
 {
     tMSWelcome.Update(transaction);
 }
 public static void Update(TMSWelcome tMSWelcome)
 {
     tMSWelcome.Update();
 }
 public static TMSWelcome[] Search(TMSWelcome searchObject)
 {
     return Search ( searchObject.WdId, searchObject.WDDescriptipon, searchObject.WDDate, searchObject.WDVideoPath, searchObject.WDThumb, searchObject.WDTitle, searchObject.WDStatus);
 }
    public static TMSWelcome[] MapFrom(DataSet ds)
    {
        List<TMSWelcome> objects;

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

        // 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_Welcome] in DataSet.");

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

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

        // Return collection.
        return objects.ToArray();
    }
    public static TMSWelcome Get(System.Int64 wdId)
    {
        DataSet ds;
        Database db;
        string sqlCommand;
        DbCommand dbCommand;
        TMSWelcome instance;

        instance = new TMSWelcome();

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

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

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }
Example #9
0
 public static DataSet GetSearch(TMSWelcome searchObject)
 {
     return(GetSearch(searchObject.WdId, searchObject.WDDescriptipon, searchObject.WDDate, searchObject.WDVideoPath, searchObject.WDThumb, searchObject.WDTitle, searchObject.WDStatus));
 }
 public static void Update(TMSWelcome tMSWelcome, DbTransaction transaction)
 {
     tMSWelcome.Update(transaction);
 }
 public static void Update(TMSWelcome tMSWelcome)
 {
     tMSWelcome.Update();
 }