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


        instance = new TMSScholasticGradeDetails();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    public static TMSScholasticGradeDetails[] Search(System.Int64?sgpGradeId, System.String sgpGradeName, System.Int32?sgpGradePoint, System.DateTime?sgpDate, System.Int32?sgpStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSScholasticGradeDetails_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, sgpGradeId, sgpGradeName, sgpGradePoint, sgpDate, sgpStatus);

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


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

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

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

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

        // Return collection.
        return(objects.ToArray());
    }
 public static TMSScholasticGradeDetails[] Search(TMSScholasticGradeDetails searchObject)
 {
     return(Search(searchObject.SGPGradeId, searchObject.SGPGradeName, searchObject.SGPGradePoint, searchObject.SGPDate, searchObject.SGPStatus));
 }
 public static void Update(TMSScholasticGradeDetails tMSScholasticGradeDetails, DbTransaction transaction)
 {
     tMSScholasticGradeDetails.Update(transaction);
 }
 public static void Update(TMSScholasticGradeDetails tMSScholasticGradeDetails)
 {
     tMSScholasticGradeDetails.Update();
 }
 public static DataSet GetSearch(TMSScholasticGradeDetails searchObject)
 {
     return GetSearch(searchObject.SGPGradeId, searchObject.SGPGradeName, searchObject.SGPGradePoint, searchObject.SGPDate, searchObject.SGPStatus);
 }
 public static void Update(TMSScholasticGradeDetails tMSScholasticGradeDetails, DbTransaction transaction)
 {
     tMSScholasticGradeDetails.Update(transaction);
 }
 public static void Update(TMSScholasticGradeDetails tMSScholasticGradeDetails)
 {
     tMSScholasticGradeDetails.Update();
 }
    public static TMSScholasticGradeDetails[] MapFrom(DataSet ds)
    {
        List<TMSScholasticGradeDetails> objects;

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

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

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

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

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

        instance = new TMSScholasticGradeDetails();

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

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

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