public void ApplyPostRulesProcessing(Fixture fixture) { foreach (var mkt in fixture.Markets) { IUpdatableMarketState tmp = null; if (_processed.TryGetValue(mkt.Id, out tmp)) { tmp.ApplyPostRulesProcessing(); } } }
public void Update(Fixture fixture, bool fullSnapshot) { FixtureSequence = fixture.Sequence; FixtureName = fixture.FixtureName; FixtureStatus = (MatchStatus)Enum.Parse(typeof(MatchStatus), fixture.MatchStatus); if (fullSnapshot) { if (fixture.Tags.ContainsKey("Sport")) { Sport = fixture.Tags["Sport"].ToString(); } var marketsLookUp = fixture.Markets.ToDictionary(m => m.Id); //if market doesn't exist in the snapshot the definition must have been changed Markets.Where(marketId => !marketsLookUp.ContainsKey(marketId)).ForEach(marketId => this[marketId].IsDeleted = true); } _processed = new Dictionary <string, IUpdatableMarketState>(); foreach (var market in fixture.Markets) { IUpdatableMarketState mkt_state = null; if (HasMarket(market.Id)) { mkt_state = this[market.Id] as IUpdatableMarketState; mkt_state.Update(market, fullSnapshot); } else { mkt_state = new MarketState(market, fullSnapshot); ((MarketState)mkt_state).Index = _States.Count; this[market.Id] = mkt_state; } _processed.Add(market.Id, mkt_state); } }