public MainWindow() { InitializeComponent(); orgService = new OrgService("TestDbConnection"); clientService = new ClientService("TestDbConnection"); orderService = new OrderService("TestDbConnection"); paymentService = new PaymentService("TestDbConnection"); orgs = orgService.GetAll(); OrgBox.ItemsSource = orgs; //ClientBox.DataContext = orgs; //OrderBox.DataContext = orgs; //var curorg = (OrgViewModel)OrgBox.SelectedItem; //clients = curorg.Clients; //ClientBox.ItemsSource = clients; //orders = orderService.GetAll(); //OrderBox.DataContext = orders; //payments = paymentService.GetAll(); //PaymentGrid.ItemsSource = payments; }
private void AddOrg_Click(object sender, RoutedEventArgs e) { var orVM = new OrgViewModel(); EditWindowOrg ew = new EditWindowOrg(orVM); var result = ew.ShowDialog(); if (result == true) { orgService.Create(orVM); ew.Close(); orgs = orgService.GetAll(); OrgBox.ItemsSource = orgs; clients = clientService.GetAll(); ClientBox.ItemsSource = clients; orders = orderService.GetAll(); OrderBox.ItemsSource = orders; payments = paymentService.GetAll(); PaymentGrid.ItemsSource = payments; } }