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


        instance = new TMSGeneralKnowledgeDetails();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
    public static TMSGeneralKnowledgeDetails[] Search(System.Int64?gkKnowledgeId, System.Int64?gkFacultyId, System.Int64?gkStudentId, System.Int64?gkSchoolId, System.Int64?gkSchoolSubId, System.String gkQuestionType, System.String gkQuestion, System.String gkAnswer, System.String gkOption1, System.String gkOption2, System.String gkOption3, System.String gkOption4, System.String gkOption5, System.String gkQuestionFor, System.Int64?gkAddedById, System.DateTime?gkTestDate, System.DateTime?gkDate, System.Int32?gkStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSGeneralKnowledgeDetails_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, gkKnowledgeId, gkFacultyId, gkStudentId, gkSchoolId, gkSchoolSubId, gkQuestionType, gkQuestion, gkAnswer, gkOption1, gkOption2, gkOption3, gkOption4, gkOption5, gkQuestionFor, gkAddedById, gkTestDate, gkDate, gkStatus);

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


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

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

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

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

        // Return collection.
        return(objects.ToArray());
    }
 public static TMSGeneralKnowledgeDetails[] Search(TMSGeneralKnowledgeDetails searchObject)
 {
     return(Search(searchObject.GKKnowledgeId, searchObject.GKFacultyId, searchObject.GKStudentId, searchObject.GKSchoolId, searchObject.GKSchoolSubId, searchObject.GKQuestionType, searchObject.GKQuestion, searchObject.GKAnswer, searchObject.GKOption1, searchObject.GKOption2, searchObject.GKOption3, searchObject.GKOption4, searchObject.GKOption5, searchObject.GKQuestionFor, searchObject.GKAddedById, searchObject.GKTestDate, searchObject.GKDate, searchObject.GKStatus));
 }
 public static void Update(TMSGeneralKnowledgeDetails tMSGeneralKnowledgeDetails, DbTransaction transaction)
 {
     tMSGeneralKnowledgeDetails.Update(transaction);
 }
 public static void Update(TMSGeneralKnowledgeDetails tMSGeneralKnowledgeDetails)
 {
     tMSGeneralKnowledgeDetails.Update();
 }
コード例 #7
0
 public static DataSet GetSearch(TMSGeneralKnowledgeDetails searchObject)
 {
     return GetSearch(searchObject.GKKnowledgeId, searchObject.GKFacultyId, searchObject.GKStudentId, searchObject.GKSchoolId, searchObject.GKSchoolSubId, searchObject.GKQuestionType, searchObject.GKQuestion, searchObject.GKAnswer, searchObject.GKOption1, searchObject.GKOption2, searchObject.GKOption3, searchObject.GKOption4, searchObject.GKOption5, searchObject.GKQuestionFor, searchObject.GKAddedById, searchObject.GKTestDate, searchObject.GKDate, searchObject.GKStatus);
 }
コード例 #8
0
 public static void Update(TMSGeneralKnowledgeDetails tMSGeneralKnowledgeDetails, DbTransaction transaction)
 {
     tMSGeneralKnowledgeDetails.Update(transaction);
 }
コード例 #9
0
 public static void Update(TMSGeneralKnowledgeDetails tMSGeneralKnowledgeDetails)
 {
     tMSGeneralKnowledgeDetails.Update();
 }
コード例 #10
0
    public static TMSGeneralKnowledgeDetails[] MapFrom(DataSet ds)
    {
        List<TMSGeneralKnowledgeDetails> objects;

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

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

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

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

        // Return collection.
        return objects.ToArray();
    }
コード例 #11
0
    public static TMSGeneralKnowledgeDetails Get(System.Int64 gkKnowledgeId)
    {
        DataSet ds;
        Database db;
        string sqlCommand;
        DbCommand dbCommand;
        TMSGeneralKnowledgeDetails instance;

        instance = new TMSGeneralKnowledgeDetails();

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

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

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