private void PopulateLinkedShowGridView() { Guid club_ID = new Guid(Club_ID); int show_Year_ID = Int32.Parse(Show_Year_ID); LinkedShows linkedShows = new LinkedShows(); List<LinkedShows> lnkLinkedShows; lnkLinkedShows = linkedShows.GetLinked_Shows(); List<LinkedShows> linkedShowList = new List<LinkedShows>(); foreach (LinkedShows linkedShowRow in lnkLinkedShows) { Shows parentShow = new Shows(linkedShowRow.Parent_Show_ID); Shows childShow = new Shows(linkedShowRow.Child_Show_ID); if (parentShow.Club_ID == club_ID && parentShow.Show_Year_ID == show_Year_ID) { LinkedShows newLinkedShow = new LinkedShows(linkedShowRow.Linked_Show_ID); newLinkedShow.Parent_Show_Name = parentShow.Show_Name; newLinkedShow.Parent_Show_Opens = parentShow.Show_Opens; newLinkedShow.Child_Show_Name = childShow.Show_Name; newLinkedShow.Child_Show_Opens = childShow.Show_Opens; linkedShowList.Add(newLinkedShow); } } if (linkedShowList != null && linkedShowList.Count > 0) { LinkedShowsGridView.DataSource = linkedShowList; LinkedShowsGridView.DataBind(); divClubLinkedShows.Visible = true; } else { divClubLinkedShows.Visible = false; } }
private void PopulateParentShowGridView() { List<LinkedShows> lnkLinkedShows; LinkedShows linkedShows = new LinkedShows(); lnkLinkedShows = linkedShows.GetLinked_Shows(); Guid club_ID = new Guid(Club_ID); int show_Year_ID = Int32.Parse(Show_Year_ID); List<Shows> tblShows; Shows show = new Shows(); tblShows = show.GetShowsByClub_ID_And_Show_Year_ID(club_ID, show_Year_ID); List<Shows> parentShowList = new List<Shows>(); foreach (Shows showRow in tblShows) { if (lnkLinkedShows.Count == 0) { Shows newShow = new Shows((Guid)showRow.Show_ID); parentShowList.Add(newShow); } else { foreach (LinkedShows linkedShowRow in lnkLinkedShows) { if (showRow.Show_ID != linkedShowRow.Parent_Show_ID && showRow.Show_ID != linkedShowRow.Child_Show_ID) { Shows newShow = new Shows((Guid)showRow.Show_ID); parentShowList.Add(newShow); } } } } if (parentShowList != null && parentShowList.Count > 0) { ParentShowGridView.DataSource = parentShowList; ParentShowGridView.DataBind(); divParentShowList.Visible = true; divParentShowDetails.Visible = false; } else { MessageLabel.Text = "There are no unlinked shows for this Club."; } }
private void PopulateChildShowGridView() { Guid club_ID = new Guid(Club_ID); int show_Year_ID = Int32.Parse(Show_Year_ID); List<Shows> tblShows; Shows show = new Shows(); tblShows = show.GetShowsByClub_ID_And_Show_Year_ID(club_ID, show_Year_ID); List<LinkedShows> lnkLinkedShows; LinkedShows linkedShows = new LinkedShows(); lnkLinkedShows = linkedShows.GetLinked_Shows(); Guid parent_Show_ID = new Guid(Parent_Show_ID); List<Shows> childShowList = new List<Shows>(); foreach (Shows row in tblShows) { if (lnkLinkedShows.Count == 0 && row.Show_ID != parent_Show_ID) { Shows childShow = new Shows((Guid)row.Show_ID); childShowList.Add(childShow); } else { foreach (LinkedShows linkedShowRow in lnkLinkedShows) { if (row.Show_ID != parent_Show_ID && row.Show_ID != linkedShowRow.Parent_Show_ID && row.Show_ID != linkedShowRow.Child_Show_ID) { Shows childShow = new Shows((Guid)row.Show_ID); childShowList.Add(childShow); } } } } if (childShowList != null && childShowList.Count > 0) { ChildShowGridView.DataSource = childShowList; ChildShowGridView.DataBind(); } else { MessageLabel.Text = "There is no second, unlinked show for this Club."; } }