Пример #1
0
 private void btnSaveContactType_Click(object sender, RoutedEventArgs e)
 {
     if (lvContactTypes.SelectedItem != null)
     {
         ContactTypeBO bo = new ContactTypeBO((lvContactTypes.SelectedItem as ContactTypeBO).Id, txtContactTypeName.Text);
         bo.AddOrUpdate();
         lvContactTypes.ItemsSource = _vm.ContactTypes;
         lvContactTypes.UpdateLayout();
     }
     else
     {
         MessageBoxResult result = MessageBox.Show("Select a Contact Type to edit first", "Warning", MessageBoxButton.OK);
     }
     e.Handled = true;
 }
Пример #2
0
 private void btnAddContactType_Click(object sender, RoutedEventArgs e)
 {
     if (!txtContactTypeName.Text.Equals(""))
     {
         if (txtContactTypeName.Text.Length > 32)
         {
             MessageBoxResult result = MessageBox.Show("Contact Type name can not be longer than 32", "Warning", MessageBoxButton.OK);
         }
         else
         {
             ContactTypeBO bo = new ContactTypeBO(txtContactTypeName.Text);
             bo.AddOrUpdate();
             lvContactTypes.ItemsSource = _vm.ContactTypes;
             lvContactTypes.UpdateLayout();
         }
     }
     else
     {
         MessageBoxResult result = MessageBox.Show("Contact Type name can not be empty", "Warning", MessageBoxButton.OK);
     }
     e.Handled = true;
 }