public ActionResult Index() { // CONTESTS Contest cndss = Contest.GetCurrentContest(); ContestVideos cvids = new ContestVideos(); Videos vidsInContest = new Videos(); BootBaronLib.AppSpec.DasKlub.BOL.Video vid2 = null; foreach (ContestVideo cv1 in cvids) { vid2 = new BootBaronLib.AppSpec.DasKlub.BOL.Video(cv1.VideoID); vidsInContest.Add(vid2); } vidsInContest.Sort(delegate(BootBaronLib.AppSpec.DasKlub.BOL.Video p1, BootBaronLib.AppSpec.DasKlub.BOL.Video p2) { return p2.PublishDate.CompareTo(p1.PublishDate); }); SongRecords sngrcds3 = new SongRecords(); SongRecord sng3 = new SongRecord(); foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in vidsInContest) { sng3 = new SongRecord(v1); sngrcds3.Add(sng3); } ViewBag.ContestVideoList = sngrcds3.VideosList(); ViewBag.CurrentContest = cndss; // PhotoItems pitms = new PhotoItems(); pitms.UseThumb = true; pitms.ShowTitle = false; pitms.GetPhotoItemsPageWise(1, 4); ViewBag.PhotoList = pitms.ToUnorderdList; Contents cnts = new Contents(); cnts.GetContentPageWiseAll(1, 3); ViewBag.RecentArticles = cnts.ToUnorderdList; UserAccounts uas = new UserAccounts(); uas.GetNewestUsers(); ViewBag.NewestUsers = uas.ToUnorderdList; Videos newestVideos = new Videos(); newestVideos.GetMostRecentVideos(); SongRecords newSongs = new SongRecords(); SongRecord sng1 = null; foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in newestVideos) { sng1 = new SongRecord(v1); newSongs.Add(sng1); } ViewBag.NewestVideos = newSongs.VideosList(); BootBaronLib.AppSpec.DasKlub.BOL.Video vid = new BootBaronLib.AppSpec.DasKlub.BOL.Video(BootBaronLib.AppSpec.DasKlub.BOL.Video.RandomVideoIDVideo()); ViewBag.RandomVideoKey = vid.ProviderKey; ///video submit MultiProperties addList = null; PropertyType propTyp = null; MultiProperties mps = null; // video typesa propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); ViewBag.VideoTypes = mps; // person types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); ViewBag.PersonTypes = mps; //// footage types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); addList = new MultiProperties(); ViewBag.FootageTypes = mps; return View(); }
private void LoadVideo(string videoKey) { ClearInput(); try { vid = new Video("YT", videoKey); litVideo.Text = string.Format( @"<iframe width=""425"" height=""349"" src=""http://www.youtube.com/embed/{0}"" frameborder=""0"" allowfullscreen></iframe>", vid.ProviderKey); txtSecondsIn.Text = vid.Intro.ToString(); txtElasedEnd.Text = vid.LengthFromStart.ToString(); ddlVideoProvider.SelectedValue = vid.ProviderCode; chkEnabled.Checked = vid.IsEnabled; ddlVolumeLevel.SelectedValue = vid.VolumeLevel.ToString(); lblVideoID.Text = vid.VideoID.ToString(); if (vid.VolumeLevel == 0) { ddlVolumeLevel.SelectedValue = "5"; chkEnabled.Checked = true; } var video = new Google.YouTube.Video(); try { var yousettings = new YouTubeRequestSettings("Das Klub", devkey); var yourequest = new YouTubeRequest(yousettings); var url = new Uri("http://gdata.youtube.com/feeds/api/videos/" + videoKey); video = yourequest.Retrieve<Google.YouTube.Video>(url); txtDuration.Text = video.YouTubeEntry.Duration.Seconds; } catch (GDataRequestException) { vid.IsEnabled = false; vid.Update(); litVideo.Text = string.Empty; return; } if (vid.LengthFromStart == 0) { txtElasedEnd.Text = video.YouTubeEntry.Duration.Seconds; } if (vid.LengthFromStart == 0) { txtDuration.Text = video.YouTubeEntry.Duration.Seconds; } txtUserName.Text = video.Uploader; lblVideoID.Text = vid.VideoID.ToString(); txtVideoKey.Text = video.VideoId; // vid type propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP); mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.Name.CompareTo(p2.Name); }); ddlVideoType.DataSource = mps; ddlVideoType.DataTextField = "name"; ddlVideoType.DataValueField = "multiPropertyID"; ddlVideoType.DataBind(); ddlVideoType.Items.Insert(0, new ListItem(selectText)); if (mp.MultiPropertyID != 0) ddlVideoType.SelectedValue = mp.MultiPropertyID.ToString(); // human propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN); mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.Name.CompareTo(p2.Name); }); ddlHumanType.DataSource = mps; ddlHumanType.DataTextField = "name"; ddlHumanType.DataValueField = "multiPropertyID"; ddlHumanType.DataBind(); ddlHumanType.Items.Insert(0, new ListItem(selectText)); if (mp.MultiPropertyID != 0) ddlHumanType.SelectedValue = mp.MultiPropertyID.ToString(); // footage propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG); mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.Name.CompareTo(p2.Name); }); ddlFootageType.DataSource = mps; ddlFootageType.DataTextField = "name"; ddlFootageType.DataValueField = "multiPropertyID"; ddlFootageType.DataBind(); ddlFootageType.Items.Insert(0, new ListItem(selectText)); if (mp.MultiPropertyID != 0) ddlFootageType.SelectedValue = mp.MultiPropertyID.ToString(); // contest var vidInContest = new ContestVideo(); vidInContest.GetContestVideo(vid.VideoID); if (vidInContest.ContestVideoID != 0) { ddlContest.SelectedValue = vidInContest.ContestID.ToString(); } else ddlContest.SelectedValue = unknownValue; var sngs = new Songs(); artsngs = new Songs(); sngs.GetSongsForVideo(vid.VideoID); Artist art = null; var arts = new Artists(); arts.GetAll(); // artists 1 ddlArtist1.DataSource = arts; ddlArtist1.DataTextField = "name"; ddlArtist1.DataValueField = "name"; ddlArtist1.DataBind(); Utilities.General.SortDropDownList(ddlArtist1); ddlArtist1.Items.Insert(0, new ListItem(unknownValue)); // artists 2 ddlArtist2.DataSource = arts; ddlArtist2.DataTextField = "name"; ddlArtist2.DataValueField = "name"; ddlArtist2.DataBind(); Utilities.General.SortDropDownList(ddlArtist2); ddlArtist2.Items.Insert(0, new ListItem(unknownValue)); // artists 3 ddlArtist3.DataSource = arts; ddlArtist3.DataTextField = "name"; ddlArtist3.DataValueField = "name"; ddlArtist3.DataBind(); Utilities.General.SortDropDownList(ddlArtist3); ddlArtist3.Items.Insert(0, new ListItem(unknownValue)); // artists 4 ddlArtist4.DataSource = arts; ddlArtist4.DataTextField = "name"; ddlArtist4.DataValueField = "name"; ddlArtist4.DataBind(); Utilities.General.SortDropDownList(ddlArtist4); ddlArtist4.Items.Insert(0, new ListItem(unknownValue)); // artists 5 ddlArtist5.DataSource = arts; ddlArtist5.DataTextField = "name"; ddlArtist5.DataValueField = "name"; ddlArtist5.DataBind(); Utilities.General.SortDropDownList(ddlArtist5); ddlArtist5.Items.Insert(0, new ListItem(unknownValue)); // artists 6 ddlArtist6.DataSource = arts; ddlArtist6.DataTextField = "name"; ddlArtist6.DataValueField = "name"; ddlArtist6.DataBind(); Utilities.General.SortDropDownList(ddlArtist6); ddlArtist6.Items.Insert(0, new ListItem(unknownValue)); foreach (Song sng in sngs) { if (sng.Name == unknownValue || string.IsNullOrEmpty(sng.Name)) continue; // sngrcd.SongDisplay += art.Name + " - " + sng.Name + " " ; if (sng.RankOrder == 0 || sng.RankOrder == 1) { // song 1 art = new Artist(sng.ArtistID); ddlArtist1.SelectedValue = art.Name; artsngs = new Songs(); artsngs.GetSongsForArtist(art.ArtistID); ddlArtistSongs1.DataSource = artsngs; ddlArtistSongs1.DataTextField = "name"; ddlArtistSongs1.DataValueField = "name"; ddlArtistSongs1.DataBind(); ddlArtistSongs1.Items.Insert(0, new ListItem(unknownValue)); Utilities.General.SortDropDownList(ddlArtistSongs1); ddlArtistSongs1.SelectedValue = sng.Name; } else if (sng.RankOrder == 2) { // song 2 art = new Artist(sng.ArtistID); ddlArtist2.SelectedValue = art.Name; artsngs = new Songs(); artsngs.GetSongsForArtist(art.ArtistID); ddlArtistSongs2.DataSource = artsngs; ddlArtistSongs2.DataTextField = "name"; ddlArtistSongs2.DataValueField = "name"; ddlArtistSongs2.DataBind(); ddlArtistSongs2.Items.Insert(0, new ListItem(unknownValue)); Utilities.General.SortDropDownList(ddlArtistSongs2); ddlArtistSongs2.SelectedValue = sng.Name; } else if (sng.RankOrder == 3) { // song 3 art = new Artist(sng.ArtistID); ddlArtist3.SelectedValue = art.Name; artsngs = new Songs(); artsngs.GetSongsForArtist(art.ArtistID); ddlArtistSongs3.DataSource = artsngs; ddlArtistSongs3.DataTextField = "name"; ddlArtistSongs3.DataValueField = "name"; ddlArtistSongs3.DataBind(); ddlArtistSongs3.Items.Insert(0, new ListItem(unknownValue)); Utilities.General.SortDropDownList(ddlArtistSongs3); ddlArtistSongs3.SelectedValue = sng.Name; } else if (sng.RankOrder == 4) { // song 4 art = new Artist(sng.ArtistID); ddlArtist4.SelectedValue = art.Name; artsngs = new Songs(); artsngs.GetSongsForArtist(art.ArtistID); ddlArtistSongs4.DataSource = artsngs; ddlArtistSongs4.DataTextField = "name"; ddlArtistSongs4.DataValueField = "name"; ddlArtistSongs4.DataBind(); ddlArtistSongs4.Items.Insert(0, new ListItem(unknownValue)); Utilities.General.SortDropDownList(ddlArtistSongs4); ddlArtistSongs4.SelectedValue = sng.Name; } else if (sng.RankOrder == 5) { // song 5 art = new Artist(sng.ArtistID); ddlArtist5.SelectedValue = art.Name; artsngs = new Songs(); artsngs.GetSongsForArtist(art.ArtistID); ddlArtistSongs5.DataSource = artsngs; ddlArtistSongs5.DataTextField = "name"; ddlArtistSongs5.DataValueField = "name"; ddlArtistSongs5.DataBind(); ddlArtistSongs5.Items.Insert(0, new ListItem(unknownValue)); Utilities.General.SortDropDownList(ddlArtistSongs5); ddlArtistSongs5.SelectedValue = sng.Name; } else if (sng.RankOrder == 6) { // song 6 art = new Artist(sng.ArtistID); ddlArtist6.SelectedValue = art.Name; artsngs = new Songs(); artsngs.GetSongsForArtist(art.ArtistID); ddlArtistSongs6.DataSource = artsngs; ddlArtistSongs6.DataTextField = "name"; ddlArtistSongs6.DataValueField = "name"; ddlArtistSongs6.DataBind(); ddlArtistSongs6.Items.Insert(0, new ListItem(unknownValue)); Utilities.General.SortDropDownList(ddlArtistSongs6); ddlArtistSongs6.SelectedValue = sng.Name; } } lblStatus.Text = "OK"; } catch (Exception ex) { lblStatus.Text = ex.Message; } }
private void LoadFilteredVideos(bool isAjax) { int? personType; int? footageType; int? videoType; if (GetFilteredVideos(isAjax, out personType, out footageType, out videoType)) return; //this is ajax // video types var propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP); var mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort((p1, p2) => String.Compare(p1.DisplayName, p2.DisplayName, StringComparison.Ordinal)); var addList = new MultiProperties(); addList.AddRange(mps.Where(mp1 => Videos.HasResults(footageType, mp1.MultiPropertyID, personType))); ViewBag.VideoTypes = addList; // person types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort((p1, p2) => String.Compare(p1.DisplayName, p2.DisplayName, StringComparison.Ordinal)); addList = new MultiProperties(); addList.AddRange(mps.Where(mp1 => Videos.HasResults(footageType, videoType, mp1.MultiPropertyID))); ViewBag.PersonTypes = addList; //// footage types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort((p1, p2) => String.Compare(p1.DisplayName, p2.DisplayName, StringComparison.Ordinal)); addList = new MultiProperties(); addList.AddRange(mps.Where(mp1 => Videos.HasResults(footageType, mp1.MultiPropertyID, personType))); ViewBag.FootageTypes = addList; }
private void LoadFilteredVideos(bool isAjax) { int? personType = null; int? footageType = null; int? videoType = null; if (!string.IsNullOrEmpty( Request.QueryString[SiteEnums.QueryStringNames.videoType.ToString()])) { videoType = Convert.ToInt32( Request.QueryString[SiteEnums.QueryStringNames.videoType.ToString()]); } if (!string.IsNullOrEmpty( Request.QueryString[SiteEnums.QueryStringNames.personType.ToString()])) { personType = Convert.ToInt32( Request.QueryString[SiteEnums.QueryStringNames.personType.ToString()]); } if (!string.IsNullOrEmpty( Request.QueryString[SiteEnums.QueryStringNames.footageType.ToString()])) { footageType = Convert.ToInt32( Request.QueryString[SiteEnums.QueryStringNames.footageType.ToString()]); } toShow.GetListFilter(videoPageNumber, pageSize, personType, footageType, videoType); if(isAjax) return;//this is ajax if (videoPageNumber == 1) { SongRecords sngrcs = new SongRecords(); SongRecord sngrcd = null; foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video vi in toShow) { sngrcd = new SongRecord(vi); sngrcs.Add(sngrcd); } ViewBag.VideosFiltered = sngrcs.VideosPageList(); } MultiProperties addList = null; PropertyType propTyp = null; MultiProperties mps = null; // video types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); addList = new MultiProperties(); foreach (MultiProperty mp1 in mps) { if (Videos.HasResults(footageType, mp1.MultiPropertyID, personType)) { addList.Add(mp1); } } ViewBag.VideoTypes = addList; // person types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); addList = new MultiProperties(); foreach (MultiProperty mp1 in mps) { if (Videos.HasResults( footageType, videoType, mp1.MultiPropertyID )) { addList.Add(mp1); } } ViewBag.PersonTypes = addList; //// footage types propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG); mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.DisplayName.CompareTo(p2.DisplayName); }); addList = new MultiProperties(); foreach (MultiProperty mp1 in mps) { if (Videos.HasResults(footageType, mp1.MultiPropertyID, personType)) { addList.Add(mp1); } } ViewBag.FootageTypes = addList; }
private MultiProperties GetVideoTypes() { var propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP); var mps = new MultiProperties(propTyp.PropertyTypeID); mps.Sort((p1, p2) => String.Compare(p1.DisplayName, p2.DisplayName, StringComparison.Ordinal)); return mps; }