예제 #1
0
 private void btnLevelAdd_Click(object sender, EventArgs e)
 {
     using (SkillLevelEditForm frm = new SkillLevelEditForm(skillBindingSource.Current as Skill)
     {
         sl = new SkillLevel()
     })
     {
         if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             db.InsertSkillLevel(frm.sl);
             skillLevelBindingSource.DataSource = db.GetSkillLevels(skillBindingSource.Current as Skill);
             skillLevelBindingSource.MoveLast();
         }
     }
 }
예제 #2
0
        private void btnLevelEdit_Click(object sender, EventArgs e)
        {
            SkillLevel obj = skillLevelBindingSource.Current as SkillLevel;

            if (obj != null)
            {
                using (SkillLevelEditForm frm = new SkillLevelEditForm(skillBindingSource.Current as Skill)
                {
                    sl = obj
                })
                {
                    if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        skillLevelBindingSource.EndEdit();
                        db.UpdateSkillLevel(obj);
                        PopulateSkillsList();
                        btnEdit.Focus();
                    }
                }
            }
        }