private void TabEditCustomer_GotFocus(object sender, RoutedEventArgs e) { if (DGCustomerView.SelectedItem == null) { lblCustomerError.Content = "Please select a customer first from above grid"; TabViewCustomer.Focus(); switchCanvas("Active"); return; } lblCustomerError.Content = ""; RegionsManager regionsManager = new RegionsManager(); regions = regionsManager.retrieveAllRegions(); ComboCustomerEditRegionID.Items.Clear(); foreach (var item in regions) { ComboCustomerEditRegionID.Items.Add(item.RegionId); } switchCanvas("Edit"); oldCustomer = (Customer)DGCustomerView.SelectedItem; txtCustomerEditFirstName.Text = oldCustomer.FirstName; txtCustomerEditMIDName.Text = oldCustomer.MiddleName; txtCustomerEditLastName.Text = oldCustomer.LastName; txtCustomerEditPhoneNumber.Text = oldCustomer.PhoneNumber; txtCustomerEditEmail.Text = oldCustomer.Email; txtCustomerEditRegionID.Text = oldCustomer.RegionID; txtCustomerEditAddressLine.Text = oldCustomer.AddressLine; chkCustomerEditActive.IsChecked = oldCustomer.Active; }
private void btnCustomerEdit_Click(object sender, RoutedEventArgs e) { if (DGCustomerView.SelectedItem == null) { lblCustomerError.Content = "Please select a customer first from above grid"; TabViewCustomer.Focus(); switchCanvas("Active"); return; } lblCustomerError.Content = ""; switchCanvas("Edit"); oldCustomer = (Customer)DGCustomerView.SelectedItem; txtCustomerEditFirstName.Text = oldCustomer.FirstName; txtCustomerEditMIDName.Text = oldCustomer.MiddleName; txtCustomerEditLastName.Text = oldCustomer.LastName; txtCustomerEditPhoneNumber.Text = oldCustomer.PhoneNumber; txtCustomerEditEmail.Text = oldCustomer.Email; txtCustomerEditRegionID.Text = oldCustomer.RegionID; txtCustomerEditAddressLine.Text = oldCustomer.AddressLine; chkCustomerEditActive.IsChecked = oldCustomer.Active; }