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


        instance = new TMSFiles();

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

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

        instance.MapFrom(ds.Tables[0].Rows[0]);
        return(instance);
    }
Пример #2
0
    public static TMSFiles[] Search(System.Int64?fileID, System.String fileName, System.String filePath, System.String fileDescription, System.Int32?fileStatus)
    {
        DataSet   ds;
        Database  db;
        string    sqlCommand;
        DbCommand dbCommand;


        db         = DatabaseFactory.CreateDatabase();
        sqlCommand = "[dbo].gspTMSFiles_SEARCH";
        dbCommand  = db.GetStoredProcCommand(sqlCommand, fileID, fileName, filePath, fileDescription, fileStatus);

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


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

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

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

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

        // Return collection.
        return(objects.ToArray());
    }
Пример #4
0
 public static DataSet GetSearch(TMSFiles searchObject)
 {
     return(GetSearch(searchObject.FileID, searchObject.FileName, searchObject.FilePath, searchObject.FileDescription, searchObject.FileStatus));
 }
Пример #5
0
 public static void Update(TMSFiles tMSFiles, DbTransaction transaction)
 {
     tMSFiles.Update(transaction);
 }
Пример #6
0
 public static void Update(TMSFiles tMSFiles)
 {
     tMSFiles.Update();
 }
Пример #7
0
 public static TMSFiles[] Search(TMSFiles searchObject)
 {
     return Search ( searchObject.FileID, searchObject.FileName, searchObject.FilePath, searchObject.FileDescription, searchObject.FileStatus);
 }
Пример #8
0
    public static TMSFiles[] MapFrom(DataSet ds)
    {
        List<TMSFiles> objects;

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

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

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

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

        // Return collection.
        return objects.ToArray();
    }
Пример #9
0
    public static TMSFiles Get(System.Int64 fileID)
    {
        DataSet ds;
        Database db;
        string sqlCommand;
        DbCommand dbCommand;
        TMSFiles instance;

        instance = new TMSFiles();

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

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

        instance.MapFrom( ds.Tables[0].Rows[0] );
        return instance;
    }
Пример #10
0
 public static TMSFiles[] Search(TMSFiles searchObject)
 {
     return(Search(searchObject.FileID, searchObject.FileName, searchObject.FilePath, searchObject.FileDescription, searchObject.FileStatus));
 }
Пример #11
0
 public static void Update(TMSFiles tMSFiles, DbTransaction transaction)
 {
     tMSFiles.Update(transaction);
 }
Пример #12
0
 public static void Update(TMSFiles tMSFiles)
 {
     tMSFiles.Update();
 }
Пример #13
0
 public static DataSet GetSearch(TMSFiles searchObject)
 {
     return GetSearch(searchObject.FileID, searchObject.FileName, searchObject.FilePath, searchObject.FileDescription, searchObject.FileStatus);
 }