//Returns info for 9 most recent exhibitions (for Carousel) public static List <CarouselItem> getCarouselItems() { List <Exhibition> exhibitionList = Exhibition.getRecentExhibitions(); string coverImage; string link; string sql; int i = 0; List <CarouselItem> carouselItems = new List <CarouselItem>(); while (i < exhibitionList.Count) { sql = "getCoverImage @exhibition=" + exhibitionList [i].ExhibitionID; if (exhibitionList[i].Type.Equals("G")) { link = "http://averagenegative.azurewebsites.net/StreetViewExhibit/Gallery.aspx?GalleryId=" + exhibitionList[i].ExhibitionID; } else { link = "http://averagenegative.azurewebsites.net/Portraits-Exhibit/Portraits.aspx?GalleryId=" + exhibitionList[i].ExhibitionID; } coverImage = (string)SqlComm.SqlReturn(sql); carouselItems.Add(new CarouselItem(exhibitionList [i].Name, exhibitionList [i].Description, coverImage, exhibitionList[i].ExhibitionID, link)); i++; } return(carouselItems); }
//Returns info for all exhibitions (for Carousel) //Displays the top 30 most recently created if more than 30 exist public static List <Exhibition> getRecentExhibitions() { List <Exhibition> exhibitionList = new List <Exhibition>(); string sql; DataTable exhibitionIDs; try{ sql = "getRecentExhibitionIDs"; exhibitionIDs = SqlComm.SqlDataTable(sql); foreach (DataRow row in exhibitionIDs.Rows) { exhibitionList.Add(Exhibition.retrieve((int)row[0])); } }catch { exhibitionList.Add(new Exhibition()); exhibitionList.Add(new Exhibition()); exhibitionList.Add(new Exhibition()); exhibitionList.Add(new Exhibition()); } return(exhibitionList); }
//Returns a list of all exhibitions created by given user public List <Exhibition> getExhibitionArray() { if (artistID < 1) { return(null); } List <Exhibition> exhibitionList = new List <Exhibition>(); string sql; DataTable exhibitionIDs; try{ sql = "getExhibitionIDs @artistID=" + artistID; exhibitionIDs = SqlComm.SqlDataTable(sql); foreach (DataRow row in exhibitionIDs.Rows) { exhibitionList.Add(Exhibition.retrieve((int)row[0])); } }catch { exhibitionList.Add(new Exhibition()); exhibitionList.Add(new Exhibition()); } return(exhibitionList); }