Exemplo n.º 1
0
        public void SearchOdds(SortableObservableCollection <IOddVw> ocOdds, DelegateFilterOdds dfo)
        {
#if DEBUG
            if (this.BetDomainId == 811116)
            {
            }
#endif

            var hsOdds    = new HashSet <IOddVw>();
            var lOdds     = m_objLine.Odds.Clone();
            var lOddViews = ocOdds.ToSyncList();

            foreach (var oddLn in lOdds)
            {
                if (dfo == null || dfo(oddLn))
                {
                    hsOdds.Add(oddLn.OddView);

                    if (!lOddViews.Contains(oddLn.OddView))
                    {
                        lOddViews.Add(oddLn.OddView);
                    }
                }
            }

            for (int i = 0; i < lOddViews.Count;)
            {
                IOddVw oddView = lOddViews[i];

                if (!hsOdds.Contains(oddView))
                {
                    lOddViews.RemoveAt(i);
                }
                else
                {
                    i++;
                }
            }

            if (this.LineObject.IsLiveBet.Value)
            {
                lOddViews.Sort(delegate(IOddVw ov1, IOddVw ov2) { return(ov1.LineObject.Sort.Value.CompareTo(ov2.LineObject.Sort.Value)); });
            }
            else if (this.IsOutright)
            {
                lOddViews.Sort(delegate(IOddVw ov1, IOddVw ov2) { return(ov1.LineObject.Value.Value.CompareTo(ov2.LineObject.Value.Value)); });
            }
            else
            {
                lOddViews.Sort(delegate(IOddVw ov1, IOddVw ov2) { return(ov1.LineObject.Sort.Value.CompareTo(ov2.LineObject.Sort.Value)); });
            }

            ocOdds.ApplyChanges(lOddViews);
        }
Exemplo n.º 2
0
        public void SearchMatches(SortableObservableCollection <IMatchVw> ocMatches, string sSearch, string sLanguage, DelegateFilterMatches dfm, Comparison <IMatchVw> comparison)
        {
            SyncList <IMatchVw> lMatchesToSync = ocMatches.ToSyncList();

            SearchMatches(lMatchesToSync, sSearch, sLanguage, dfm);

            if (comparison != null)
            {
                lMatchesToSync.Sort(comparison);
            }
            ocMatches.ApplyChanges(lMatchesToSync);
        }
Exemplo n.º 3
0
        public void SearchResults(SortableObservableCollection <MatchResultVw> ocMatchResults, DelegateFilterResults dfr, Comparison <MatchResultVw> comparison)
        {
            SyncList <MatchResultVw> lResultsToSync = ocMatchResults.ToSyncList();

            SearchResults(lResultsToSync, dfr);

            if (comparison != null)
            {
                lResultsToSync.Sort(comparison);
                ocMatchResults.ApplyChanges(lResultsToSync);
            }
        }
Exemplo n.º 4
0
        public void SortingTest()
        {
            var icehockeyresult = new MatchResultVw(new MatchResultLn()
            {
                MatchId = 2
            });

            SortableObservableCollection <MatchResultVw> icehockey = new SortableObservableCollection <MatchResultVw>();

            icehockey.Add(icehockeyresult);


            SyncList <MatchResultVw> basketballIcehockey = new SyncList <MatchResultVw>();

            basketballIcehockey.Add(new MatchResultVw(new MatchResultLn()
            {
                MatchId = 1
            }));
            basketballIcehockey.Add(icehockeyresult);

            icehockey.ApplyChanges(basketballIcehockey);

            Assert.AreEqual(2, icehockey.Count);
        }