public void AddPlayer(PlayerTradable player) { var validators = new List <IValidator> { TradeOfferValidatorFactory.OfferCannotHavePlayer(this, player), ClubValidatorFactory.ClubMustHavePlayer(this.Club, player) }; if (!ValidationHelper.ValidateProcess(validators)) { return; } this.Players.Add(player); }
public void ExchangePlayer(TradeOffer offer1, TradeOffer offer2) { var validators = new List <IValidator> { TradeOfferValidatorFactory.OffersMinPlayer(offer1, offer2, this.MinPlayerTrade), TradeOfferValidatorFactory.OffersMaxPlayer(offer1, offer2, this.MaxPlayerTrade), TradeOfferValidatorFactory.OffersCannotContainsMoney(offer1, offer2) }; if (!ValidationHelper.ValidateProcess(validators)) { return; } this.ProcessTrade(offer1, offer2); }
public void Trade(TradeOffer offer1, TradeOffer offer2) { var validators = new List <IValidator> { TradeOfferValidatorFactory.OffersContainsAtLeastPlayer(offer1, offer2), TradeOfferValidatorFactory.OffersContainAtLeastMoney(offer1, offer2), TransferMarketValidatorFactory.RangePriceTrade(offer1, offer2, this.TradePercent) }; if (!ValidationHelper.ValidateProcess(validators)) { return; } this.ProcessTrade(offer1, offer2); }