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


        instance = new TMSTestimonials();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    public static TMSTestimonials[] Search(System.Int64?tsId, System.String tsName, System.String tsPhotopath, System.String tsTestimonials, System.DateTime?tsDate, System.Int32?tsStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSTestimonials_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, tsId, tsName, tsPhotopath, tsTestimonials, tsDate, tsStatus);

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


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

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

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

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

        // Return collection.
        return(objects.ToArray());
    }
예제 #4
0
 public static DataSet GetSearch(TMSTestimonials searchObject)
 {
     return(GetSearch(searchObject.TsId, searchObject.TSName, searchObject.TSPhotopath, searchObject.TSTestimonials, searchObject.TSDate, searchObject.TSStatus));
 }
 public static void Update(TMSTestimonials tMSTestimonials, DbTransaction transaction)
 {
     tMSTestimonials.Update(transaction);
 }
 public static void Update(TMSTestimonials tMSTestimonials)
 {
     tMSTestimonials.Update();
 }
 public static TMSTestimonials[] Search(TMSTestimonials searchObject)
 {
     return Search ( searchObject.TsId, searchObject.TSName, searchObject.TSPhotopath, searchObject.TSTestimonials, searchObject.TSDate, searchObject.TSStatus);
 }
    public static TMSTestimonials[] MapFrom(DataSet ds)
    {
        List<TMSTestimonials> objects;

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

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

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

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

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

        instance = new TMSTestimonials();

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

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

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }
 public static void Update(TMSTestimonials tMSTestimonials, DbTransaction transaction)
 {
     tMSTestimonials.Update(transaction);
 }
 public static void Update(TMSTestimonials tMSTestimonials)
 {
     tMSTestimonials.Update();
 }