public Transaction(Client client, ShoesPair shoesPair, int count) { Client = client; ShoesPair = shoesPair; Count = count; Date = DateTimeOffset.Now; }
public ShoesPair CreateShoesPair(Shoes shoes) { ShoesPair shoesPair = new ShoesPair(shoes, Rnd.Next(50, 500), new decimal(0.22), Rnd.Next(10, 1000), new decimal(Rnd.NextDouble() * (0.75 - 0.0) + 0.0)); return(shoesPair); }
public void DeleteShoesPair(ShoesPair shoesPair) { if (!DataContext.ShoesPairList.Any(sp => sp.Equals(shoesPair))) { throw new ArgumentException($"Pair of shoes: {shoesPair} doesn't exist."); } DataContext.ShoesPairList.Remove(shoesPair); }
public void UpdateShoesPair(int index, ShoesPair shoesPair) { if (!(index >= 0 && index < DataContext.ShoesPairList.Count)) { throw new ArgumentException($"Pair of shoes with: {index} doesn't exist in the repository"); } DataContext.ShoesPairList.Insert(index, shoesPair); }
public void AddShoesPair(ShoesPair shoesPair) { if (DataContext.ShoesPairList.Any(sp => sp.Equals(shoesPair))) { throw new ArgumentException($"ShoesPair: {shoesPair} already exist in the repository."); } DataContext.ShoesPairList.Add(shoesPair); }
public void DecreaseStockCount(ShoesPair shoesPair, Transaction ret) { if (!DataContext.ShoesPairList.Any(sp => sp.Equals(shoesPair))) { throw new ArgumentException($"ShoesPair: {shoesPair} doensn't exist in the repository."); } int index = DataContext.ShoesPairList.IndexOf(shoesPair); DataContext.ShoesPairList[index].StockCount -= ret.Count; }
public Boolean IsShoesPairAvailable(ShoesPair shoesPair, int count) { if (shoesPair.StockCount >= count) { return(true); } else { return(false); } }
public override bool Equals(Object obj) { //Check for null and compare run-time types. if ((obj == null) || !this.GetType().Equals(obj.GetType())) { return(false); } else { ShoesPair i = (ShoesPair)obj; return(this.Shoes.Equals(i.Shoes) && this.NettoPrice.Equals(i.NettoPrice) && this.StockCount.Equals(i.StockCount) && this.Discount.Equals(i.Discount) && this.Tax.Equals(i.Tax)); } }
public Invoice(Client client, ShoesPair shoesPair, int count, decimal shippingCost) : base(client, shoesPair, count) { ShippingCost = shippingCost; TotalPrice = CalculateTotalPrice(); }
public Transaction CreateInvoice(Client client, ShoesPair shoesPair) { Transaction invoice = new Invoice(client, shoesPair, 1, new decimal(15.90)); return(invoice); }
public Return(Client client, ShoesPair shoesPair, int count) : base(client, shoesPair, count) { }