public List <MediaModel> getMediaByCriteria(MediaModel criteriaList) { //search the database using the criteria in the list provided MediaList = new List <MediaModel>(); try { //get table of data from Data Access Object MediaDataTable = _mediaDAO.GetByCriteria(criteriaList.Title, criteriaList.Director, criteriaList.PublishYear); //prepare presentation of data foreach (MediaDataSet.TabMediaRow row in MediaDataTable.Rows) { MediaList.Add(MediaModel.Parse(row)); Console.WriteLine(row.ToString() + ": row added successfully"); } //return list return(MediaList); } catch (Exception ex) { Console.WriteLine("Exception: No Search Conducted" + ex.Message); throw ex; } }
//constructor public MediaLogic() { MediaDAO = new MediaDataAccessObject(); MediaList = new List <MediaModel>(); MediaDataTable = new MediaDataSet.TabMediaDataTable(); SelectedMedia = new MediaModel(); }
public List <MediaModel> ConvertMediaTableToList(MediaDataSet.ViewMediaDataTable mediaTable) { List <MediaModel> models = new List <MediaModel>(); foreach (MediaDataSet.ViewMediaRow row in mediaTable.Rows) { MediaModel model = MediaModel.Parse(row); models.Add(model); } return(models); }
public List <MediaModel> ListMediaBorrowed() { List <MediaModel> medias = new List <MediaModel>(); mediaBorrowedTable = mediaDAO.ListMediaBorrowed(); foreach (MediaDS.ViewMediaBorrowedRow row in mediaBorrowedTable.Rows) { MediaModel media = MediaModel.Parse(row); medias.Add(media); } return(medias); }
public List <MediaModel> ListMediaByLanguage(String language) { List <MediaModel> medias = new List <MediaModel>(); mediaTable = mediaDAO.ListMediaByLanguage(language); foreach (MediaDS.ViewMediaRow row in mediaTable.Rows) { MediaModel media = MediaModel.Parse(row); medias.Add(media); } return(medias); }
public List <MediaModel> ListMediaByDirector(String director) { List <MediaModel> medias = new List <MediaModel>(); mediaTable = mediaDAO.ListMediaByDirector(director); foreach (MediaDS.ViewMediaRow row in mediaTable.Rows) { MediaModel media = MediaModel.Parse(row); medias.Add(media); } return(medias); }
public List <MediaModel> ListMediaByBudget(decimal budget) { List <MediaModel> medias = new List <MediaModel>(); mediaTable = mediaDAO.ListMediaByBudget(budget); foreach (MediaDS.ViewMediaRow row in mediaTable.Rows) { MediaModel media = MediaModel.Parse(row); medias.Add(media); } return(medias); }
//search by genre public List <MediaModel> ListMediaGenre(string genre) { List <MediaModel> medias = new List <MediaModel>(); mediaTable = mediaDAO.ListMediaByGenre(genre); foreach (MediaDS.ViewMediaRow row in mediaTable.Rows) { MediaModel media = MediaModel.Parse(row); medias.Add(media); } return(medias); }
public List <MediaModel> ListMediaByPublishYear(int publishYear) { List <MediaModel> allMedia = new List <MediaModel>(); mediaTable = mediaDAO.ListMediaByPublishYear(publishYear); foreach (MediaDS.ViewMediaRow row in mediaTable.Rows) { MediaModel media = MediaModel.Parse(row); allMedia.Add(media); } return(allMedia); }
public List <MediaModel> searchmedaibyMediaID(int MediaID) { List <MediaModel> medias = new List <MediaModel>(); mediaTable = mediaDAO.searchmediabyMediaID(MediaID);; foreach (MediaDS.ViewMediaRow row in mediaTable.Rows) { MediaModel media = MediaModel.Parse(row); medias.Add(media); } return(medias); }
public static MediaModel Parse(MediaDataSet.ViewMediaRow row) { MediaModel model = new MediaModel(); model.MediaID = row.MediaID; model.Title = row.Title; model.PublishYear = row.PublishYear; model.GenreName = row.GenreName; model.DirectorName = row.DirectorName; model.LanguageName = row.LanguageName; model.Budget = row.Budget; return(model); }
/// <summary> /// get data view table from "ViewMediaAvailable" /// </summary> /// <param name="mediaRow"></param> /// <returns></returns> public static MediaModel Parse(MediaDS.ViewMediaAvailableRow mediaRow) { if (mediaRow == null) { return(null); } MediaModel media = new MediaModel(); media.MediaID = mediaRow.MediaID; media.MediaTitle = mediaRow.Title; media.MediaPublishYear = mediaRow.PublishYear; media.MediaBudget = mediaRow.Budget; media.MediaDirector = mediaRow.DirectorName; media.MediaGenre = mediaRow.GenreName; media.MediaLanguage = mediaRow.LanguageName; return(media); }
/// <summary> /// Get List of Media by publish year /// </summary> /// <param name="publishYear"></param> /// <returns></returns> public List <MediaModel> ListMediaByPublishYear(int publishYear) { try { List <MediaModel> medias = new List <MediaModel>(); mediaTable = mediaDAO.ListMediaByPublishYear(publishYear); foreach (MediaDS.ViewMediaRow row in mediaTable.Rows) { MediaModel media = MediaModel.Parse(row); medias.Add(media); } return(medias); } catch (Exception ex) { throw ex; } }
public List <MediaModel> ListMediaAvailbable() { try { List <MediaModel> medias = new List <MediaModel>(); mediaAvailableTable = mediaDAO.ListMediaAvailbable(); foreach (MediaDS.ViewMediaAvailableRow row in mediaAvailableTable.Rows) { MediaModel media = MediaModel.Parse(row); medias.Add(media); } return(medias); } catch (Exception ex) { throw ex; } }
public List <MediaModel> ListMediaByTitle(String title) { try { List <MediaModel> medias = new List <MediaModel>(); mediaTable = mediaDAO.ListMediaByTitle(title); foreach (MediaDS.ViewMediaRow row in mediaTable.Rows) { MediaModel media = MediaModel.Parse(row); medias.Add(media); } return(medias); } catch (Exception ex) { throw ex; } }
public static MediaModel ParseBasic(MediaDataSet.TabMediaRow row) { if (row == null) { return(null); } MediaModel mm = new MediaModel(); mm.Title = row.Title; mm.Genre = row.Genre.ToString(); mm.Director = row.Director.ToString(); mm.Language = row.Language.ToString(); mm.PublishYear = row.PublishYear; mm.Budget = row.Budget; mm.MediaID = row.MediaID; return(mm); }
public List <MediaModel> getAllMedia() { MediaList = new List <MediaModel>(); try { //get table data from DAO MediaDataTable = _mediaDAO.GetMediaAll(); //prepare presentation of data foreach (MediaDataSet.TabMediaRow row in MediaDataTable.Rows) { MediaList.Add(MediaModel.Parse(row)); } //return list return(MediaList); } catch (Exception ex) { throw ex; } }