public ActionResult DeleteConfirmed(int id) { Artists artists = db.Artists1.Find(id); db.Artists1.Remove(artists); db.SaveChanges(); return(RedirectToAction("Index")); }
private void AddSongToArtist(string artist, string album, Song song) { if (!Artists.ContainsKey(artist)) { Artists.Add(artist, new Artist(artist)); } Artists[artist].AddSong(album, song); }
/// <summary> /// Adds an artist to the comic book. /// </summary> /// <param name="artistId">The artist ID to add.</param> /// <param name="roleId">The role ID that the artist had on this comic book.</param> public void AddArtist(int artistId, int roleId) { Artists.Add(new ComicBookArtist() { ArtistId = artistId, RoleId = roleId }); }
public void AddArtist(Artist artist, Role role) { Artists.Add(new ComicBookArtist() { Artist = artist, Role = role }); }
public void RestoreFrom(Cache ci) { Clear(); Albums.AddRange(ci.Albums); Artists.AddRange(ci.Artists); Years.AddRange(ci.Years); Geneires.AddRange(ci.Geneires); }
private void FilterArtists() { Artists = GetTrackOrAlbumArtists(true, true).ToList(); if (SelectedArtist == null) { SelectedArtist = Artists.FirstOrDefault(); } }
public Artist(Artists artist) { ID = artist.Id; Name = artist.Name; if (artist.Albums is not null) { Albums = ImmutableList.Create(artist.Albums.Select(album => new Album(album)).ToArray()); } }
public Playlist(Artists artits) { this.GroupName = artits.Items[0].Artists[0].Name; this.Albums = new List <Album>(); foreach (Item album in artits.Items) { this.AddAlbum(new Album(album)); } }
public void LoadArtistsFromDatabase() { Artists.Clear(); LogHelper.Log("Loading artists from MusicDB ..."); var artists = LoadArtists(null); LogHelper.Log("Found " + artists.Count + " artists from MusicDB"); Artists.AddRange(artists.OrderBy(x => x.Name).ToObservable()); }
public async Task Update(Artists data) { if (_db != null) { _db.Artists.Update(data); //Commit the transaction await _db.SaveChangesAsync(); } }
private void PopulateArtists() { Artists.Clear(); foreach (string artist in m_DataModel.Database.Artists) { Artists.Add(new MusicCollectionItem(artist, Artists.Count)); } }
/// <summary> /// Changes Artists ListView sort order. /// </summary> /// <param name="sender"></param> public void SortArtistsView(object sender, ref string lastArtistHeaderClicked, ref ListSortDirection lastArtistDirection) { SortListView(sender, ref lastArtistHeaderClicked, ref lastArtistDirection, "Name"); LastArtistDirectionText = lastArtistDirection == ListSortDirection.Ascending ? "A-Z" : "Z-A"; Artists = (lastArtistDirection == ListSortDirection.Ascending ? Artists.OrderBy(i => i.Name) : Artists.OrderByDescending(i => i.Name)).ToList(); OnPropertyChanged("LastArtistDirectionText"); }
public override void OnNavigatingFrom(NavigatingFromEventArgs e, Dictionary <string, object> viewModelState, bool suspending) { if (e.NavigationMode == NavigationMode.New) { viewModelState[nameof(Artists)] = JsonConvert.SerializeObject(Artists.Take(50), _lastImageSetConverter); } base.OnNavigatingFrom(e, viewModelState, suspending); }
/// <summary> /// Checks whether this album has a specific artist. /// </summary> /// <param name="artist">Artist to be checked. Can be null.</param> /// <returns>True if the artist has this album or artist was null. Otherwise false.</returns> public virtual bool HasArtist(Artist artist) { if (artist == null) { return(false); } return(Artists.Any(a => artist.Equals(a.Artist))); }
public ArtistDTO GetById(long id) { using (MusicStoreContext db = new MusicStoreContext()) { Artists record = new Artists(); record = db.Artists.Where(x => x.ArtistID == id).FirstOrDefault(); return(_mapper.Map <ArtistDTO>(record)); } }
public CreateAlbumContract ToContract() { return(new CreateAlbumContract { Artists = Artists.ToArray(), DiscType = DiscType, Names = LocalizedStringHelper.SkipNullAndEmpty(NameOriginal, NameRomaji, NameEnglish).ToArray() }); }
public async Task <List <Track> > AllTracksArtist(Artists artists, int nbMusicChoosen) { Tracks allTracks = new Tracks(); foreach (Artist artist in artists.data) { string response = await apiConnect.GetAsJsonAsync("https://api.deezer.com/artist/" + artist.id + "/albums?limit=1000"); Albums albums = JsonConvert.DeserializeObject <Albums>(response); List <string> allTitle = new List <string>(); foreach (Album album in albums.data) { allTitle.Add(album.title); } foreach (string title in allTitle) { int count = 0; foreach (Album album in albums.data.ToList()) { if (album.title.Contains(title)) { count++; if (count > 1) { albums.data.Remove(album); } } } } Tracks tracksArtist = await StoreAllTracks(albums); allTracks.data.AddRange(tracksArtist.data); } Tracks tracks = new Tracks(); int countTotal = nbMusicChoosen; if (allTracks.data.Count < nbMusicChoosen) { countTotal = allTracks.data.Count; } for (int i = 0; i < countTotal; i++) { bool action = false; while (!action) { Random rnd = new Random(); int index = rnd.Next(allTracks.data.Count); if (!tracks.data.Contains(allTracks.data[index]) && allTracks.data[index].readable == true) { tracks.data.Add(allTracks.data[index]); action = true; } } } return(tracks.data); }
// // GET: /Default1/Delete/5 public ActionResult Delete(int id = 0) { Artists artists = db.ArtistsDbSet.Find(id); if (artists == null) { return(HttpNotFound()); } return(View(artists)); }
public ActionResult Edit([Bind(Include = "ArtistID,Artist,description,years_active")] Artists artists) { if (ModelState.IsValid) { db.Entry(artists).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(artists)); }
protected override void RemoveArtistsFromFavourites(object sender, EventArgs e) { Favourites ch = (Favourites)sender; Artists a = (Artists)ch.DataContext; using (var session = NHibernateHelper.OpenSession()) { db.RemoveArtistFromFavourites(a, session); } }
public ActionResult Show(int artistId) { Artists artists = Artists.Find(artistId); Dictionary <string, object> artistRecords = new Dictionary <string, object>(); List <Records> records = artists.Records; artistRecords.Add("artists", artists); artistRecords.Add("records", records); return(View(artistRecords)); }
public ActionResult UnFollow(Artists artist) { UserData u = new UserData(); u.Username = "******"; var single = u.FollowArtist.Find(id => id == artist); u.FollowArtist.Remove(single); return(View("Following", u)); }
public void DeleteSongArtist(int id) { var artist = Artists.SingleOrDefault(x => x.Id == id); if (artist != null) { Artists.Remove(artist); } this.SaveChanges(); }
public ActionResult Show(int artistId, int recordId) { Records records = Records.Find(recordId); Artists artist = Artists.Find(artistId); Dictionary <string, object> model = new Dictionary <string, object>(); model.Add("records", records); model.Add("artists", artist); return(View(model)); }
public void AddArtists(List <TemplateArtist> artists, List <BonusType> artistBonuses) { foreach (TemplateArtist artist in artists) { var gameArtist = new GameArtist(artist); gameArtist.DiscoverBonus = artistBonuses[0]; artistBonuses.RemoveAt(0); Artists.Add(gameArtist); } }
public void PopulateOptionLists() { Groupings = Artists.Select(a => a.Grouping).Distinct().OrderBy(g => g).ToList(); Genres = Artists.Select(a => a.Genre).Distinct().OrderBy(g => g).ToList(); _usedCities = Artists.Select(a => a.City).Where(c => c != null).Distinct().ToList(); Countries = _usedCities.Select(c => c.Country).Distinct().OrderBy(c => c).ToList(); }
public ActionResult Edit(Artists artists) { if (ModelState.IsValid) { db.Entry(artists).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(artists)); }
public void SongsAdded(IEnumerable <Song> songs) { foreach (var s in songs) { Albums.Add(s.Album); Artists.Add(s.Artist); Years.Add(s.Year.ToString()); Geneires.Add(s.Genre); } }
public Artist Get(string artistName) { Artist artist; if (!Artists.TryGetValue(artistName.ToLower(), out artist)) { return(null); } return(artist); }
private async void LoadArtists() { var artists = await App.SongRepo.GetArtistsPaged(Artists.Count); foreach (var artist in artists) { Artists.Add(artist); Debug.WriteLine("Added: " + artist.Artist); } }
public static string InsertBandLinks(string input, bool enforceCase) { if (string.IsNullOrEmpty(input)) return string.Empty; if (!enforceCase) { return InsertBandLinks(input); } var arts = new Artists(); arts.GetAll(); return arts.Where(a1 => !a1.IsHidden) .Aggregate(input, (current, a1) => current.Replace(a1.Name, a1.HyperLinkToArtist)); }
/// protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { Artists arts = new Artists(); arts.GetAll(); // artists 1 ddlArtist1.DataSource = arts; ddlArtist1.DataTextField = "name"; ddlArtist1.DataValueField = "name"; ddlArtist1.DataBind(); ddlArtist1.Items.Insert(0, new ListItem(unknownValue)); Utilities.General.SortDropDownList(ddlArtist1); } artst = new Artist(ddlArtist1.SelectedValue); sng = new Song(artst.ArtistID, ddlArtistSongs1.SelectedValue); }
/// <summary> /// Gets the artists callback. /// </summary> /// <param name="requestState">State of the request.</param> private void GetArtistsCallback(XRequestState requestState) { var artists = new Artists(); var query = JObject.Parse(requestState.ResponseData); if(XHelpers.CheckResponseForError(query,out mError)) { } else { var result = (JObject) query["result"]; artists.LoadFromJsonObject(result, false); if (requestState.UserCallback != null) requestState.UserCallback(artists); } }
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(); }
private void GetArtistsPageWise(int pageIndex) { arts = new Artists(); int recordCount = arts.GetArtistsPageWise(pageIndex, Convert.ToInt32(ddlPageSize.SelectedValue)); gvwAllArtists.DataSource = arts; gvwAllArtists.DataBind(); PopulatePager(recordCount, pageIndex); }
public List<Artist> Get(Artists request) { return Db.Select<Artist>().ToList(); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { ddlTourDate.DataSource = Venues.GetDateVenues(); ddlTourDate.DataTextField = "datevenue"; ddlTourDate.DataValueField = "eventID"; ddlTourDate.DataBind(); ddlTourDate.Items.Insert(0, new ListItem(unknownValue)); // Utilities.General.SortDropDownList(ddlTourDate); /// Artists arts = new Artists(); arts.GetAll(); // artists 1 ddlArtist1.DataSource = arts; ddlArtist1.DataTextField = "name"; ddlArtist1.DataValueField = "name"; ddlArtist1.DataBind(); ddlArtist1.Items.Insert(0, new ListItem(unknownValue)); Utilities.General.SortDropDownList(ddlArtist1); // artists 2 ddlArtist2.DataSource = arts; ddlArtist2.DataTextField = "name"; ddlArtist2.DataValueField = "name"; ddlArtist2.DataBind(); ddlArtist2.Items.Insert(0, new ListItem(unknownValue)); Utilities.General.SortDropDownList(ddlArtist2); // artists 3 ddlArtist3.DataSource = arts; ddlArtist3.DataTextField = "name"; ddlArtist3.DataValueField = "name"; ddlArtist3.DataBind(); ddlArtist3.Items.Insert(0, new ListItem(unknownValue)); Utilities.General.SortDropDownList(ddlArtist3); } }
public static string InsertBandLinks(string input, bool enforceCase) { if (string.IsNullOrEmpty(input)) return string.Empty; if (!enforceCase) { return InsertBandLinks(input); } else { Artists arts = new Artists(); arts.GetAll(); foreach (Artist a1 in arts) { if (a1.IsHidden) continue; input = input.Replace(a1.Name, a1.HyperLinkToArtist); //if (!string.IsNullOrEmpty(a1.Name)) //{ // input = input.Replace(a1.Name, a1.HyperLinkToArtist); //} //else //{ // input = input.Replace(a1.Name, a1.HyperLinkToArtist); //} } return input; } }
protected void Page_Load(object sender, EventArgs e) { Response.Clear(); Response.ContentType = "text/xml"; XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Encoding.UTF8); writer.WriteStartDocument(); writer.WriteStartElement("urlset"); writer.WriteAttributeString("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9"); writer.WriteString("\r\n"); //newline // home writer.WriteStartElement("url"); writer.WriteElementString("loc", "http://DasKlub.com/"); writer.WriteElementString("lastmod", String.Format("{0:yyyy-MM-dd}", DateTime.UtcNow)); writer.WriteElementString("changefreq", "weekly"); writer.WriteElementString("priority", "1.0"); writer.WriteEndElement(); writer.WriteString("\r\n"); //newline Artists artis = new Artists(); artis.GetAll(); foreach (BootBaronLib.AppSpec.DasKlub.BOL.ArtistContent.Artist app in artis) { writer.WriteStartElement("url"); writer.WriteElementString("loc", "http://DasKlub.com/" + app.URLOfArtist); writer.WriteElementString("lastmod", String.Format("{0:yyyy-MM-dd}", app.UpdateDate)); writer.WriteElementString("changefreq", "weekly"); writer.WriteElementString("priority", "0.8"); writer.WriteEndElement(); writer.WriteString("\r\n"); //newline } ArrayList userAccounts = Videos.GetDistinctUsers(); foreach (string app in userAccounts) { writer.WriteStartElement("url"); writer.WriteElementString("loc", "http://DasKlub.com/" + app); writer.WriteElementString("lastmod", String.Format("{0:yyyy-MM-dd}", DateTime.UtcNow)); writer.WriteElementString("changefreq", "weekly"); writer.WriteElementString("priority", "0.7"); writer.WriteEndElement(); writer.WriteString("\r\n"); //newline } // users UserAccounts uas = new UserAccounts(); uas.GetAll(); foreach (UserAccount ua1 in uas) { //foreach (string a1 in userAccounts) //{ // if (a1 == ua1.UserName) continue;// already added as a video writer.WriteStartElement("url"); writer.WriteElementString("loc", "http://DasKlub.com/" + ua1.UserName.Replace(" ", "-")); writer.WriteElementString("lastmod", String.Format("{0:yyyy-MM-dd}", ua1.LastActivityDate)); writer.WriteElementString("changefreq", "weekly"); writer.WriteElementString("priority", "0.7"); writer.WriteEndElement(); writer.WriteString("\r\n"); //newline //} } /// content Contents cnts = new Contents(); cnts.GetAllActiveContent(); foreach (BootBaronLib.AppSpec.DasKlub.BOL.UserContent.Content c1 in cnts) { //foreach (string a1 in userAccounts) //{ // if (a1 == ua1.UserName) continue;// already added as a video writer.WriteStartElement("url"); writer.WriteElementString("loc", "http://DasKlub.com/news/" + c1.ContentKey); writer.WriteElementString("lastmod", String.Format("{0:yyyy-MM-dd}", c1.ReleaseDate)); writer.WriteElementString("changefreq", "weekly"); writer.WriteElementString("priority", "0.8"); writer.WriteEndElement(); writer.WriteString("\r\n"); //newline //} } writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); Response.End(); }
/// <summary> /// There are no comments for Artists in the schema. /// </summary> public void AddToArtists(Artists artists) { base.AddObject("Artists", artists); }
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(); }
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; } }
/// <summary> /// Create a new Artists object. /// </summary> /// <param name="ID">Initial value of Id.</param> /// <param name="artistName">Initial value of ArtistName.</param> public static Artists CreateArtists(int ID, string artistName) { Artists artists = new Artists(); artists.Id = ID; artists.ArtistName = artistName; return artists; }