public MediaLogic() { mediaDAO = new MediaDAO(); mediaTable = new MediaDS.ViewMediaDataTable(); languageTable = new MediaDS.TabLanguageDataTable(); genreTable = new MediaDS.TabGenreDataTable(); tabMediaTable = new MediaDS.TabMediaDataTable(); }
//functions --------- private List <TabMedia> parseTabMediaDataTolistAll(MediaDS.TabMediaDataTable myData) { List <TabMedia> mediaList = new List <TabMedia>(); foreach (MediaDS.TabMediaRow row in myData.Rows) { if (row == null) { return(null); } else { TabMedia mTabItem = new TabMedia(row.MediaID, row.Title, row.PublishYear, row.Budget, row.Genre, row.Director, row.Language); mediaList.Add(mTabItem); } } return(mediaList); }
public bool getDirectorExists(int directorId) { List <TabMedia> myList = new List <TabMedia>(); MediaDS.TabMediaDataTable myData = mediaDAO.getDirectorExists(directorId); //parse data from datatable rows to list elements myList = parseTabMediaDataTolistAll(myData); // results list count == 0 if (myList.Count > 0) { return(true); } else { return(false); } }