Пример #1
0
 private void Delete()
 {
     svcOrder.OrderServiceClient c = new svcOrder.OrderServiceClient();
     c.DeleteOrder(this.OrderId);
     //refresh customer's list view
     this.Customer.Orders = this.Customer.GetOrders();
 }
Пример #2
0
 internal ObservableCollection <OrderViewModel> GetOrders()
 {
     orders = new ObservableCollection <OrderViewModel>();
     //get the orders from the service tier
     svcOrder.OrderServiceClient c = new svcOrder.OrderServiceClient();
     foreach (svcOrder.Order i in c.GetOrderByCustomer(this.CustomerId))
     {
         OrderViewModel order = new OrderViewModel(i);
         order.Customer = this;
         orders.Add(order);
     }
     return(orders);
 }
Пример #3
0
 private void Update()
 {
     svcOrder.OrderServiceClient c = new svcOrder.OrderServiceClient();
     if (this.Mode == ViewModel.Mode.Add)  //if adding an order
     {
         c.AddOrder(this.Customer.CustomerId,
                    new svcOrder.Order {
             Description = this.Description,
             Quantity    = int.Parse(this.Quantity)
         });
         this.Customer.Orders = this.Customer.GetOrders();
     }
     else if (this.Mode == ViewModel.Mode.Edit)  //if editing an order
     {
         c.UpdateOrder(new svcOrder.Order
         {
             OrderId     = this.OrderId,
             Description = this.Description,
             Quantity    = int.Parse(this.Quantity)
         });
         //copy the current value so in case cancel you can undo
         this.originalValue = (OrderViewModel)this.MemberwiseClone();
     }
 }