Example #1
0
        private void OnChoiceExecute(long id)
        {
            TournamentVw.CheckFlag = true;
            TournamentVw._instances.Clear();
            if (TournamentMatches != null && TournamentMatches.Count > 0)
            {
                TournamentMatches = null;
            }
            if (SelectedTournaments != null && SelectedTournaments.Count > 0)
            {
                SelectedTournaments.Clear();
            }
            var category = Categories.Where(c => c.Id == id).FirstOrDefault();

            SelectedSportDescriptor = category.SportDescriptor;
            ButtonBackground        = category.BackgroundBySport;
            var tournamentsData = new TournamentsViewModel(id);

            tournamentsData.OnNavigationCompleted();
            Tournaments              = new SortableObservableCollection <TournamentVw>(tournamentsData.Tournaments);
            ShowCountries            = new SortableObservableCollection <TournamentVw>(Tournaments.GroupBy(p => p.Country).Select(g => g.First()).ToList());
            ShowCountries[0].Country = "Outrights";
            SelectedCategoryId       = id;
            TournamentVw.CheckFlag   = false;
        }
        public bool MatchFilterSportBar(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 (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(180))
                {
                    return(false);
                }
            }

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

            return(true);
        }