public void UpdateOrder(Order My_Order) { bool ezer = false; foreach (var item in Dal_XML_imp.GetOrderFromXml()) { if (item.Order_key == My_Order.Order_key) { ezer = true; item.Status = My_Order.Status; } } if (ezer == false) //אין את ההזמנה ברשימה { Dal_XML_imp.AddOrderToXml(My_Order.Clone()); Configuration.OrderKey++; throw new NotImplementedException("The order is not on the list so add again"); } }
public void AddOrder(Order My_Order) { bool ezer = false; foreach (var item in Dal_XML_imp.GetOrderFromXml()) { if (item.Order_key == My_Order.Order_key) { ezer = true; } } if (ezer == false) // לא נמצא כבר ברשימה { Dal_XML_imp.AddOrderToXml(My_Order.Clone()); ++Configuration.OrderKey; } else // ezer= true { throw new NotImplementedException("ההזמנה נמצאת כבר ברשימה"); } }