コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        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));
                }
            }
        }