//Add and Update for Order public Order AddOrder(Order or) { if (DS.DataSource.AllOrdersList.Count != 0) { var oldo = (from Order item in DS.DataSource.AllOrdersList where (item.GuestRequestKey == or.GuestRequestKey) && (item.HostingUnitKey == or.HostingUnitKey) select item).FirstOrDefault(); if (oldo != null) { throw new MyException("This order is already exist"); } else { or.OrderKey = Configuration.getRunningNumberForOrder(); DS.DataSource.AllOrdersList.Add(or.Clone()); return(or); } } else { or.OrderKey = Configuration.getRunningNumberForOrder(); DS.DataSource.AllOrdersList.Add(or.Clone()); return(or); } }
/// <summary> /// This function addes an <paramref name="order"/> to the data's list /// </summary> /// <exception cref="AlreadyExistsException">Thrown when the key is already in the list</exception> /// <param name="order">Order to be added to the data collection</param> public void AddOrder(Order order) { if (DataSource.ordersList.Exists(x => x.GuestRequestKey == order.GuestRequestKey)) { throw new AlreadyExistsException(order.GuestRequestKey, "Order's GuestRequest"); } if (0 == order.OrderKey) { order.OrderKey = GetOrderKey(); } var linq = from item in DataSource.ordersList where item.OrderKey == order.OrderKey select new { Num = item.OrderKey }; if (linq.Count() == 0) { DataSource.ordersList.Add(order.Clone()); } else { throw new AlreadyExistsException(order.OrderKey, "Order"); } }
public bool AddOrder(Order Aor) { Aor.OrderKey = Configuration.OrderKeySeq++; Aor.CreateDate = DateTime.Now; DataSource.ListOrder.Add(Aor.Clone()); return(true); }
public void updateOrder(Order order) { int index = orderList.FindIndex(Item => Item.OrderKey == order.OrderKey); orderList[index] = order.Clone(); tool.SaveToXML <List <Order> >(orderList, ordersPath); }
public void AddOrder(Order order) { Order orderCopy = (Order)order.Clone(); // Clon orderCopy.OrderKey = Configuration.OrderKey++; DataSource.OrdersCollection.Add(orderCopy); //DataSource.OrdersCollection.Add((Order)order.Clone()); }
public Order getOrder(int id) { Order result = (from o in DataSourceList.Orders where o.OrderKey == id select o).FirstOrDefault(); return(result.Clone()); }
public void AddOrder(Order newOrder) { if (GetOrdersList().Any(x => x.OrderKey == newOrder.OrderKey)) { throw new TzimerException($"Order with the ID: {newOrder.OrderKey} - already exists!", "dal"); } newOrder.OrderKey = Configuration.OrderId++; DataSource.orderList.Add((Order)newOrder.Clone()); }
public bool addOrder(Order order) { if (DataSourceList.Orders.Any(mishehu => mishehu.OrderKey == order.OrderKey)) { return(false); } DataSourceList.Orders.Add(order.Clone()); return(true); }
/// <summary> /// updates a order in the data /// </summary> /// <param name="order"></param> void IDal.UpdateOrder(Order order) { int Index = DataSource.OrdersList.FindIndex(t => t.OrderKey == order.OrderKey); if (Index == -1) { throw new KeyNotFoundException("The Order Not Exist"); } DataSource.OrdersList[Index] = order.Clone(); }
public void AddOrder(Order myOrder) { if (DS.DataSource.OrderList.Exists(x => x.OrderKey == myOrder.OrderKey)) { throw new ExistValueException("Order number exists in the system"); } Configuration.OrderID++; myOrder.OrderKey = Configuration.OrderID; DS.DataSource.OrderList.Add(myOrder.Clone()); }
public void UpdateOrder(Order order) { int index = DataSource.GetOrders().FindIndex(t => t.OrderKey == order.OrderKey); if (index == -1)//meaning id not found { throw new KeyNotFoundException("No order was found!"); } DataSource.GetOrders()[index] = order.Clone();//update the order }
/// <summary> /// a func to add an order to the list /// </summary> /// <param name="ord"></param> public void addOrder(Order ord) { if (checkOrder(ord.OrderKey)) { throw new System.ArgumentException("order already exist!"); } BE.Configurations.orderKey++; ord.OrderKey = BE.Configurations.orderKey; DS1.DataSource.OrderList.Add(ord.Clone()); }
public void addOrder(Order ord) { if (!CheckOrder(ord.OrderKey)) { dataSource.orders.Add(ord.Clone()); } else { throw new Exception("DuplicateIdException"); //TODO // DuplicateIdException() } }
public void UpdateOrder(Order myOrder) { int isExist = DS.DataSource.OrderList.FindIndex(x => x.OrderKey == myOrder.OrderKey); if (isExist == -1) { throw new KeyNotFoundException("Guest Request does not exist in the system"); } DS.DataSource.OrderList.RemoveAt(isExist); DS.DataSource.OrderList.Add(myOrder.Clone()); }
//----------------------------------------------------------------- public void addOrder(Order o) { if (DataSource.orderList.Exists(item => item.OrderKey == o.OrderKey) == true) { throw new ArgumentException("This order already exists"); } else { DataSource.orderList.Add(o.Clone()); Configuration.orderKey++; } }
public void UpdateOrder(Order myOrder) { DS.DataSource.OrderList = LoadListFromXML <Order>(orderRootPath); int isExist = DS.DataSource.OrderList.FindIndex(x => x.OrderKey == myOrder.OrderKey); if (isExist == -1) { throw new KeyNotFoundException("Guest Request does not exist in the system"); } DS.DataSource.OrderList.RemoveAt(isExist); DS.DataSource.OrderList.Add(myOrder.Clone()); SaveListToXML(DS.DataSource.OrderList, orderRootPath); }
public void AddOrder(Order myOrder) { DS.DataSource.OrderList = LoadListFromXML <Order>(orderRootPath); if (DS.DataSource.OrderList.Exists(x => x.OrderKey == myOrder.OrderKey)) { throw new ExistValueException("Order number exists in the system"); } Configuration.OrderID++; myOrder.OrderKey = Configuration.OrderID; DS.DataSource.OrderList.Add(myOrder.Clone()); SaveListToXML(DS.DataSource.OrderList, orderRootPath); UpdateConfig("OrderID", Configuration.OrderID); }
public void AddOrder(Order order) { Order order1 = GetOrder(order.OrderKey); if (order1 == null)//if guest doesnt exist { order.OrderKey = ++(Configuration.OrderKey); DataSource.GetOrders().Add(order.Clone());//adds new order to list of orders(using clone funcion- sends a copy of the original)f } else { throw new DuplicateWaitObjectException("Same order already exists!"); } }
public void updateOrder(Order updateOrder) { if (OrderExist(updateOrder.OrderKey)) { var result = (from Order in DataSource.orders where Order.OrderKey == updateOrder.OrderKey select Order).First(); DataSource.orders.Remove(result); DataSource.orders.Add(updateOrder.Clone()); } else { throw new KeyNotFoundException("aucune commande n'a été trouve"); } }
/// <summary> /// adds a new order to the data /// </summary> /// <param name="order"></param> void IDal.AddOrder(Order order) { var v = from item in DataSource.OrdersList where item.OrderKey == order.OrderKey select item; if (v.FirstOrDefault() != null) { throw new InvalidOperationException("The Order Already Exist"); } order.OrderKey = Configuration.OrderKey++; order.Status = Enums.OrderStatus.NotYetAddressed; order.CreateDate = DateTime.Today; DataSource.OrdersList.Add(order.Clone()); }
// updateOrder function add update Order to Xml data public void updateOrder(Order order) { order = order.Clone(); XElement oldorder = (from orderXml in OrderRoot.Elements() where orderXml.Element("OrderKey").Value == order.OrderKey.ToString() select orderXml).FirstOrDefault(); oldorder.Element("OrderKey").Value = order.OrderKey.ToString(); oldorder.Element("OrderDate").Value = order.OrderDate.ToString(); oldorder.Element("GuestRequestKey").Value = order.GuestRequestKey.ToString(); oldorder.Element("HostingUnitKey").Value = order.HostingUnitKey.ToString(); oldorder.Element("Status").Value = order.Status.ToString(); oldorder.Element("CreateDate").Value = order.CreateDate.ToString(); OrderRoot.Save(OrderPath); }
public void AddOrder(Order o) { try { if (ORexist(o.OrderKey)) { throw new DuplicateWaitObjectException("order already exists"); } else { DataSource.OrderCollection.Add(o.Clone()); } } catch (DuplicateWaitObjectException a) { throw a; } }
public bool updateOrder(Order updateorder) { Order findOrder = (from o in DataSourceList.Orders where o.OrderKey == updateorder.OrderKey select o).FirstOrDefault(); if (findOrder != null) { //findOrder.GuestRequestKey = updateorder.GuestRequestKey; //findOrder.HostingUnitKey = updateorder.HostingUnitKey; //findOrder.OrderDate = updateorder.OrderDate; //findOrder.Status = updateorder.Status; // courtesy of Raphael Ohana findOrder = updateorder.Clone(); return(true); } return(false); }
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 Order UpdateOrder(Order or) { Order item = DS.DataSource.AllOrdersList.Find(x => x.OrderKey == or.OrderKey); if (item == null) { if (or.OrderKey == 0) { or.OrderKey = Configuration.getRunningNumberForOrder(); } DS.DataSource.AllOrdersList.Add(or.Clone()); throw new MyException("This order does not exist", or); } else { DS.DataSource.AllOrdersList.Remove(item); DS.DataSource.AllOrdersList.Add(or); return(or); } }
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("ההזמנה נמצאת כבר ברשימה"); } }
public Order search_o(int id) { Load_order(); Order temp = new Order(); try { temp = (from O in order_root.Elements() where int.Parse(O.Element("Order_code").Value) == id let list = ids(O.Element("dishes_ids")) select new Order() { get_av_cour = int.Parse(O.Element("available_couriers").Value), Get_branch_id = int.Parse(O.Element("branch_id").Value), Get_client_id = int.Parse(O.Element("id_client").Value), get_order_bill = int.Parse(O.Element("order_bill").Value), get_location = (Location)Enum.Parse(typeof(Location), O.Element("Location").Value), Get_Order_code = int.Parse(O.Element("Order_code").Value), Get_time = Convert.ToDateTime(O.Element("Time").Value), get_list = list }).FirstOrDefault(); if (temp != null) { return((Order)temp.Clone()); } else { temp.Get_Order_code = 0; return(temp); } } catch (NullReferenceException NULL) { Console.WriteLine("search_o {0} \n", NULL.Message); return(temp); } }
public void updateOrder(Order order) { int index = DataSource.orders.FindIndex(Item => Item.OrderKey == order.OrderKey); DataSource.orders[index] = order.Clone(); }
public void addOrder(Order order) { DataSource.orders.Add(order.Clone()); }
public void addOrder(Order order) { orderList.Add(order.Clone()); tool.SaveToXML <List <Order> >(orderList, ordersPath); SaveConfigurationToXML(); }