示例#1
0
        void btnAdd_Click(object sender, EventArgs e)
        {
            using (FormSkillDetails frmSkillDetails = new FormSkillDetails())
            {
                frmSkillDetails.ShowDialog();

                if (frmSkillDetails.Skill != null)
                {
                    AddSkill(frmSkillDetails.Skill);
                }
            }
        }
示例#2
0
        void btnAdd_Click(object sender, EventArgs e)
        {
            using (FormSkillDetails frmSkillDetails = new FormSkillDetails())
            {
                frmSkillDetails.ShowDialog();

                if (frmSkillDetails.Skill != null)
                {
                    AddSkill(frmSkillDetails.Skill);
                }
            }
        }
示例#3
0
        void btnEdit_Click(object sender, EventArgs e)
        {
            if (lbDetails.SelectedItem != null)
            {
                string   detail = lbDetails.SelectedItem.ToString();
                string[] parts  = detail.Split(',');
                string   entity = parts[0].Trim();

                SkillData data    = skillManager.SkillData[entity];
                SkillData newData = null;

                using (FormSkillDetails frmSkillData = new FormSkillDetails())
                {
                    frmSkillData.Skill = data;
                    frmSkillData.ShowDialog();

                    if (frmSkillData.Skill == null)
                    {
                        return;
                    }

                    if (frmSkillData.Skill.Name == entity)
                    {
                        skillManager.SkillData[entity] = frmSkillData.Skill;
                        FillListBox();

                        return;
                    }
                    newData = frmSkillData.Skill;
                }

                DialogResult result = MessageBox.Show(
                    "Name has changed. Do you want to add a new entry?",
                    "New Entry",
                    MessageBoxButtons.YesNo);

                if (result == DialogResult.No)
                {
                    return;
                }

                if (skillManager.SkillData.ContainsKey(newData.Name))
                {
                    MessageBox.Show("Entry already exists. Use Edit to modify the entry.");
                    return;
                }

                lbDetails.Items.Add(newData);
                skillManager.SkillData.Add(newData.Name, newData);
            }
        }
示例#4
0
        void btnEdit_Click(object sender, EventArgs e)
        {
            if (lbDetails.SelectedItem != null)
            {
                string detail = lbDetails.SelectedItem.ToString();
                string[] parts = detail.Split(',');
                string entity = parts[0].Trim();

                SkillData data = skillManager.SkillData[entity];
                SkillData newData = null;

                using (FormSkillDetails frmSkillData = new FormSkillDetails())
                {
                    frmSkillData.Skill = data;
                    frmSkillData.ShowDialog();

                    if (frmSkillData.Skill == null)
                        return;

                    if (frmSkillData.Skill.Name == entity)
                    {
                        skillManager.SkillData[entity] = frmSkillData.Skill;
                        FillListBox();
                        return;
                    }

                    newData = frmSkillData.Skill;
                }

                DialogResult result = MessageBox.Show(
                    "Name has changed. Do you want to add a new entry?",
                    "New Entry",
                    MessageBoxButtons.YesNo);

                if (result == DialogResult.No)
                    return;

                if (skillManager.SkillData.ContainsKey(newData.Name))
                {
                    MessageBox.Show("Entry already exists. Use Edit to modify the entry.");
                    return;
                }

                lbDetails.Items.Add(newData);
                skillManager.SkillData.Add(newData.Name, newData);
            }
        }