예제 #1
0
 public void AddSponsor(Sponsor sponsor, string detail)
 {
     Sponsors.Add(new SponsorEvent
     {
         Detail  = detail,
         Sponsor = sponsor
     });
 }
예제 #2
0
 private void EventSelected(FeaturedEvent selectedEvent)
 {
     SelectedEvent = selectedEvent;
     Sponsors.Add(SelectedEvent.Sponsor);
     if (Sponsors != null)
     {
         ListViewHeightAdjustment = Sponsors.Count;
     }
 }
예제 #3
0
        public void Handle(SponsorCreated e)
        {
            Sponsors.Add(new Sponsor
            {
                Id           = e.SponsorId,
                TournamentId = e.Id,
                Name         = e.Name,
                Website      = e.Website
            });

            Storage.Create(new TSSponsorLogo
            {
                Id       = e.SponsorId,
                Contents = e.Image
            });
        }
        private async Task UpdateSponsorsInfoAsync()
        {
            _vereniging = await _verenigingRepository.GetVerenigingAsync();

            Sponsors = await _sponsorRepository.GetSponsorsAsync(_vereniging.Id);

            if (Sponsors == null || Sponsors.Count == 0)
            {
                if (Sponsors == null)
                {
                    Sponsors = new ObservableCollection <Sponsor>();
                }

                Sponsors.Add(new Sponsor {
                    Id = Guid.NewGuid(), Naam = "Er zijn momenteel geen sponsoren opgegeven.", Type = "item", Path = new Uri("ms-appx:///Assets/placeHolderSponsor.png")
                });
            }
            //Index = 0;
        }
        public async Task OnLoadAsync(INavigationParameters parameters, int attempt = 0)
        {
            try
            {
                var data = await SponsorService.GetAsync();

                Sponsors.Clear();

                foreach (var item in data.OrderBy(x => x.Level))
                {
                    var sponsor = new Sponsor
                    {
                        Name     = item.Name,
                        Homepage = item.Homepage,
                        Image    = ImageSource.FromStream(() => new MemoryStream(item.Image)),
                        Level    = (SponsorType)item.Level
                    };

                    switch (item.Level)
                    {
                    case Data.Models.SponsorLevel.Title:
                        Sponsors.Add(new TitlePlatinumSponsor
                        {
                            DataContext = sponsor,
                            Level       = SponsorType.Title
                        });
                        break;

                    case Data.Models.SponsorLevel.Platinum:
                        Sponsors.Add(new TitlePlatinumSponsor
                        {
                            DataContext = sponsor,
                            Level       = SponsorType.Platinum
                        });
                        break;
                    }
                }

                var goldGroup = new GeneralSponsor
                {
                    DataContext = data
                                  .Where(x => x.Level == Data.Models.SponsorLevel.Gold)
                                  .Select(x => new Sponsor
                    {
                        Name     = x.Name,
                        Homepage = x.Homepage,
                        Image    = ImageSource.FromStream(() => new MemoryStream(x.Image)),
                        Level    = SponsorType.Gold
                    }),
                    Level = SponsorType.Gold
                };

                var silverGroup = new GeneralSponsor
                {
                    DataContext = data
                                  .Where(x => x.Level == Data.Models.SponsorLevel.Silver)
                                  .Select(x => new Sponsor
                    {
                        Name     = x.Name,
                        Homepage = x.Homepage,
                        Image    = ImageSource.FromStream(() => new MemoryStream(x.Image)),
                        Level    = SponsorType.Silver
                    }),
                    Level = SponsorType.Silver
                };

                var bronzeGroup = new GeneralSponsor
                {
                    DataContext = data
                                  .Where(x => x.Level == Data.Models.SponsorLevel.Bronze)
                                  .Select(x => new Sponsor
                    {
                        Name     = x.Name,
                        Homepage = x.Homepage,
                        Image    = ImageSource.FromStream(() => new MemoryStream(x.Image)),
                        Level    = SponsorType.Bronze
                    }),
                    Level = SponsorType.Bronze
                };

                if (goldGroup.DataContext.Any())
                {
                    Sponsors.Add(goldGroup);
                }

                if (silverGroup.DataContext.Any())
                {
                    Sponsors.Add(silverGroup);
                }

                if (bronzeGroup.DataContext.Any())
                {
                    Sponsors.Add(bronzeGroup);
                }
            }
            catch (Exception)
            {
                await ErrorRetryManager.HandleRetryAsync(this, parameters, attempt);
            }
        }
예제 #6
0
 public void AddSponsor(Sponsor sponsor)
 {
     Sponsors.Add(sponsor);
     SaveChanges();
 }
        public async void OnNavigatingTo(INavigationParameters parameters)
        {
            var data = await SponsorService.GetAsync();

            Sponsors.Clear();

            foreach (var item in data)
            {
                var sponsor = new Sponsor
                {
                    Name      = item.Name,
                    Homepage  = item.Homepage,
                    ImageLink = item.ImageLink,
                    Level     = (SponsorType)item.Level
                };

                switch (item.Level)
                {
                case Data.Models.SponsorLevel.Title:
                    Sponsors.Add(new TitlePlatinumSponsor
                    {
                        DataContext = sponsor,
                        Level       = SponsorType.Title
                    });
                    break;

                case Data.Models.SponsorLevel.Platinum:
                    Sponsors.Add(new TitlePlatinumSponsor
                    {
                        DataContext = sponsor,
                        Level       = SponsorType.Platinum
                    });
                    break;
                }
            }

            var goldGroup = new GeneralSponsor
            {
                DataContext = data
                              .Where(x => x.Level == Data.Models.SponsorLevel.Gold)
                              .Select(x => new Sponsor
                {
                    Name      = x.Name,
                    Homepage  = x.Homepage,
                    ImageLink = x.ImageLink,
                    Level     = SponsorType.Gold
                }),
                Level = SponsorType.Gold
            };

            var silverGroup = new GeneralSponsor
            {
                DataContext = data
                              .Where(x => x.Level == Data.Models.SponsorLevel.Silver)
                              .Select(x => new Sponsor
                {
                    Name      = x.Name,
                    Homepage  = x.Homepage,
                    ImageLink = x.ImageLink,
                    Level     = SponsorType.Silver
                }),
                Level = SponsorType.Silver
            };

            var bronzeGroup = new GeneralSponsor
            {
                DataContext = data
                              .Where(x => x.Level == Data.Models.SponsorLevel.Bronze)
                              .Select(x => new Sponsor
                {
                    Name      = x.Name,
                    Homepage  = x.Homepage,
                    ImageLink = x.ImageLink,
                    Level     = SponsorType.Bronze
                }),
                Level = SponsorType.Bronze
            };

            if (goldGroup.DataContext.Any())
            {
                Sponsors.Add(goldGroup);
            }

            if (silverGroup.DataContext.Any())
            {
                Sponsors.Add(silverGroup);
            }

            if (bronzeGroup.DataContext.Any())
            {
                Sponsors.Add(bronzeGroup);
            }
        }