private void Set_Primary_Button_Click(object sender, RoutedEventArgs e) { Salesperson s = currSalespersonsLV.SelectedItem as Salesperson; if (s != null) { editsMade = true; district.PrimarySalesperson = s; DistrictInfo.Content = null; DistrictInfo.Content = district; } }
private void Add_Button_Click(object sender, RoutedEventArgs e) { Salesperson s = allSalespersonsLV.SelectedItem as Salesperson; if (s != null) { editsMade = true; remainingSalespersons.Remove(s); var salespersons = district.Salespersons as List <Salesperson>; salespersons.Add(s); district.Salespersons = salespersons; currSalespersonsLV.Items.Refresh(); allSalespersonsLV.Items.Refresh(); } }
private void Remove_Button_Click(object sender, RoutedEventArgs e) { Salesperson s = currSalespersonsLV.SelectedItem as Salesperson; if (s != null) { if (s.Id != district.PrimarySalesperson.Id) { editsMade = true; remainingSalespersons.Add(s); var salespersons = district.Salespersons as List <Salesperson>; salespersons.Remove(s); district.Salespersons = salespersons; currSalespersonsLV.Items.Refresh(); allSalespersonsLV.Items.Refresh(); } else { MessageBox.Show(String.Format("Cannot remove salesperson: {0}. \nThey are currently the primary salesperson for this district. " + "\nSet a new primary salesperson before removing.", s.Name)); } } }