Esempio n. 1
0
    public static TMSPrivacySettings Get(System.Int64 psPrivacyId)
    {
        DataSet            ds;
        Database           db;
        string             sqlCommand;
        DbCommand          dbCommand;
        TMSPrivacySettings instance;


        instance = new TMSPrivacySettings();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
Esempio n. 2
0
    public static TMSPrivacySettings[] Search(System.Int64?psPrivacyId, System.Int64?psFacultyLoginId, System.Int64?psFacultyTypeId, System.String psFacultyType, System.String psDisplayPhoto, System.String psDisplayEducation, System.String psDisplayConatctDetails, System.String psDisplayLocation, System.String psExtraOne, System.String psExtraTwo, System.String psExtraThree, System.String psExtraFour, System.DateTime?psDate, System.Int32?psStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSPrivacySettings_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, psPrivacyId, psFacultyLoginId, psFacultyTypeId, psFacultyType, psDisplayPhoto, psDisplayEducation, psDisplayConatctDetails, psDisplayLocation, psExtraOne, psExtraTwo, psExtraThree, psExtraFour, psDate, psStatus);

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


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

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

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

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

        // Return collection.
        return(objects.ToArray());
    }