public void SortPausedSoccerLiveMonitor()
        {
            SortableObservableCollection <IMatchVw> collection = new SortableObservableCollection <IMatchVw>();

            collection.Add(new TestMatchVw()
            {
                SportDescriptor = SportSr.SPORT_DESCRIPTOR_SOCCER, IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 45, LivePeriodInfo = eLivePeriodInfo.Soccer_1st_Period, Name = "test1", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 2)
            });                                                                                                                                                                                                                                                                                                                                                                                         //should be third
            collection.Add(new TestMatchVw()
            {
                SportDescriptor = SportSr.SPORT_DESCRIPTOR_SOCCER, IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 45, LivePeriodInfo = eLivePeriodInfo.Paused, Name = "test2", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 1)
            });                                                                                                                                                                                                                                                                                                                                                                              //should be second
            collection.Add(new TestMatchVw()
            {
                SportDescriptor = SportSr.SPORT_DESCRIPTOR_SOCCER, IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 20, LivePeriodInfo = eLivePeriodInfo.Soccer_1st_Period, Name = "test3", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 2)
            });                                                                                                                                                                                                                                                                                                                                                                                         //should be forth
            collection.Add(new TestMatchVw()
            {
                SportDescriptor = SportSr.SPORT_DESCRIPTOR_SOCCER, IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 50, LivePeriodInfo = eLivePeriodInfo.Soccer_2nd_Period, Name = "test4", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 1)
            });                                                                                                                                                                                                                                                                                                                                                                                         //should be first

            var groupln = new GroupLn {
                Sort = { Value = 1 }
            };

            collection.Sort(LiveMonitorsService.Comparison);

            Assert.AreEqual("test4", collection[0].Name); //s
            Assert.AreEqual("test2", collection[1].Name); //s
            Assert.AreEqual("test1", collection[2].Name); //s
            Assert.AreEqual("test3", collection[3].Name); //s
        }
Пример #2
0
        private static void MergeMatchResult(MatchLn mtch)
        {
            try
            {
                MatchResultLn rslt = new MatchResultLn();

                rslt.MatchId                = mtch.MatchId;
                rslt.BtrMatchId             = mtch.BtrMatchId;
                rslt.StartDate.Value        = mtch.StartDate.Value;
                rslt.HomeCompetitorId.Value = mtch.HomeCompetitorId.Value;
                rslt.AwayCompetitorId.Value = mtch.AwayCompetitorId.Value;
                rslt.IsLiveBet.Value        = mtch.IsLiveBet.Value;
                rslt.Score.Value            = mtch.LiveMatchInfo.Score.Value;
                rslt.ExtendedState.Value    = string.Empty;
                rslt.TeamWon                = mtch.TeamWon.Value;

                var lGroups = mtch.ParentGroups.Clone();

                GroupLn groupTournament = null;
                GroupLn groupSport      = null;
                GroupLn groupCategory   = null;

                foreach (var group in lGroups)
                {
                    if (group.Type == GroupLn.GROUP_TYPE_GROUP_T)
                    {
                        groupTournament = group;
                    }
                    else if (group.Type == GroupLn.GROUP_TYPE_SPORT)
                    {
                        groupSport = group;
                    }
                    else if (group.Type == GroupLn.GROUP_TYPE_GROUP_C)
                    {
                        groupCategory = group;
                    }
                }

                ExcpHelper.ThrowIf <RelatedLineObjectNotFoundException>(groupTournament == null, "Cannot find Tournament Group for {0} and {1}", mtch, rslt);
                ExcpHelper.ThrowIf <RelatedLineObjectNotFoundException>(groupSport == null, "Cannot find Sport Group for {0} and {1}", mtch, rslt);
                ExcpHelper.ThrowIf <RelatedLineObjectNotFoundException>(groupCategory == null, "Cannot find Category Group for {0} and {1}", mtch, rslt);

                rslt.TournamentGroupId.Value = groupTournament.GroupId;
                rslt.SportGroupId.Value      = groupSport.GroupId;
                rslt.CategoryGroupId.Value   = groupCategory.GroupId;

                LineSr.Instance.AllObjects.MatchResults.MergeLineObject(rslt);
            }
            catch (Exception excp)
            {
                m_logger.Excp(excp, "MergeMatchResult ERROR for {0}", mtch);
            }
        }
Пример #3
0
        protected override void OnPropertyChanged(CommonObjects.ObservablePropertyBase opb)
        {
            if (opb.PropertyName == PROPERTY_NAME_TOURNAMENT_GROUP_ID)
            {
                m_tournamentGroup = null;
            }
            else if (opb.PropertyName == PROPERTY_NAME_SPORT_GROUP_ID)
            {
                m_sportGroup = null;
            }

            base.OnPropertyChanged(opb);
        }
        public void DifferentSportsSort()
        {
            SortableObservableCollection <IMatchVw> collection = new SortableObservableCollection <IMatchVw>();

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.NotStarted, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test1", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 1), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test2", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 1), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test3", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 2), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Stopped, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test4", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 1), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Stopped, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test5", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 2), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = false, LiveBetStatus = eMatchStatus.Undefined, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test6", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 2), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.NotStarted, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test7", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 3), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Stopped, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test8", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 1), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = false, LiveBetStatus = eMatchStatus.Undefined, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test9", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 4), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Stopped, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test10", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 2), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = false, LiveBetStatus = eMatchStatus.Undefined, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test11", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 5), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test12", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 1), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test13", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 2), DefaultSorting = 1
            });

            var groupln = new GroupLn {
                Sort = { Value = 1 }
            };

            collection.Sort(LiveMonitorsService.Comparison);
            LiveMonitorsService.UpdateHeaders(collection);

            Assert.AreEqual("test12", collection[0].Name);  //s
            Assert.AreEqual("test8", collection[1].Name);   //s
            Assert.AreEqual("test13", collection[2].Name);  //s
            Assert.AreEqual("test5", collection[3].Name);   //s
            Assert.AreEqual("test2", collection[4].Name);   //t
            Assert.AreEqual("test4", collection[5].Name);   //t
            Assert.AreEqual("test10", collection[6].Name);  //t
            Assert.AreEqual("test3", collection[7].Name);   //t
            Assert.AreEqual("test1", collection[8].Name);   //s
            Assert.AreEqual("test6", collection[9].Name);   //s
            Assert.AreEqual("test9", collection[10].Name);  //s
            Assert.AreEqual("test7", collection[11].Name);  //t
            Assert.AreEqual("test11", collection[12].Name); //t

            Assert.AreEqual(true, collection[0].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[1].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[2].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[3].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[4].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[5].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[6].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[7].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[8].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[9].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[10].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[11].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[12].IsHeaderForLiveMonitor);

            collection = new SortableObservableCollection <IMatchVw>(collection.OrderByDescending(x => x.Name).ToList());

            collection.Sort(LiveMonitorsService.Comparison);
            LiveMonitorsService.UpdateHeaders(collection);

            Assert.AreEqual("test12", collection[0].Name);  //s
            Assert.AreEqual("test8", collection[1].Name);   //s
            Assert.AreEqual("test13", collection[2].Name);  //s
            Assert.AreEqual("test5", collection[3].Name);   //s
            Assert.AreEqual("test2", collection[4].Name);   //t
            Assert.AreEqual("test4", collection[5].Name);   //t
            Assert.AreEqual("test10", collection[6].Name);  //t
            Assert.AreEqual("test3", collection[7].Name);   //t
            Assert.AreEqual("test1", collection[8].Name);   //s
            Assert.AreEqual("test6", collection[9].Name);   //s
            Assert.AreEqual("test9", collection[10].Name);  //s
            Assert.AreEqual("test7", collection[11].Name);  //t
            Assert.AreEqual("test11", collection[12].Name); //t

            Assert.AreEqual(true, collection[0].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[1].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[2].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[3].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[4].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[5].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[6].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[7].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[8].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[9].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[10].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[11].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[12].IsHeaderForLiveMonitor);
        }