Пример #1
0
    public static TMSSubjectAssignFacultyDetails Get(System.Int64 safdAssignId)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;
        TMSSubjectAssignFacultyDetails instance;


        instance = new TMSSubjectAssignFacultyDetails();

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

        // Get results.
        ds = db.ExecuteDataSet(dbCommand);
        // Verification.
        if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSSubjectAssignFacultyDetails ID:" + safdAssignId.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 TMSSubjectAssignFacultyDetails[] Search(System.Int64?safdAssignId, System.Int64?safdFacultyId, System.Int64?safdSubjectId, System.Int64?safdDepartmentId, System.String safdAssignType, System.DateTime?safdDate, System.Int32?safdStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSSubjectAssignFacultyDetails_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, safdAssignId, safdFacultyId, safdSubjectId, safdDepartmentId, safdAssignType, safdDate, safdStatus);

        ds = db.ExecuteDataSet(dbCommand);
        ds.Tables[0].TableName = TABLE_NAME;
        return(TMSSubjectAssignFacultyDetails.MapFrom(ds));
    }
Пример #3
0
    public static TMSSubjectAssignFacultyDetails[] MapFrom(DataSet ds)
    {
        List <TMSSubjectAssignFacultyDetails> objects;


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

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

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

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

        // Return collection.
        return(objects.ToArray());
    }
    public static TMSSubjectAssignFacultyDetails[] MapFrom(DataSet ds)
    {
        List<TMSSubjectAssignFacultyDetails> objects;

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

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

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

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

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

        instance = new TMSSubjectAssignFacultyDetails();

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

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

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