protected void btnReject_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hfVideoRequestID.Value)) { vidreq = new VideoRequest(Convert.ToInt32(hfVideoRequestID.Value)); vidreq.StatusType = 'R'; vidreq.Update(); lblStatus.Text = "Video rejected"; LoadGrid(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { var allartsis = new Artists(); allartsis.RemoveCache(); if (gvwRequestedVideos.SelectedDataKey != null) { vidreq = new VideoRequest(Convert.ToInt32(gvwRequestedVideos.SelectedDataKey.Value)) { StatusType = 'A' }; vidreq.Update(); } vid = new Video("YT", txtVideoKey.Text) { Duration = (float) Convert.ToDouble(txtDuration.Text), Intro = (float) Convert.ToDouble(txtSecondsIn.Text), LengthFromStart = (float) Convert.ToDouble(txtElasedEnd.Text), ProviderCode = ddlVideoProvider.SelectedValue, ProviderUserKey = txtUserName.Text, VolumeLevel = Convert.ToInt32(ddlVolumeLevel.SelectedValue), IsEnabled = chkEnabled.Checked, EnableTrim = chkEnabled.Checked }; // vid.IsHidden = chkHidden.Checked; /// publish date var yousettings = new YouTubeRequestSettings("Das Klub", devkey); var yourequest = new YouTubeRequest(yousettings); var Url = new Uri("http://gdata.youtube.com/feeds/api/videos/" + vid.ProviderKey); var video = new Google.YouTube.Video(); video = yourequest.Retrieve<Google.YouTube.Video>(Url); vid.PublishDate = video.YouTubeEntry.Published; if (vid.VideoID == 0) { vid.Create(); } else vid.Update(); // if there is a contest, add it now since there is an id if (ddlContest.SelectedValue != unknownValue) { //TODO: check if it already is in the contest ContestVideo.DeleteVideoFromAllContests(vid.VideoID); var cv = new ContestVideo(); cv.ContestID = Convert.ToInt32(ddlContest.SelectedValue); cv.VideoID = vid.VideoID; cv.Create(); } else { // TODO: JUST REMOVE FROM CURRENT CONTEST, NOT ALL ContestVideo.DeleteVideoFromAllContests(vid.VideoID); } // vid type if (!string.IsNullOrWhiteSpace(ddlVideoType.SelectedValue) && ddlVideoType.SelectedValue != selectText) { propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP); mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID); mp.RemoveCache(); MultiPropertyVideo.AddMultiPropertyVideo( Convert.ToInt32( ddlVideoType.SelectedValue), vid.VideoID); } // human if (!string.IsNullOrWhiteSpace(ddlHumanType.SelectedValue) && ddlHumanType.SelectedValue != selectText) { propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN); mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID); mp.RemoveCache(); MultiPropertyVideo.AddMultiPropertyVideo( Convert.ToInt32( ddlHumanType.SelectedValue), vid.VideoID); } // footage if (!string.IsNullOrWhiteSpace(ddlFootageType.SelectedValue) && ddlFootageType.SelectedValue != selectText) { propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG); mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID); mp.RemoveCache(); MultiPropertyVideo.AddMultiPropertyVideo( Convert.ToInt32( ddlFootageType.SelectedValue), vid.VideoID); } VideoSong.DeleteSongsForVideo(vid.VideoID); // song 1 artst = string.IsNullOrEmpty(txtArtist1.Text.Trim()) ? new Artist(ddlArtist1.SelectedValue) : new Artist(txtArtist1.Text); if (artst.ArtistID == 0) { artst.AltName = FromString.UrlKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong1.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs1.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong1.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.UrlKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 1); // song 2 if ((ddlArtist2.SelectedValue != unknownValue && !string.IsNullOrEmpty(ddlArtist2.SelectedValue)) || !string.IsNullOrEmpty(txtArtist2.Text)) { artst = null; sng = null; if (string.IsNullOrEmpty(txtArtist2.Text.Trim())) { artst = new Artist(ddlArtist2.SelectedValue); } else { artst = new Artist(txtArtist2.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.UrlKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong2.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs2.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong2.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.UrlKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 2); if ((ddlArtist3.SelectedValue != unknownValue && !string.IsNullOrEmpty(ddlArtist3.SelectedValue)) || !string.IsNullOrEmpty(txtArtist3.Text)) { // song 3 artst = null; sng = null; if (string.IsNullOrEmpty(txtArtist3.Text)) { artst = new Artist(ddlArtist3.SelectedValue); } else { artst = new Artist(txtArtist3.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.UrlKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong3.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs3.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong3.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.UrlKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 3); if ((ddlArtist4.SelectedValue != unknownValue && !string.IsNullOrEmpty(ddlArtist4.SelectedValue)) || !string.IsNullOrEmpty(txtArtist4.Text)) { // song 4 artst = null; sng = null; if (string.IsNullOrEmpty(txtArtist4.Text)) { artst = new Artist(ddlArtist4.SelectedValue); } else { artst = new Artist(txtArtist4.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.UrlKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong4.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs4.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong4.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.UrlKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 4); if ((ddlArtist5.SelectedValue != unknownValue && !string.IsNullOrEmpty(ddlArtist5.SelectedValue)) || !string.IsNullOrEmpty(txtArtist5.Text)) { // song 5 artst = null; sng = null; if (string.IsNullOrEmpty(txtArtist5.Text)) { artst = new Artist(ddlArtist5.SelectedValue); } else { artst = new Artist(txtArtist5.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.UrlKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong5.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs5.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong5.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.UrlKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 5); if ((ddlArtist6.SelectedValue != unknownValue && !string.IsNullOrEmpty(ddlArtist6.SelectedValue)) || !string.IsNullOrEmpty(txtArtist6.Text)) { // song 6 artst = null; sng = null; if (string.IsNullOrEmpty(txtArtist6.Text)) { artst = new Artist(ddlArtist6.SelectedValue); } else { artst = new Artist(txtArtist6.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.UrlKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong6.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs6.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong6.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.UrlKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 6); } } } } } // RefreshLists(); lblStatus.Text = "OK"; } catch (Exception ex) { lblStatus.Text = ex.Message; } LoadGrid(); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { //IDictionaryEnumerator enumerator = HttpContext.Current.Cache.GetEnumerator(); //while (enumerator.MoveNext()) //{ // HttpContext.Current.Cache.Remove(enumerator.Key.ToString()); //} Artists allartsis = new Artists(); allartsis.RemoveCache(); if (gvwRequestedVideos.SelectedDataKey != null) { vidreq = new VideoRequest(Convert.ToInt32(gvwRequestedVideos.SelectedDataKey.Value)); vidreq.StatusType = 'A'; vidreq.Update(); } vid = new BootBaronLib.AppSpec.DasKlub.BOL.Video("YT", txtVideoKey.Text); vid.Duration = (float)Convert.ToDouble(txtDuration.Text); vid.Intro = (float)Convert.ToDouble(txtSecondsIn.Text); vid.LengthFromStart = (float)Convert.ToDouble(txtElasedEnd.Text); vid.ProviderCode = ddlVideoProvider.SelectedValue; vid.ProviderUserKey = txtUserName.Text; vid.VolumeLevel = Convert.ToInt32(ddlVolumeLevel.SelectedValue); vid.IsEnabled = chkEnabled.Checked; // vid.IsHidden = chkHidden.Checked; vid.EnableTrim = chkEnabled.Checked; /// publish date YouTubeRequestSettings yousettings = new YouTubeRequestSettings("You Manager", devkey, username, password); YouTubeRequest yourequest; Uri Url; Google.YouTube.Video video; yourequest = new YouTubeRequest(yousettings); Url = new Uri("http://gdata.youtube.com/feeds/api/videos/" + vid.ProviderKey); video = new Google.YouTube.Video(); video = yourequest.Retrieve<Google.YouTube.Video>(Url); vid.PublishDate = video.YouTubeEntry.Published; if (vid.VideoID == 0) { vid.Create(); } else vid.Update(); // if there is a contest, add it now since there is an id if (ddlContest.SelectedValue != unknownValue) { //TODO: check if it already is in the contest ContestVideo.DeleteVideoFromAllContests(vid.VideoID); ContestVideo cv = new ContestVideo(); cv.ContestID = Convert.ToInt32(ddlContest.SelectedValue); cv.VideoID = vid.VideoID; cv.Create(); } else { // TODO: JUST REMOVE FROM CURRENT CONTEST, NOT ALL ContestVideo.DeleteVideoFromAllContests(vid.VideoID); } // vid type if (!string.IsNullOrWhiteSpace(this.ddlVideoType.SelectedValue) && this.ddlVideoType.SelectedValue != selectText) { propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP); mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID); mp.RemoveCache(); MultiPropertyVideo.AddMultiPropertyVideo( Convert.ToInt32( ddlVideoType.SelectedValue), vid.VideoID); } // human if (!string.IsNullOrWhiteSpace(this.ddlHumanType.SelectedValue) && this.ddlHumanType.SelectedValue != selectText) { propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN); mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID); mp.RemoveCache(); MultiPropertyVideo.AddMultiPropertyVideo( Convert.ToInt32( ddlHumanType.SelectedValue), vid.VideoID); } // footage if (!string.IsNullOrWhiteSpace(this.ddlFootageType.SelectedValue) && this.ddlFootageType.SelectedValue != selectText) { propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG); mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID); mp.RemoveCache(); MultiPropertyVideo.AddMultiPropertyVideo( Convert.ToInt32( ddlFootageType.SelectedValue), vid.VideoID); } //// guitar //if (!string.IsNullOrWhiteSpace(this.ddlGuitarType.SelectedValue) // && this.ddlGuitarType.SelectedValue != selectText) //{ // propTyp = new PropertyType(SiteEnums.PropertyTypeCode.GUITR); // mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); // MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID); // mp.RemoveCache(); // MultiPropertyVideo.AddMultiPropertyVideo( // Convert.ToInt32(ddlGuitarType.SelectedValue), vid.VideoID); //} //// Language //if (!string.IsNullOrWhiteSpace(this.ddlLanguage.SelectedValue) // && this.ddlLanguage.SelectedValue != selectText) //{ // propTyp = new PropertyType(SiteEnums.PropertyTypeCode.LANGE); // mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); // MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID); // mp.RemoveCache(); // MultiPropertyVideo.AddMultiPropertyVideo( // Convert.ToInt32(ddlLanguage.SelectedValue), vid.VideoID); //} //// genre //if (!string.IsNullOrWhiteSpace(this.ddlGenre.SelectedValue) // && this.ddlGenre.SelectedValue != selectText) //{ // propTyp = new PropertyType(SiteEnums.PropertyTypeCode.GENRE); // mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); // MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID); // mp.RemoveCache(); // MultiPropertyVideo.AddMultiPropertyVideo( // Convert.ToInt32(ddlGenre.SelectedValue), vid.VideoID); //} //// difficulty //if (!string.IsNullOrWhiteSpace(this.ddlDifficultyLevel.SelectedValue) // && this.ddlDifficultyLevel.SelectedValue != selectText) //{ // propTyp = new PropertyType(SiteEnums.PropertyTypeCode.DIFFC); // mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO); // MultiPropertyVideo.DeleteMultiPropertyVideo(mp.MultiPropertyID, vid.VideoID); // mp.RemoveCache(); // MultiPropertyVideo.AddMultiPropertyVideo( // Convert.ToInt32(this.ddlDifficultyLevel.SelectedValue), vid.VideoID); //} VideoSong.DeleteSongsForVideo(vid.VideoID); // song 1 if (string.IsNullOrEmpty(txtArtist1.Text.Trim())) { artst = new Artist(ddlArtist1.SelectedValue); } else { artst = new Artist(txtArtist1.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.URLKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong1.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs1.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong1.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.URLKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 1); // song 2 if ((ddlArtist2.SelectedValue != unknownValue && !string.IsNullOrEmpty(ddlArtist2.SelectedValue)) || !string.IsNullOrEmpty(txtArtist2.Text)) { artst = null; sng = null; if (string.IsNullOrEmpty(txtArtist2.Text.Trim())) { artst = new Artist(ddlArtist2.SelectedValue); } else { artst = new Artist(txtArtist2.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.URLKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong2.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs2.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong2.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.URLKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 2); if ((ddlArtist3.SelectedValue != unknownValue && !string.IsNullOrEmpty(ddlArtist3.SelectedValue)) || !string.IsNullOrEmpty(txtArtist3.Text)) { // song 3 artst = null; sng = null; if (string.IsNullOrEmpty(txtArtist3.Text)) { artst = new Artist(ddlArtist3.SelectedValue); } else { artst = new Artist(txtArtist3.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.URLKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong3.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs3.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong3.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.URLKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 3); if ((ddlArtist4.SelectedValue != unknownValue && !string.IsNullOrEmpty(ddlArtist4.SelectedValue)) || !string.IsNullOrEmpty(txtArtist4.Text)) { // song 4 artst = null; sng = null; if (string.IsNullOrEmpty(txtArtist4.Text)) { artst = new Artist(ddlArtist4.SelectedValue); } else { artst = new Artist(txtArtist4.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.URLKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong4.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs4.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong4.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.URLKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 4); if ((ddlArtist5.SelectedValue != unknownValue && !string.IsNullOrEmpty(ddlArtist5.SelectedValue)) || !string.IsNullOrEmpty(txtArtist5.Text)) { // song 5 artst = null; sng = null; if (string.IsNullOrEmpty(txtArtist5.Text)) { artst = new Artist(ddlArtist5.SelectedValue); } else { artst = new Artist(txtArtist5.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.URLKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong5.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs5.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong5.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.URLKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 5); if ((ddlArtist6.SelectedValue != unknownValue && !string.IsNullOrEmpty(ddlArtist6.SelectedValue)) || !string.IsNullOrEmpty(txtArtist6.Text)) { // song 6 artst = null; sng = null; if (string.IsNullOrEmpty(txtArtist6.Text)) { artst = new Artist(ddlArtist6.SelectedValue); } else { artst = new Artist(txtArtist6.Text); } if (artst.ArtistID == 0) { artst.AltName = FromString.URLKey(artst.Name); artst.Create(); } if (string.IsNullOrEmpty(txtArtistSong6.Text)) { sng = new Song(artst.ArtistID, ddlArtistSongs6.SelectedValue); } else { sng = new Song(artst.ArtistID, txtArtistSong6.Text); } if (sng.SongID == 0) { sng.SongKey = FromString.URLKey(sng.Name); sng.Create(); } VideoSong.AddVideoSong(sng.SongID, vid.VideoID, 6); } } } } } // RefreshLists(); lblStatus.Text = "OK"; } catch (Exception ex) { lblStatus.Text = ex.Message; } LoadGrid(); }