Exemple #1
0
        public void AddOrder(string client, List <ClientDemand> demand)
        {
            List <OrderLineDetail> odTemp = new List <OrderLineDetail>();


            foreach (ClientDemand c in demand)
            {
                var price = from product in pl.L where product.Name == c.Name select product.Price;
                System.Diagnostics.Debug.WriteLine(price);
                System.Diagnostics.Debug.WriteLine(c.Name);
                System.Diagnostics.Debug.WriteLine(c.Num);
                OrderLineDetail ol = new OrderLineDetail(c.Name, price.First(), c.Num);
                odTemp.Add(ol);
            }
            OrderDetail od = new OrderDetail(odTemp);
            Order       o  = new Order(Id, client, od);

            Ol.Add(o);
            Id++;
        }
Exemple #2
0
 public void UpdateOrder(string client, List <ClientDemand> l)
 {
     foreach (Order o in Ol)
     {
         if (o.Client == client)
         {
             foreach (ClientDemand cd in l)
             {
                 var product = from odl in o.Od.L where odl.Name == cd.Name select odl;
                 if (product.Any())
                 {
                     product.First().Num = cd.Num;
                 }
                 else
                 {
                     var             price = from productWant in pl.L where productWant.Name == cd.Name select productWant.Price;
                     OrderLineDetail odl   = new OrderLineDetail(cd.Name, price.First(), cd.Num);
                     o.Od.L.Add(odl);
                 }
             }
         }
         Console.WriteLine("Order Not Found");
     }
 }