Exemplo n.º 1
0
        //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);
            }

            
            
        }        
Exemplo n.º 2
0
 public void Delete(Order order)
 {
     _databasecontext.Orders.Remove(order);
     _databasecontext.SaveChanges();
 }
Exemplo n.º 3
0
 public Order Update(Order order)
 {
     //_databasecontext.Entry(order).State = EntityState.Modified;
     _databasecontext.SaveChanges();
     return order;
 }
Exemplo n.º 4
0
 public Order Add(Order order)
 {
     _databasecontext.Orders.Add(order);
     _databasecontext.SaveChanges();
     return order;
 }
Exemplo n.º 5
0
 public void SetDispatched(Order order)
 {
     var orderDa = new OrderDa(databasecontext);
     order.Status = (int)OrderStatus.Dispatched;         
     orderDa.Update(order);
 }
Exemplo n.º 6
0
 public void SetReady(Order order)
 {
     var orderDa= new OrderDa(databasecontext);
     order.Status = (int)OrderStatus.Ready;            
     orderDa.Update(order);
 }