Exemplo n.º 1
0
 public Transaction(Client client, ShoesPair shoesPair, int count)
 {
     Client    = client;
     ShoesPair = shoesPair;
     Count     = count;
     Date      = DateTimeOffset.Now;
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
 public Boolean IsShoesPairAvailable(ShoesPair shoesPair, int count)
 {
     if (shoesPair.StockCount >= count)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 8
0
 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));
     }
 }
Exemplo n.º 9
0
 public Invoice(Client client, ShoesPair shoesPair, int count, decimal shippingCost) : base(client, shoesPair, count)
 {
     ShippingCost = shippingCost;
     TotalPrice   = CalculateTotalPrice();
 }
Exemplo n.º 10
0
        public Transaction CreateInvoice(Client client, ShoesPair shoesPair)
        {
            Transaction invoice = new Invoice(client, shoesPair, 1, new decimal(15.90));

            return(invoice);
        }
Exemplo n.º 11
0
 public Return(Client client, ShoesPair shoesPair, int count) : base(client, shoesPair, count)
 {
 }