Esempio n. 1
0
 private void btCopy_Click( object sender, RoutedEventArgs e )
 {
     TbId.Text = "";
     CbExistingModifier.SelectedItem = null;
     BtAdd.Visibility = Visibility.Visible;
     BtAdd.IsEnabled = true;
     BtUpdate.Visibility = Visibility.Hidden;
     BtUpdate.IsEnabled = false;
     _selectedModifier = null;
 }
Esempio n. 2
0
 private void btClear_Click( object sender, RoutedEventArgs e )
 {
     CbExistingModifier.SelectedItem = null;
     BtAdd.Visibility = Visibility.Visible;
     BtAdd.IsEnabled = true;
     BtUpdate.Visibility = Visibility.Hidden;
     BtUpdate.IsEnabled = false;
     _selectedModifier = null;
     TbId.Text = "";
     TbModifierName.Text = "";
     TbNotes.Text = "";
     TbDiscription.Text = "";
     TbModProp.Text = "";
     CbGroup.SelectedItem = null;
     CbSubGroup.SelectedItem = null;
 }
Esempio n. 3
0
 private void btAdd_Click( object sender, RoutedEventArgs e )
 {
     using (var context = new Db1Entities())
     {
         var addModifier = new Modifier
         {
             Name = TbModifierName.Text,
             Notes = TbNotes.Text,
             Description = TbDiscription.Text,
             Modifying_Property = TbModProp.Text,
             Group = CbGroup.Text,
             SubGroup = CbSubGroup.Text
         };
         context.Modifier.Add(addModifier);
         context.SaveChanges();
     }
     InitForm();
     btClear_Click(this, null);
 }
Esempio n. 4
0
 private void cbExistingModifier_SelectionChanged( object sender, SelectionChangedEventArgs e )
 {
     if (CbExistingModifier.SelectedItem != null)
     {
         BtAdd.Visibility = Visibility.Hidden;
         BtAdd.IsEnabled = false;
         BtUpdate.Visibility = Visibility.Visible;
         BtUpdate.IsEnabled = true;
         BtDelete.IsEnabled = true;
         _selectedModifier = CbExistingModifier.SelectedItem as Modifier;
         if (_selectedModifier == null)
         {
             return;
         }
         TbId.Text = _selectedModifier.Id.ToString();
         TbModifierName.Text = _selectedModifier.Name;
         TbNotes.Text = _selectedModifier.Notes;
         TbDiscription.Text = _selectedModifier.Description;
         TbModProp.Text = _selectedModifier.Modifying_Property;
         CbGroup.Text = _selectedModifier.Group;
         CbSubGroup.Text = _selectedModifier.SubGroup.Replace(" ", "");
     }
     else
     {
         BtDelete.IsEnabled = false;
     }
 }