/// <summary> /// Change selected account /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgAccounts_SelectionChanged(object sender, SelectionChangedEventArgs e) { DirectProductCosts.Clear(); account = dgAccounts.SelectedItem as Account; DirectProductCosts = new ObservableCollection <DirectProductCost>(DCPPDManagement.Instance.GetDirectProductCostByAccount(account, DepartmentID)); dgDPPC.ItemsSource = DirectProductCosts; lblSum.Content = "Summa: " + DCPPDManagement.Instance.CalculateSum(account, DepartmentID); btnSelectProduct.IsEnabled = true; }
private void cbDepartments_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!IsLoaded) { return; } DepartmentID = Departments[cbDepartments.SelectedIndex].DepartmentID; if (dgAccounts.SelectedItem != null) { DirectProductCosts.Clear(); account = dgAccounts.SelectedItem as Account; DirectProductCosts = new ObservableCollection <DirectProductCost>(DCPPDManagement.Instance.GetDirectProductCostByAccount(account, DepartmentID)); dgDPPC.ItemsSource = DirectProductCosts; lblSum.Content = "Summa: " + DCPPDManagement.Instance.CalculateSum(account, DepartmentID); btnSelectProduct.IsEnabled = true; } LockedSettings(); }