Exemplo n.º 1
0
        public override void SetRelations()
        {
            HashSet <string> hsPropertyNames = this.ChangedProps.GetPropertyNames();

            if (this.outright_type == eOutrightType.None)
            {
                if (this.HomeCompetitor == null || hsPropertyNames.Contains("HomeCompetitorId"))
                {
                    this.HomeCompetitor = LineSr.Instance.AllObjects.Competitors.GetObject(this.HomeCompetitorId.Value);
                    ExcpHelper.ThrowIf(this.HomeCompetitor == null, "MatchLn.SetRelations() ERROR. Cannot get Home Competitor for {0}", this);
                }

                if (this.AwayCompetitor == null || hsPropertyNames.Contains("AwayCompetitorId"))
                {
                    this.AwayCompetitor = LineSr.Instance.AllObjects.Competitors.GetObject(this.AwayCompetitorId.Value);
                    ExcpHelper.ThrowIf(this.AwayCompetitor == null, "MatchLn.SetRelations() ERROR. Cannot get Away Competitor for {0}", this);
                }
            }
            else if (m_diOutrightCompetitors == null)
            {
                m_diOutrightCompetitors = LineSr.Instance.AllObjects.CompetitorsToOutright.GetPositionToOutrightDictionaryByMatchId(this.MatchId);
                ExcpHelper.ThrowIf(m_diOutrightCompetitors == null, "MatchLn.SetRelations() ERROR. Cannot get Outright Competitors for {0}", this);
            }

            if (hsPropertyNames.Contains("Active"))
            {
                this.SetActiveChanged();
            }
        }
        public void RemoveByOutrightMatchId(long lMatchId)
        {
            PositionToOutrightDictionary di = m_diMatchIdToMPositionToOutrightDictionary.SafelyGetValue(lMatchId);

            if (di != null)
            {
                lock (m_oLocker)
                {
                    foreach (CompetitorToOutrightLn cto in di.ToSyncList())
                    {
                        m_di.Remove(cto.match2competitorid);
                        LineSr.Instance.ObjectsToRemove.SafelyAddObject(cto);
                    }
                }

                m_diMatchIdToMPositionToOutrightDictionary.Remove(lMatchId);
            }
        }
        public override CompetitorToOutrightLn MergeLineObject(CompetitorToOutrightLn objSource)
        {
            lock (m_oLocker)
            {
                CompetitorToOutrightLn cto = MergeLineObjectImp(objSource);

                PositionToOutrightDictionary di = m_diMatchIdToMPositionToOutrightDictionary.SafelyGetValue(cto.MatchId);

                if (di == null)
                {
                    di = new PositionToOutrightDictionary();
                    m_diMatchIdToMPositionToOutrightDictionary.Add(cto.MatchId, di);
                }

                di[cto.hometeam] = cto;

                return(cto);
            }
        }
Exemplo n.º 4
0
        protected void RefreshOutrightCompetitors()
        {
            Debug.Assert(m_objLine.BetDomain != null && m_objLine.BetDomain.Match != null);

            string sTag = m_objLine.OddTag.Value;

            Debug.Assert(!string.IsNullOrEmpty(sTag));

            string[] arrPositions = sTag.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);

            PositionToOutrightDictionary diOutrightCompetitors = m_objLine.BetDomain.Match.OutrightCompetitors;

            Debug.Assert(diOutrightCompetitors != null);

            m_lOutrightCompetitors = new SyncList <CompetitorLn>();

            foreach (string sPos in arrPositions)
            {
                long lPos = 0L;

                if (long.TryParse(sPos, out lPos))
                {
                    CompetitorToOutrightLn cto = diOutrightCompetitors.SafelyGetValue(lPos);
                    Debug.Assert(cto != null);
                    CompetitorLn cmpt = cto.GetCompetitor();
                    Debug.Assert(cmpt != null);

                    m_lOutrightCompetitors.Add(cmpt);
                }
                else if (sPos == "OTHERS")
                {
                }
                else
                {
                    Debug.Assert(false);
                }
            }
        }