Esempio n. 1
0
 public virtual decimal Estimate(IMerchandise merchandise)
 {
     if (_exemptions.GetExemptions().Contains(merchandise.MerchandiseType))
     {
         return(0M);
     }
     return(Math.Round(merchandise.Price / 10M, 2, MidpointRounding.AwayFromZero));
 }
Esempio n. 2
0
        public void Down(Wagon wagon, IMerchandise merchandise)
        {
            if (this.IsOverweightPackage)
            {
                this.IsOverweightPackage = false;
            }

            wagon.Merchandise.RemoveAt(wagon.Merchandise.FindIndex(x => x.GetWeight() == merchandise.GetWeight()));
        }
Esempio n. 3
0
        public virtual decimal Estimate(IMerchandise merchandise)
        {
            if (!merchandise.Import)
            {
                return(0M);
            }

            return(Math.Round(merchandise.Price / 20M, 1, MidpointRounding.AwayFromZero));
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 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);
         }
     }
 }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
 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);
         }
     }
 }
Esempio n. 8
0
 public bool IsThereSpace(IMerchandise merchandise)
 {
     return((WeightCarried + merchandise.GetWeight()) < TotalWeight);
 }
Esempio n. 9
0
 public bool HaveIt(IMerchandise merchandise)
 {
     return(this.Merchandise.Any(x => x.GetWeight() == merchandise.GetWeight()));
 }
Esempio n. 10
0
 public void Down(IMerchandise merchandise)
 {
     TradePolicy.Down(this, merchandise);
 }
Esempio n. 11
0
 public void Up(IMerchandise merchandise)
 {
     TradePolicy.Up(this, merchandise);
 }
Esempio n. 12
0
 public virtual void Add(IMerchandise merchandise)
 {
     _goods.Add(merchandise);
 }
Esempio n. 13
0
 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}");
        }
Esempio n. 15
0
 public void Up(Wagon wagon, IMerchandise merchandise)
 {
     wagon.WeightCarried += merchandise.GetWeight();
     wagon.Merchandise.Add(merchandise);
 }
Esempio n. 16
0
 void ITradePolicy.Down(Wagon wagon, IMerchandise merchandise)
 {
     wagon.WeightCarried -= merchandise.GetWeight();
     wagon.Merchandise.Remove(merchandise);
 }
Esempio n. 17
0
 public void Demand(IMerchandise merchandise)
 {
     DemandList.Add(merchandise);
 }
Esempio n. 18
0
 public MerchandiseStock(IMerchandise item, int amount)
 {
     Item   = item;
     Amount = amount;
 }