//read file public void PrecessFile(FileInfo file) { string orderNumber; DateTime dateTime; OrderStatus status = OrderStatus.Pending; Order order = new Order(); OrderBl orderBl = new OrderBl(); OrderItemBl orderItem = new OrderItemBl(); XmlDocument doc = new XmlDocument(); doc.Load(file.FullName); dateTime = file.CreationTime; TransferFile(file); //nodes XmlNode orderNumberNode = doc.SelectSingleNode("order/ordernumber"); XmlNodeList itemsNodes = doc.SelectNodes("order/items/item"); orderNumber = orderNumberNode.InnerText; //Send information to database order = orderBl.Save(order.Id, orderNumber, status, dateTime); foreach(XmlNode node in itemsNodes) { orderItem.Save(0, order.Id, node.InnerText); } }
public void Delete(Order order) { _databasecontext.Orders.Remove(order); _databasecontext.SaveChanges(); }
public Order Update(Order order) { //_databasecontext.Entry(order).State = EntityState.Modified; _databasecontext.SaveChanges(); return order; }
public Order Add(Order order) { _databasecontext.Orders.Add(order); _databasecontext.SaveChanges(); return order; }
public void SetDispatched(Order order) { var orderDa = new OrderDa(databasecontext); order.Status = (int)OrderStatus.Dispatched; orderDa.Update(order); }
public void SetReady(Order order) { var orderDa= new OrderDa(databasecontext); order.Status = (int)OrderStatus.Ready; orderDa.Update(order); }