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


        instance = new TMSBlogDetails();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    public static TMSBlogDetails[] Search(System.Int64?bdBlogId, System.Int64?bdParentLoginId, System.Int64?bdFacultyLoginId, System.String bdTitle, System.String bdDescription, System.String bdImage, System.Int64?bdReplyId, System.DateTime?bdDate, System.Int32?bdStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSBlogDetails_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, bdBlogId, bdParentLoginId, bdFacultyLoginId, bdTitle, bdDescription, bdImage, bdReplyId, bdDate, bdStatus);

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


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

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

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

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

        // Return collection.
        return(objects.ToArray());
    }
 public static TMSBlogDetails[] Search(TMSBlogDetails searchObject)
 {
     return(Search(searchObject.BDBlogId, searchObject.BDParentLoginId, searchObject.BDFacultyLoginId, searchObject.BDTitle, searchObject.BDDescription, searchObject.BDImage, searchObject.BDReplyId, searchObject.BDDate, searchObject.BDStatus));
 }
 public static void Update(TMSBlogDetails tMSBlogDetails, DbTransaction transaction)
 {
     tMSBlogDetails.Update(transaction);
 }
 public static void Update(TMSBlogDetails tMSBlogDetails)
 {
     tMSBlogDetails.Update();
 }
 public static void Update(TMSBlogDetails tMSBlogDetails, DbTransaction transaction)
 {
     tMSBlogDetails.Update(transaction);
 }
 public static void Update(TMSBlogDetails tMSBlogDetails)
 {
     tMSBlogDetails.Update();
 }
 public static TMSBlogDetails[] Search(TMSBlogDetails searchObject)
 {
     return Search ( searchObject.BDBlogId, searchObject.BDParentLoginId, searchObject.BDFacultyLoginId, searchObject.BDTitle, searchObject.BDDescription, searchObject.BDImage, searchObject.BDReplyId, searchObject.BDDate, searchObject.BDStatus);
 }
    public static TMSBlogDetails[] MapFrom(DataSet ds)
    {
        List<TMSBlogDetails> objects;

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

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

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

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

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

        instance = new TMSBlogDetails();

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

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

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }