public virtual decimal Estimate(IMerchandise merchandise) { if (_exemptions.GetExemptions().Contains(merchandise.MerchandiseType)) { return(0M); } return(Math.Round(merchandise.Price / 10M, 2, MidpointRounding.AwayFromZero)); }
public void Down(Wagon wagon, IMerchandise merchandise) { if (this.IsOverweightPackage) { this.IsOverweightPackage = false; } wagon.Merchandise.RemoveAt(wagon.Merchandise.FindIndex(x => x.GetWeight() == merchandise.GetWeight())); }
public virtual decimal Estimate(IMerchandise merchandise) { if (!merchandise.Import) { return(0M); } return(Math.Round(merchandise.Price / 20M, 1, MidpointRounding.AwayFromZero)); }
public override bool IsValid(object value) { IMerchandise item = value as IMerchandise; if (item == null) { return(!Optional); } return(item.Item != null && item.QualityRange.Low <= item.QualityRange.High); }
public void Up(Wagon wagon, IMerchandise merchandise) { if (this.MerchantMode.Equals(TraderMode.Buy)) { var percentageWithMerchandise = this.CurrentPercentage + (merchandise.GetWeight() * 100 / this.MaxTransportWeight); if (percentageWithMerchandise <= this.PercentageToFill) { this.CurrentPercentage = percentageWithMerchandise; wagon.Merchandise.Add(merchandise); } } }
public void Up(Wagon wagon, IMerchandise merchandise) { if (merchandise.GetWeight() < this.PackageMaxWeight) { wagon.Merchandise.Add(merchandise); } else if (!this.IsOverweightPackage) { this.IsOverweightPackage = true; wagon.Merchandise.Add(merchandise); } }
public void Down(Wagon wagon, IMerchandise merchandise) { if (this.MerchantMode.Equals(TraderMode.Sell)) { var percentageWithOutMerchandise = this.CurrentPercentage - (merchandise.GetWeight() * 100 / this.MaxTransportWeight); if (percentageWithOutMerchandise >= this.PercentageToEmpty) { this.CurrentPercentage = percentageWithOutMerchandise; wagon.Merchandise.Remove(merchandise); } } }
public bool IsThereSpace(IMerchandise merchandise) { return((WeightCarried + merchandise.GetWeight()) < TotalWeight); }
public bool HaveIt(IMerchandise merchandise) { return(this.Merchandise.Any(x => x.GetWeight() == merchandise.GetWeight())); }
public void Down(IMerchandise merchandise) { TradePolicy.Down(this, merchandise); }
public void Up(IMerchandise merchandise) { TradePolicy.Up(this, merchandise); }
public virtual void Add(IMerchandise merchandise) { _goods.Add(merchandise); }
public void Bid(IMerchandise merchandise) { SupplyList.Add(merchandise); }
private void PrintText(IMerchandise merchandise, decimal tax) { var priceTotal = merchandise.Price + tax; Console.WriteLine($"{merchandise.Amount} {merchandise.Name}: {priceTotal:####.#0}"); }
public void Up(Wagon wagon, IMerchandise merchandise) { wagon.WeightCarried += merchandise.GetWeight(); wagon.Merchandise.Add(merchandise); }
void ITradePolicy.Down(Wagon wagon, IMerchandise merchandise) { wagon.WeightCarried -= merchandise.GetWeight(); wagon.Merchandise.Remove(merchandise); }
public void Demand(IMerchandise merchandise) { DemandList.Add(merchandise); }
public MerchandiseStock(IMerchandise item, int amount) { Item = item; Amount = amount; }