public async Task <ArtistList> ListAsync(int pageIndex, int pageSize, PublishStatus statusFlags = PublishStatus.PUBLISHED) { pageSize = Math.Min(pageSize, _maxPageSize); ArtistList result = new ArtistList() { PageIndex = pageIndex, PageSize = pageSize, TotalItems = 0 }; PublishedStatusEnumMapper statusMapper = new PublishedStatusEnumMapper(); DbPublishedStatus contentStatusFlags = statusMapper.Map(statusFlags); var artistsQuery = this._context.Artists.AsQueryable(); // bitwise & the status flags and check the result is not 0 to get any records matching flags artistsQuery = artistsQuery.Where(a => (a.PublishStatus & contentStatusFlags) != 0); int totalRecords = await artistsQuery.CountAsync(); artistsQuery = artistsQuery.Skip(pageSize * pageIndex).Take(pageSize); var dbArtists = await artistsQuery .Include(x => x.ArtistGenres) .ThenInclude(x => x.Genre) .ToListAsync(); result.TotalItems = totalRecords; result.Items = dbArtists.Select(a => _mapper.MapToDetailRep(a)).ToList(); return(result); }
internal void ChangeSort(string p) { int sum = 0; var artists = ArtistList.ToList(); var list = new List <ArtistViewModel>(); switch (p) { case "Name": ArtistList.Clear(); foreach (var artist in artists) { list.AddRange(artist); } var grouped = GroupedItem <ArtistViewModel> .CreateGroupsByAlpha(list); foreach (var item in grouped) { ArtistList.Add(new GroupedItem <ArtistViewModel>(item.Key, item)); sum += item.Sum(x => x.SongsCount); } ArtistsCount = SmartFormat.Smart.Format(Consts.Localizer.GetString("SmartArtists"), artists.Count); SongsCount = SmartFormat.Smart.Format(Consts.Localizer.GetString("SmartSongs"), sum); break; default: break; } }
protected void LoadArtistList() { // user friendly error handling (aka try/catch) //use the usercontrol MessageUserControl to manage the // error handling for the web page when control // leaves the web page and goes to the class library MessageUserControl.TryRun(() => { //what goes inside the coding block? //your code that would normally be inside the try portion of a try/catch ArtistController sysmgr = new ArtistController(); List <SelectionList> info = sysmgr.Artists_DDLList(); //let's assume the data collection needs to be sorted info.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //setup the ddl ArtistList.DataSource = info; //ArtistList.DataTextField = "DisplayField"; ArtistList.DataTextField = nameof(SelectionList.DisplayField); ArtistList.DataValueField = nameof(SelectionList.ValueField); ArtistList.DataBind(); //setup of a prompt line ArtistList.Items.Insert(0, new ListItem("select ...", "0")); }, "Success title message", "the succes title and body message are optional"); }
private void ArtistList_ItemClick(object sender, ItemClickEventArgs e) { ArtistList.PrepareConnectedAnimation(Consts.ArtistPageInAnimation, e.ClickedItem, "ArtistName"); LibraryPage.Current.Navigate(typeof(ArtistPage), (e.ClickedItem as ArtistViewModel)); _clickedArtist = e.ClickedItem as ArtistViewModel; }
private static void DisplayArtists(ArtistList artists) { foreach (var a in artists) { var s = a.LifeSpan; Console.WriteLine(" {0} - {1} {2}", s.Begin.ToShortDate(), s.End.ToShortDate(), a.Name); } }
public void Setup() { QueryHelper = new QueryHelper(); Data = new TestData(QueryHelper); Session = new TestSession(); List = new ArtistList { Session = Session }; }
public void FirstLetterFilter(Object obj) { ArtistList.Clear(); ObservableCollection <ArtistModel> listTmp = DataAccess.GetArtistList(TypeList, obj.ToString()); foreach (var tmp in listTmp) { ArtistList.Add(tmp); } }
public async Task <int> CreateArtistList(ArtistList entity) { using (var connection = ConnectionFactory.GetConnection()) { connection.Set <Song>().Attach(entity.Song); connection.Set <Artist>().Attach(entity.Artist); connection.Set <ArtistList>().Add(entity); return(await connection.SaveChangesAsync()); } }
private void SemanticZoom_ViewChangeCompleted(object sender, SemanticZoomViewChangedEventArgs e) { var zoom = sender as SemanticZoom; if (zoom.IsZoomedInViewActive) { var scroller = ArtistList.GetScrollViewer(); scroller.ChangeView(null, scroller.VerticalOffset - 120, null); } }
//public void EditDetails() //{ // _ArtistDialog.SetDetails(this); // _TotalValue = _WorksList.GetTotalValue(); //} public void NewArtist() { if (!string.IsNullOrEmpty(Name)) { ArtistList.Add(Name, this); } else { throw new Exception("No artist name entered"); } }
protected void BindArtistList() { ArtistController sysmgr = new ArtistController(); List <Artist> info = sysmgr.Artist_List(); info.Sort((x, y) => x.Name.CompareTo(y.Name)); ArtistList.DataSource = info; ArtistList.DataTextField = nameof(Artist.Name); ArtistList.DataValueField = nameof(Artist.ArtistId); ArtistList.DataBind(); //ArtistList.Items.Insert(0, "select ..."); }
private void GenerateTree(String artistName) { //Going to separate artists based on the genres used to describe them. //Assume that the first artist is what we're pivoting on. if (NodeDictionary.ContainsKey(artistName)) { return; } ArtistList rootArtistList = Client.GetArtist(artistName); //TODO: Using the first one for now. Since there could be multiple roots, we'll need to handle this. Artist rootArtist = rootArtistList.Artists.Items[0]; ArtistViewModel rootViewModel = new ArtistViewModel(rootArtist); HierarchyNode root = new HierarchyNode(rootViewModel, null, 0); RootNodes.Add(root); rootViewModel.SetHierarchyNode(root); NodeDictionary.Add(rootArtist.Name, root); ArtistGroup relatedArtistList = Client.GetRelatedArtists(rootArtist.ID); //First determine which artists are new; add those. List <Artist> newArtists = new List <Artist>(); int nodesAdded = 0; foreach (Artist relatedArtist in relatedArtistList.Artists) { if (NodeDictionary.ContainsKey(relatedArtist.Name)) { continue; } if (nodesAdded < MaxChildren) { newArtists.Add(relatedArtist); ArtistViewModel artistViewModel = new ArtistViewModel(relatedArtist); HierarchyNode relatedArtistNode = new HierarchyNode(artistViewModel, root, 1); root.Children.Add(relatedArtistNode); artistViewModel.SetHierarchyNode(relatedArtistNode); NodeDictionary.Add(relatedArtist.Name, relatedArtistNode); nodesAdded++; } else { break; } } }
public async Task <IActionResult> List([FromQuery] int page = 0, [FromQuery] int pageSize = 20) { try{ ArtistList result = await _repo.ListAsync(page, pageSize, PublishStatus.PUBLISHED); return(Ok(result)); }catch (EntityNotFoundRepositoryException e) { return(NotFound(new ApiErrorRep(e.Message))); }catch (Exception e) { _logger.LogError("ListArtist", e, "Error listing artists"); return(StatusCode(500, new ApiErrorRep("Unknown error"))); } }
protected void BindArtistList() { ArtistController controller = new ArtistController(); List <Artist> artistList = controller.Artist_List(); artistList.Sort((x, y) => x.Name.CompareTo(y.Name)); ArtistList.DataSource = artistList; ArtistList.DataTextField = nameof(Artist.Name); ArtistList.DataValueField = nameof(Artist.ArtistId); ArtistList.DataBind(); //ArtistList.Items.Insert(0, "Select"); }
protected void BindArtistList() { MessageUserControl.TryRun(() => { ArtistController sysmgr = new ArtistController(); List <Artist> info = sysmgr.Artist_List(); info.Sort((x, y) => x.Name.CompareTo(y.Name)); ArtistList.DataSource = info; ArtistList.DataTextField = nameof(Artist.Name); ArtistList.DataValueField = nameof(Artist.ArtistId); ArtistList.DataBind(); }); }
public virtual void UpdateArtistString() { var producers = ArtistList.Where(a => a.ArtistType == ArtistType.Producer).Select(m => m.Name); var performers = ArtistList.Where(a => a.ArtistType == ArtistType.Performer).Select(m => m.Name); if (producers.Any() && performers.Any()) { ArtistString = string.Format("{0} feat. {1}", string.Join(", ", producers), string.Join(", ", performers)); } else { ArtistString = string.Join(", ", ArtistList.Select(m => m.Name)); } }
protected void BindArtistList() { ArtistController sysmgr = new ArtistController(); List <Artist> info = sysmgr.ArtistList(); info.Sort((x, y) => x.Name.CompareTo(y.Name)); //Ascending //For Descending, it will be: //info.Sort((x, y) => y.Name.CompareTo(x.Name)); ArtistList.DataSource = info; ArtistList.DataTextField = nameof(Artist.Name); ArtistList.DataValueField = nameof(Artist.ArtistId); //Previously we used to do "ArtistId" but this will make sure the spelling here is correct] ArtistList.DataBind(); //ArtistList.Items.Insert(0, "Select ..."); }
protected void BindArtistList() { //connect to your controller class ArtistController sysmgr = new ArtistController(); List <Artist> info = sysmgr.Artist_List(); info.Sort((x, y) => x.Name.CompareTo(y.Name)); //if you want descending, you must swap the y.name.compareto(x.Name)... ArtistList.DataSource = info; ArtistList.DataTextField = nameof(Artist.Name); ArtistList.DataValueField = nameof(Artist.ArtistId); //this nameof thingy helps you with spelling ArtistList.DataBind(); //ArtistList.Items.Insert(0, "Select..."); }
public FullPlayerArtistPage() { InitializeComponent(); NavigationCacheMode = NavigationCacheMode.Required; ViewModel = new FullPlayerArtistViewModel(); Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>( h => MultiPanePanel.WidthPercentChanged += h, h => MultiPanePanel.WidthPercentChanged -= h) .Select(x => x.EventArgs) .Subscribe(ViewModel.WidthsChanged); ArtistList.Events() .SelectionChanged .Subscribe(ViewModel.ArtistListSelectionChanged); AlbumGridView.Events() .SelectionChanged .Subscribe(ViewModel.AlbumGridSelectionChanged); TrackList.Events() .SelectionChanged .Subscribe(ViewModel.TrackListSelectionChanged); RestoreArtistButton.Events() .Tapped .Subscribe(ViewModel.RestoreArtistButtonTapped); RestoreAlbumButton.Events() .Tapped .Subscribe(ViewModel.RestoreAlbumButtonTapped); ArtistList.Events() .Tapped .Subscribe(ViewModel.ArtistListTapped); //ArtistList.Events().DoubleTapped // .Subscribe(ViewModel.PlayArtistCommand); AlbumGridView.Events() .Tapped .Subscribe(ViewModel.AlbumGridTapped); //AlbumGridView.Events().DoubleTapped // .Subscribe(ViewModel.PlayAlbumCommand); TrackList.Events() .DoubleTapped .Subscribe(ViewModel.TrackListDoubleTapped); }
public async Task LoadArtists() { ArtistList.Clear(); var request = new Model.Requests.ArtistsSearchRequest { Filter = (int)ReviewStatus.Approved }; var list = await _serviceArtists.Get <List <Model.Artists> >(request); foreach (var item in list) { ArtistList.Add(item); } }
private void ArtistList_Loaded(object sender, RoutedEventArgs e) { var scrollviewer = ArtistList.GetScrollViewer(); var _scrollerPropertySet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scrollviewer); var _compositor = _scrollerPropertySet.Compositor; // Get references to our property sets for use with ExpressionNodes var scrollingProperties = _scrollerPropertySet.GetSpecializedReference <ManipulationPropertySetReferenceNode>(); var headerHeight = (float)(HeaderGroup.ActualHeight - (0f + HeaderGroup.Margin.Bottom)); var toolbarHeight = (float)Toolbar.ActualHeight; var progressAnimation = EF.Conditional(-scrollingProperties.Translation.Y > headerHeight, EF.Conditional(-scrollingProperties.Translation.Y > headerHeight + toolbarHeight, 0, -scrollingProperties.Translation.Y - headerHeight - toolbarHeight), -toolbarHeight); // 0~1 progressAnimation = (progressAnimation + toolbarHeight) / toolbarHeight; var toolbarVisual = ElementCompositionPreview.GetElementVisual(Toolbar); toolbarVisual.StartAnimation("Offset.Y", progressAnimation * 16 - 16); var bgVisual = ElementCompositionPreview.GetElementVisual(TitleBG); bgVisual.StartAnimation("Opacity", progressAnimation); toolbarVisual.StartAnimation("Opacity", progressAnimation); var moving = 80f; var movingAnimation = EF.Conditional(-scrollingProperties.Translation.Y > moving, 0f, moving + scrollingProperties.Translation.Y); var scaleAnimation = EF.Clamp(-scrollingProperties.Translation.Y / moving, 0, 1); scaleAnimation = EF.Lerp(1, (float)(ToolbarTitle.ActualHeight / TitleText.ActualHeight), scaleAnimation); var titleVisual = ElementCompositionPreview.GetElementVisual(Title); titleVisual.StartAnimation("Offset.Y", movingAnimation); var titleTextVisual = ElementCompositionPreview.GetElementVisual(TitleText); titleTextVisual.CenterPoint = new Vector3(0, (float)TitleText.ActualHeight / 2, 0); titleTextVisual.StartAnimation("Scale.X", scaleAnimation); titleTextVisual.StartAnimation("Scale.Y", scaleAnimation); }
protected void LoadArtistList() { ArtistController sysmgr = new ArtistController(); List <SelectionList> info = sysmgr.Artists_DDLList(); //Lets assume the data collection needs to be sorted info.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //set up the DDL ArtistList.DataSource = info; //ArtistList.DataTextField = "DisplayField"; ArtistList.DataTextField = nameof(SelectionList.DisplayField); ArtistList.DataValueField = nameof(SelectionList.ValueField); ArtistList.DataBind(); ArtistList.Items.Insert(0, new ListItem("Select ...", "0")); }
public async Task GetArtists() { var opr = SQLOperator.Current(); var artists = await opr.GetArtistsAsync(); var grouped = GroupedItem <ArtistViewModel> .CreateGroupsByAlpha(artists.ConvertAll(x => new ArtistViewModel { Name = x.AlbumArtists, SongsCount = x.Count })); await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => { ArtistList.Clear(); long sum = 0; foreach (var item in grouped) { ArtistList.Add(item); sum += item.Sum(x => x.SongsCount); } ArtistsCount = SmartFormat.Smart.Format(Consts.Localizer.GetString("SmartArtists"), artists.Count); SongsCount = SmartFormat.Smart.Format(Consts.Localizer.GetString("SmartSongs"), sum); var t = ThreadPool.RunAsync(async x => { foreach (var item in ArtistList) { foreach (var art in item) { var uri = await opr.GetAvatarAsync(art.RawName); if (Uri.TryCreate(uri, UriKind.Absolute, out var u)) { await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Low, () => { art.Avatar = u; }); } else { } } } }); }); }
private void LoadArtistList() { ArtistController sysmgr = new ArtistController(); List <SelectionList> info = sysmgr.Artists_DDList(); //sort ascending info.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //ddl setup ArtistList.DataSource = info; //ArtistList.DataTextField = "DisplayField"; ArtistList.DataTextField = nameof(SelectionList.DisplayField); ArtistList.DataValueField = nameof(SelectionList.ValueField); ArtistList.DataBind(); //prompt line ArtistList.Items.Insert(0, new ListItem("Select...", "0")); }
protected void LoadArtistList() { ArtistController sysmgr = new ArtistController(); List <SelectionList> info = sysmgr.Artists_DDLList(); // lets assume the data collection needs to be sort info.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //setup the ddl ArtistList.DataSource = info; //ArtistList is the DropDownList ID //ArtistList.DataTextField = "DisplayField"; ArtistList.DataTextField = nameof(SelectionList.DisplayField); //nameof(object.prop) ArtistList.DataValueField = nameof(SelectionList.ValueField); //nameof(object.prop) ArtistList.DataBind(); // use to show the data in ddl. without it, data does not get in ddl //prompt line ArtistList.Items.Insert(0, new ListItem("select...", "0")); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { if (!Context.ArtistList.IsNullorEmpty() && _clickedArtist != null) { ArtistList.ScrollIntoView(_clickedArtist); var ani = ConnectedAnimationService.GetForCurrentView().GetAnimation(Consts.ArtistPageInAnimation + "_1"); if (ani != null) { await ArtistList.TryStartConnectedAnimationAsync(ani, _clickedArtist, "ArtistName"); } ani = ConnectedAnimationService.GetForCurrentView().GetAnimation(Consts.ArtistPageInAnimation + "_2"); if (ani != null) { await ArtistList.TryStartConnectedAnimationAsync(ani, _clickedArtist, "ArtistImage"); } return; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <FanLoginService.Artist> artistList = fan.GetArtist().ToList(); ArtistList.DataSource = artistList; ArtistList.DataTextField = "ArtistName"; ArtistList.DataBind(); List <FanLoginService.Genre> genreList = fan.GetGenre().ToList(); GenreList.DataSource = genreList; GenreList.DataTextField = "GenreName"; GenreList.DataBind(); List <string> venueList = fan.GetVenue().ToList(); VenueList.DataSource = venueList; VenueList.DataBind(); } }
protected void LoadArtistList() { ArtistController sysmgr = new ArtistController(); //new instance List <SelectionList> info = sysmgr.Artist_DDLList(); //fill new list by call to query from new instance //assume data collection needs to be sorted - could be done in BLL // X and Y => do the following info.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //flip X and Y for opposite order //setup the DDL ArtistList.DataSource = info; //attach data to object //ArtistList.DataTextField = "DisplayField"; ArtistList.DataTextField = nameof(SelectionList.DisplayField); //info holds objects and selectionlist holds deffinitions ArtistList.DataValueField = nameof(SelectionList.ValueField); ArtistList.DataBind(); //push into controller //prompt line ArtistList.Items.Insert(0, new ListItem("select...", "0")); //insert new item to DDL list }
protected void LoadArtistList() { ArtistController sysmgr = new ArtistController(); List <SelectionList> info = sysmgr.Artists_DDLList(); //lets assume data collection needs to be sorted (ascending order) // for x and y, do the following... //lambda (=>) will supply the delegate (on the right side of =>) //compare x display field to y display field info.Sort((x, y) => x.DisplayField.CompareTo(y.DisplayField)); //setup the ddl ArtistList.DataSource = info; ArtistList.DataTextField = nameof(SelectionList.DisplayField); ArtistList.DataValueField = nameof(SelectionList.ValueField); ArtistList.DataBind(); //setup of a prompt line, at position 0... ArtistList.Items.Insert(0, new ListItem("Please select...", "0")); }
public ArtistList GetGenreArtists(String genreName) { try { String genreArtistsURL = Endpoints.GetGenreArtists(genreName); WebRequest genreArtistRequest = HttpWebRequest.Create(genreArtistsURL); WebResponse genreArtistResponse = genreArtistRequest.GetResponse(); using (StreamReader streamReader = new StreamReader(genreArtistResponse.GetResponseStream())) { String genreArtistJsonResponse = streamReader.ReadToEnd(); ArtistList genreArtists = JsonConvert.DeserializeObject <ArtistList>(genreArtistJsonResponse); return(genreArtists); } } catch (WebException e) { Console.WriteLine(e.Message); return(null); } }
public ArtistMetadataWrapper() { Collection = new ArtistList(); }