private void btAdd_Click( object sender, RoutedEventArgs e ) { int result; int.TryParse(TbPoints.Text, out result); using (var context = new Db1Entities()) { var addSkill = new Skills { SkillName = TbSkillName.Text, DifficultyLevel = TbDifficultyLevel.Text, notes = TbNotes.Text, points = result, reference = TbReference.Text, tech_level = TbTechLevel.Text, ControllingAttribute = TbControllingAttribute.Text, Description = TbDiscription.Text, Defaults = TbDefault.Text, Prerequisites = TbPrerequisite.Text }; //AddSkill.specialization = tbSpecialization.Text; //AddSkill.Modifiers = tbModifiers.Text; context.Skills.Add(addSkill); context.SaveChanges(); } InitForm(); btClear_Click(this, null); }
private void btClear_Click( object sender, RoutedEventArgs e ) { CbExistingSkill.SelectedItem = null; BtAdd.Visibility = Visibility.Visible; BtAdd.IsEnabled = true; BtUpdate.Visibility = Visibility.Hidden; BtUpdate.IsEnabled = false; _selectedSkill = null; TbId.Text = ""; TbSkillName.Text = ""; TbSkillNameP1.Text = ""; TbDifficultyLevel.Text = ""; TbNotes.Text = ""; TbPoints.Text = ""; TbReference.Text = ""; //tbSpecialization.Text = ""; TbTechLevel.Text = ""; TbControllingAttribute.Text = ""; TbDiscription.Text = ""; //tbModifiers.Text = ""; TbDefault.Text = ""; TbPrerequisite.Text = ""; }
private void cbExistingSkill_SelectionChanged( object sender, SelectionChangedEventArgs e ) { if (CbExistingSkill.SelectedItem != null) { BtAdd.Visibility = Visibility.Hidden; BtAdd.IsEnabled = false; BtUpdate.Visibility = Visibility.Visible; BtUpdate.IsEnabled = true; BtDelete.IsEnabled = true; _selectedSkill = CbExistingSkill.SelectedItem as Skills; if (_selectedSkill != null) { TbId.Text = _selectedSkill.Id.ToString(); TbSkillName.Text = _selectedSkill.SkillName; TbDifficultyLevel.Text = _selectedSkill.DifficultyLevel; TbNotes.Text = _selectedSkill.notes; TbPoints.Text = _selectedSkill.points?.ToString(); TbReference.Text = _selectedSkill.reference; //tbSpecialization.Text = _selectedSkill.specialization?.ToString(); TbTechLevel.Text = _selectedSkill.tech_level; TbControllingAttribute.Text = _selectedSkill.ControllingAttribute; TbDiscription.Text = _selectedSkill.Description; //tbModifiers.Text = _selectedSkill.Modifiers?.ToString(); TbDefault.Text = _selectedSkill.Defaults; TbPrerequisite.Text = _selectedSkill.Prerequisites; } PreparePage1(); PreparePage2(); } else { BtDelete.IsEnabled = false; } }
public static void CheckPrereqString( Skills skill ) { }