コード例 #1
0
 public CreateOrderViewModel(CreateOrder createOrderOpen, string username)
 {
     createOrder = createOrderOpen;
     InputName   = username;
     CakeList    = new tblCakeList();
     View        = new vwOrder();
     ViewList    = getOrders();
 }
コード例 #2
0
 //poziva pri otvaranju prozora AddBoss pri dodavanju novih boss
 public AddOrderViewModel(AddOrder addOrderOpen)
 {
     order    = new vwOrder();
     addOrder = addOrderOpen;
     edit     = false;
     using (Service1Client wcf = new Service1Client())
     {
         EmployeeList = wcf.GetAllEmployee(null).ToList();
         AlbumList    = wcf.GetAllAlbum(null).ToList();
         CustomerList = wcf.GetAllCustomer(null).ToList();
     }
 }
コード例 #3
0
 //poziva pri otvaranju prozora AddBoss ali pri editovanju nekog boss
 public AddOrderViewModel(AddOrder addOrderOpen, vwOrder OrderEdit)
 {
     order    = OrderEdit;
     addOrder = addOrderOpen;
     edit     = true;
     edited   = true;
     using (Service1Client wcf = new Service1Client())
     {
         EmployeeList = wcf.GetAllEmployee(null).ToList();
         AlbumList    = wcf.GetAllAlbum(null).ToList();
         CustomerList = wcf.GetAllCustomer(null).ToList();
     }
 }
コード例 #4
0
 public void ConfirmOrder(vwOrder order)
 {
     try
     {
         using (DAN_XLVIIIEntities context = new DAN_XLVIIIEntities())
         {
             tblOrder orderToEdit = context.tblOrders.Where(x => x.OrderID == order.OrderID).FirstOrDefault();
             orderToEdit.OrderDate = DateTime.Now;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Exception" + ex.Message.ToString());
     }
 }
コード例 #5
0
 public void DenyOrder(vwOrder order)
 {
     try
     {
         using (DAN_XLVIIIEntities context = new DAN_XLVIIIEntities())
         {
             tblOrder orderToReject = context.tblOrders.Where(x => x.OrderID == order.OrderID).FirstOrDefault();
             orderToReject.OrderStatus = "denied";
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Exception" + ex.Message.ToString());
     }
 }
コード例 #6
0
 private vwOrder FindOrderByID(int id)
 {
     try
     {
         using (DAN_XLVIIIEntities context = new DAN_XLVIIIEntities())
         {
             vwOrder order = (from x in context.vwOrders where x.OrderID == id select x).FirstOrDefault();
             return(order);
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Exception " + ex.Message.ToString());
         return(null);
     }
 }
コード例 #7
0
 /// <summary>
 /// Change order status to approved and saves changes to database.
 /// </summary>
 /// <param name="order">Order for approval.</param>
 public void ApproveOrder(vwOrder order)
 {
     try
     {
         using (PizzeriaEntities context = new PizzeriaEntities())
         {
             tblOrder orderToApprove = context.tblOrders.Where(x => x.OrderId == order.OrderId).FirstOrDefault();
             orderToApprove.OrderStatus = "approved";
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Exception" + ex.Message.ToString());
     }
 }
コード例 #8
0
 /// <summary>
 /// Order rejection method
 /// </summary>
 private void DiscardOrderExecute()
 {
     try
     {
         using (PizzaRestoranEntities context = new PizzaRestoranEntities())
         {
             tblOrder order = (from r in context.tblOrders where r.OrderID == PendingOrder.OrderID select r).First();
             order.OrderStatus = 3;
             order.Archived    = 1;
             context.SaveChanges();
             vwOrder OrderEmail = (from r in context.vwOrders where r.OrderID == PendingOrder.OrderID select r).First();
         }
         approveReject.Close();
     }
     catch (Exception)
     {
     }
 }
コード例 #9
0
 /// <summary>
 /// Method for adding ordered item to OrderItem table and saves changes into database.
 /// </summary>
 /// <param name="menuItem">Item from menu.</param>
 /// <param name="order">Which order to add item.</param>
 /// <param name="quantity">Quatity of item.</param>
 public void AddOrderItem(vwMenu menuItem, vwOrder order, int quantity)
 {
     try
     {
         using (PizzeriaEntities context = new PizzeriaEntities())
         {
             tblOrderItem itemToAdd = new tblOrderItem
             {
                 ItemId   = menuItem.ItemId,
                 Quantity = quantity,
                 OrderID  = order.OrderId
             };
             context.tblOrderItems.Add(itemToAdd);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Exception" + ex.Message.ToString());
     }
 }
コード例 #10
0
 public AddOrder(vwOrder orderEdit)
 {
     InitializeComponent();
     this.DataContext = new AddOrderViewModel(this, orderEdit);
 }