예제 #1
0
    public static TMSExamType Get(System.Int64 etExamTypeId)
    {
        DataSet     ds;
        Database    db;
        string      sqlCommand;
        DbCommand   dbCommand;
        TMSExamType instance;


        instance = new TMSExamType();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
예제 #2
0
    public static TMSExamType[] Search(System.Int64?etExamTypeId, System.String etExamTypeName, System.DateTime?etDate, System.Int32?etStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSExamType_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, etExamTypeId, etExamTypeName, etDate, etStatus);

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


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

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

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

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

        // Return collection.
        return(objects.ToArray());
    }
예제 #4
0
 public static TMSExamType[] Search(TMSExamType searchObject)
 {
     return(Search(searchObject.ETExamTypeId, searchObject.ETExamTypeName, searchObject.ETDate, searchObject.ETStatus));
 }
예제 #5
0
 public static void Update(TMSExamType tMSExamType, DbTransaction transaction)
 {
     tMSExamType.Update(transaction);
 }
예제 #6
0
 public static void Update(TMSExamType tMSExamType)
 {
     tMSExamType.Update();
 }
예제 #7
0
 public static DataSet GetSearch(TMSExamType searchObject)
 {
     return GetSearch(searchObject.ETExamTypeId, searchObject.ETExamTypeName, searchObject.ETDate, searchObject.ETStatus);
 }
예제 #8
0
 public static DataSet GetSearch(TMSExamType searchObject)
 {
     return(GetSearch(searchObject.ETExamTypeId, searchObject.ETExamTypeName, searchObject.ETDate, searchObject.ETStatus));
 }
 public static void Update(TMSExamType tMSExamType, DbTransaction transaction)
 {
     tMSExamType.Update(transaction);
 }
 public static void Update(TMSExamType tMSExamType)
 {
     tMSExamType.Update();
 }
 public static TMSExamType[] Search(TMSExamType searchObject)
 {
     return Search ( searchObject.ETExamTypeId, searchObject.ETExamTypeName, searchObject.ETDate, searchObject.ETStatus);
 }
    public static TMSExamType[] MapFrom(DataSet ds)
    {
        List<TMSExamType> objects;

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

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

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

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

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

        instance = new TMSExamType();

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

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

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