public static TMSMonth Get(System.Int64 mhID) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSMonth instance; instance = new TMSMonth(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSMonth_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, mhID); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) { throw new ApplicationException("Could not get TMSMonth ID:" + mhID.ToString() + " from Database."); } // Return results. ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
public static TMSMonth[] Search(System.Int64?mhID, System.String mhName, System.DateTime?mhDate, System.Int32?mhStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSMonth_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, mhID, mhName, mhDate, mhStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSMonth.MapFrom(ds)); }
public static TMSMonth[] MapFrom(DataSet ds) { List <TMSMonth> objects; // Initialise Collection. objects = new List <TMSMonth>(); // 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_Month] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_Month] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSMonth instance = new TMSMonth(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static TMSMonth[] Search(TMSMonth searchObject) { return(Search(searchObject.MhID, searchObject.MhName, searchObject.MhDate, searchObject.MhStatus)); }
public static void Update(TMSMonth tMSMonth, DbTransaction transaction) { tMSMonth.Update(transaction); }
public static void Update(TMSMonth tMSMonth) { tMSMonth.Update(); }
public static DataSet GetSearch(TMSMonth searchObject) { return GetSearch (searchObject.MhID, searchObject.MhName, searchObject.MhDate, searchObject.MhStatus); }
public static DataSet GetSearch(TMSMonth searchObject) { return(GetSearch(searchObject.MhID, searchObject.MhName, searchObject.MhDate, searchObject.MhStatus)); }