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); }
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)); }
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()); }
public static DataSet GetSearch(TMSFiles searchObject) { return(GetSearch(searchObject.FileID, searchObject.FileName, searchObject.FilePath, searchObject.FileDescription, searchObject.FileStatus)); }
public static void Update(TMSFiles tMSFiles, DbTransaction transaction) { tMSFiles.Update(transaction); }
public static void Update(TMSFiles tMSFiles) { tMSFiles.Update(); }
public static TMSFiles[] Search(TMSFiles searchObject) { return Search ( searchObject.FileID, searchObject.FileName, searchObject.FilePath, searchObject.FileDescription, searchObject.FileStatus); }
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(); }
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; }
public static TMSFiles[] Search(TMSFiles searchObject) { return(Search(searchObject.FileID, searchObject.FileName, searchObject.FilePath, searchObject.FileDescription, searchObject.FileStatus)); }
public static DataSet GetSearch(TMSFiles searchObject) { return GetSearch(searchObject.FileID, searchObject.FileName, searchObject.FilePath, searchObject.FileDescription, searchObject.FileStatus); }