Esempio n. 1
0
        private void CheckedExecute(SportBarItem barItem)
        {
            if (barItem.SportDescriptor == SportSr.ALL_SPORTS && SelectedDescriptors.Count == 1 && SelectedDescriptors.Contains(SportSr.ALL_SPORTS))
            {
                SportBarItem allsports = SportsBarItemsLive.Where(x => x.SportDescriptor == SportSr.ALL_SPORTS).First();
                if (allsports != null)
                {
                    allsports.IsChecked = true;
                }

                return;
            }
            else if (SelectedDescriptors.Contains(barItem.SportDescriptor))
            {
                SelectedDescriptors.Remove(barItem.SportDescriptor);
            }
            else
            {
                if (barItem.SportDescriptor == SportSr.ALL_SPORTS)
                {
                    for (int i = 1; i < SportsBarItemsLive.Count; i++)
                    {
                        SportsBarItemsLive[i].IsChecked = false;
                    }

                    SelectedDescriptors.Clear();
                    ChangeTracker.LiveSelectedAllSports = true;
                }
                else //all sports should be unchecked automatically
                {
                    if (SelectedDescriptors.Contains(SportSr.ALL_SPORTS))
                    {
                        SportsBarItemsLive[0].IsChecked = false;
                        SelectedDescriptors.Remove(SportSr.ALL_SPORTS);
                    }
                    ChangeTracker.LiveSelectedAllSports = false;
                }

                SelectedDescriptors.Add(barItem.SportDescriptor);
            }

            if (SelectedDescriptors.Count == 0)
            {
                SportBarItem allsports = SportsBarItemsLive.Where(x => x.SportDescriptor == SportSr.ALL_SPORTS).First();
                if (allsports != null)
                {
                    allsports.IsChecked = true;
                    SelectedDescriptors.Add(allsports.SportDescriptor);
                }
            }

            Refresh(true);

            ScrollToVertivalOffset(0);
        }
Esempio n. 2
0
        public void FillSportsBar()
        {
            SortableObservableCollection <IMatchVw> PreMatches = new SortableObservableCollection <IMatchVw>();

            Repository.FindMatches(PreMatches, "", SelectedLanguage, MatchFilterSportBar, delegate(IMatchVw m1, IMatchVw m2) { return(0); });

            try
            {
                var sports = PreMatches.Where(x => x.SportView != null).Select(x => x.SportView).Distinct().ToList();

                SportBarItem allsports = SportsBarItemsPreMatch.FirstOrDefault(x => x.SportDescriptor == SportSr.ALL_SPORTS);
                if (allsports != null)
                {
                    allsports.SportName = TranslationProvider.Translate(MultistringTags.ALL_SPORTS) as string;
                }
                else
                {
                    SportsBarItemsPreMatch.Insert(0, new SportBarItem(TranslationProvider.Translate(MultistringTags.ALL_SPORTS) as string, SportSr.ALL_SPORTS));
                }

                foreach (var group in sports)
                {
                    {
                        if (SportsBarItemsPreMatch.Count(x => x.SportDescriptor == group.LineObject.GroupSport.SportDescriptor) == 0)
                        {
                            SportsBarItemsPreMatch.Add(new SportBarItem(group.DisplayName, group.LineObject.GroupSport.SportDescriptor));
                        }
                        else
                        {
                            SportsBarItemsPreMatch.First(x => x.SportDescriptor == @group.LineObject.GroupSport.SportDescriptor).SportName = @group.DisplayName;
                        }
                    }
                }

                for (int i = 1; i < SportsBarItemsPreMatch.Count;)
                {
                    var item = SportsBarItemsPreMatch[i];

                    if (sports.Count(x => x.LineObject.GroupSport.SportDescriptor == item.SportDescriptor) == 0)
                    {
                        SportsBarItemsPreMatch.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }

                foreach (SportBarItem item in SportsBarItemsPreMatch)
                {
                    if (SelectedDescriptors.Contains(item.SportDescriptor))
                    {
                        item.IsChecked = true;
                    }
                    else
                    {
                        item.IsChecked = false;
                    }
                }

                SportsBarItemsPreMatch.Sort(ComparisonSportsBar);

                OnPropertyChanged("SportsBarVisibility");
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 3
0
        private void CheckedExecute(SportBarItem barItem)
        {
            if (barItem.SportDescriptor == SportSr.ALL_SPORTS && SelectedDescriptors.Count == 1 && SelectedDescriptors.Contains(SportSr.ALL_SPORTS))
            {
                SportBarItem allsports = SportsBarItemsPreMatch.Where(x => x.SportDescriptor == SportSr.ALL_SPORTS).First();
                if (allsports != null)
                {
                    allsports.IsChecked = true;
                }

                return;
            }
            else if (SelectedDescriptors.Contains(barItem.SportDescriptor))
            {
                SelectedDescriptors.Remove(barItem.SportDescriptor);
            }
            else
            {
                if (barItem.SportDescriptor == SportSr.ALL_SPORTS)
                {
                    for (int i = 1; i < SportsBarItemsPreMatch.Count; i++)
                    {
                        SportsBarItemsPreMatch[i].IsChecked = false;
                    }

                    SelectedDescriptors.Clear();
                }
                else //all sports should be unchecked automatically
                {
                    if (SelectedDescriptors.Contains(SportSr.ALL_SPORTS))
                    {
                        SportsBarItemsPreMatch[0].IsChecked = false;
                        SelectedDescriptors.Remove(SportSr.ALL_SPORTS);
                    }
                }

                SelectedDescriptors.Add(barItem.SportDescriptor);
            }

            if (SelectedDescriptors.Count == 0)
            {
                SportBarItem allsports = SportsBarItemsPreMatch.Where(x => x.SportDescriptor == SportSr.ALL_SPORTS).First();
                if (allsports != null)
                {
                    allsports.IsChecked = true;
                    SelectedDescriptors.Add(allsports.SportDescriptor);
                }
            }


            SoccerVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_SOCCER && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (SoccerVisibility == Visibility.Visible)
            {
                SoccerExpanderIsExpanded = true;
            }
            else
            {
                SoccerExpanderIsExpanded = false;
            }

            TennisVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_TENNIS && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (TennisVisibility == Visibility.Visible)
            {
                TennisExpanderIsExpanded = true;
            }
            else
            {
                SoccerExpanderIsExpanded = false;
            }

            BasketballVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_BASKETBALL && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (BasketballVisibility == Visibility.Visible)
            {
                BasketballExpanderIsExpanded = true;
            }
            else
            {
                BasketballExpanderIsExpanded = false;
            }

            HockeyVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (HockeyVisibility == Visibility.Visible)
            {
                HockeyExpanderIsExpanded = true;
            }
            else
            {
                HockeyExpanderIsExpanded = false;
            }

            RugbyVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_RUGBY && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (RugbyVisibility == Visibility.Visible)
            {
                RugbyExpanderIsExpanded = true;
            }
            else
            {
                RugbyExpanderIsExpanded = false;
            }

            HandballVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_HANDBALL && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (HandballVisibility == Visibility.Visible)
            {
                HandballExpanderIsExpanded = true;
            }
            else
            {
                HandballExpanderIsExpanded = false;
            }

            VolleyballVisibility = SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.SPORT_DESCRIPTOR_VOLLEYBALL && x.IsChecked) ? Visibility.Visible : Visibility.Collapsed;
            if (VolleyballVisibility == Visibility.Visible)
            {
                VolleyballExpanderIsExpanded = true;
            }
            else
            {
                VolleyballExpanderIsExpanded = false;
            }

            if (SportsBarItemsPreMatch.Any(x => x.SportDescriptor == SportSr.ALL_SPORTS && x.IsChecked))
            {
                SoccerVisibility     = Visibility.Visible;
                TennisVisibility     = Visibility.Visible;
                BasketballVisibility = Visibility.Visible;
                HockeyVisibility     = Visibility.Visible;
                RugbyVisibility      = Visibility.Visible;
                HandballVisibility   = Visibility.Visible;
                VolleyballVisibility = Visibility.Visible;

                SoccerExpanderIsExpanded     = false;
                TennisExpanderIsExpanded     = false;
                BasketballExpanderIsExpanded = false;
                HockeyExpanderIsExpanded     = false;
                RugbyExpanderIsExpanded      = false;
                HandballExpanderIsExpanded   = false;
                VolleyballExpanderIsExpanded = false;
            }


            Refresh(true);

            ScrollToVertivalOffset(0);
        }
Esempio n. 4
0
        public bool MatchFilter(IMatchLn match)
        {
            if (!match.Active.Value)
            {
                return(false);
            }

            if (match.MatchView.VisibleBetDomainCount == 0)
            {
                return(false);
            }

            if (match.MatchView.AllVisibleOddCount == 0)
            {
                return(false);
            }

            if (match.IsLiveBet.Value)
            {
                return(false);
            }

            if (SportsBarItemsPreMatch.Count > 1 && !SportsBarItemsPreMatch.ElementAt(0).IsChecked)
            {
                if (!SelectedDescriptors.Contains(match.MatchView.SportView.LineObject.GroupSport.SportDescriptor))
                {
                    return(false);
                }
            }

            if (match.MatchView.CategoryView == null)
            {
                return(false);
            }

            string id     = (match.MatchView.TournamentView.LineObject.GroupId.ToString());
            string tourId = match.outright_type == eOutrightType.Outright ? id + "*1" : id + "*0";

            if (SelectedTournaments.Count > 0 && !SelectedTournaments.Contains(tourId))
            {
                return(false);
            }


            if (match.ExpiryDate.Value.LocalDateTime < DateTime.Now)
            {
                return(false);
            }


            if (ChangeTracker.PreMatchSelectedMode == 1)
            {
                if (match.MatchView.StartDate < DateTime.Now)
                {
                    return(false);
                }
                if (match.MatchView.StartDate >= DateTime.Now.AddDays(1).Date)
                {
                    return(false);
                }
            }
            if (ChangeTracker.PreMatchSelectedMode == 2)
            {
                if (match.MatchView.StartDate < DateTime.Now)
                {
                    return(false);
                }
                if (match.MatchView.StartDate > DateTime.Now.AddMinutes(90))
                {
                    return(false);
                }
            }

            if (match.outright_type == eOutrightType.Outright && SelectedTournaments.Contains(match.MatchView.TournamentView.LineObject.GroupId.ToString() + "*1"))
            {
                return(true);
            }
            else if (match.outright_type == eOutrightType.None && SelectedTournaments.Contains(match.MatchView.TournamentView.LineObject.GroupId.ToString() + "*0"))
            {
                return(true);
            }

            if (match.MatchView.TournamentView != null)
            {
                if (!LineSr.IsTournamentVisible(match.MatchView.TournamentView.LineObject.SvrGroupId.ToString()))
                {
                    return(false);
                }
            }

            return(true);
        }