private void AddOrder_Click(object sender, RoutedEventArgs e) { var ordVM = new OrderViewModel(); ordVM.OrderData_Payment = "01.01.2017"; ordVM.OrderData_Shipment = "01.01.2017"; EditWindowOrder ew = new EditWindowOrder(ordVM); var result = ew.ShowDialog(); if (result == true) { var client = ClientBox.SelectedItem as ClientViewModel; client.Orders.Add(ordVM); orderService.AddOrderToClient(client.ClientID, ordVM); ew.Close(); //orgs = orgService.GetAll(); //clients = clientService.GetAll(); orders = orderService.GetAll(); //OrgBox.ItemsSource = orgs; //ClientBox.ItemsSource = clients; OrderBox.ItemsSource = orders; payments = paymentService.GetAll(); PaymentGrid.ItemsSource = payments; } }
private void UpdateOrder_Click(object sender, RoutedEventArgs e) { OrderViewModel ordVM = OrderBox.SelectedItem as OrderViewModel; EditWindowOrder ew = new EditWindowOrder(ordVM); var result = ew.ShowDialog(); if (result == true) { orderService.Update(ordVM); ew.Close(); orgs = orgService.GetAll(); clients = clientService.GetAll(); orders = orderService.GetAll(); OrgBox.ItemsSource = orgs; ClientBox.ItemsSource = clients; OrderBox.ItemsSource = orders; } }