Example #1
0
        private void listBoxRisk_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (listBoxRisk.SelectedItem == null)
            {
                return;
            }

            string RiskString = (string)listBoxRisk.SelectedItem;
            string name       = "";

            string[] array = RiskString.Split('-');
            name = array[0].Trim();

            Risk current = this.p.GetRisks().Find(r => r.GetName().Equals(name));

            FormRisk editRisk = new FormRisk(this.p.GetRisks());

            editRisk.risk   = current;
            editRisk.Name   = current.GetName();
            editRisk.Status = current.GetStatus();

            DialogResult result = editRisk.ShowDialog();

            listBoxRisk.Items.Remove(current.GetName() + "   -   Status: " + current.GetStatus());

            if (result == DialogResult.OK)
            {
                current.SetName(editRisk.Name);
                current.SetStatus(editRisk.Status);
            }


            listBoxRisk.Items.Add(current.GetName() + "   -   Status: " + current.GetStatus());
        }
Example #2
0
        private void buttonAdd4_Click(object sender, EventArgs e)
        {
            label12.Text = "";
            label14.Text = "";
            if (textBox4.Text.Equals(""))
            {
                label12.Text = "Enter a Risk name";
                return;
            }
            if (comboBox1.SelectedItem == null)
            {
                label14.Text = "Select a Risk Status";
                return;
            }


            string riskName   = (string)textBox4.Text;
            string riskStatus = (string)comboBox1.Text;
            Risk   newRisk    = new Risk(riskName, riskStatus);

            Risk exists = this.p.GetRisks().Find(r => r.GetName().Equals(newRisk.GetName()));

            if (exists == null)
            {
                p.AddRisk(newRisk);
                listBoxRisk.Items.Add(newRisk.GetName() + "   -   Status: " + newRisk.GetStatus());
                label12.Text           = "";
                textBox4.Text          = "";
                comboBox1.SelectedItem = null;
                return;
            }
            label12.Text = "Already exists";
        }
Example #3
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (textBox1.Text.Equals(""))
            {
                label3.Text     = "Can't be empty";
                button1.Enabled = false;
                return;
            }
            this.Status = (string)comboBox1.SelectedItem;
            Risk exists = this.Risks.Find(r => r.GetName() == textBox1.Text);

            if (exists != null)
            {
                if (!exists.GetStatus().Equals(this.Status))
                {
                    label3.Text     = "";
                    button1.Enabled = true;
                    return;
                }
                label3.Text     = "Already Exists";
                button1.Enabled = false;
                return;
            }
            label3.Text     = "";
            button1.Enabled = true;
        }
Example #4
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (textBox1.Text.Equals(""))
            {
                label3.Text     = "Can't be empty";
                button1.Enabled = false;
                return;
            }
            Risk exists = this.Risks.Find(r => r.GetName() == textBox1.Text);

            if (exists != null)
            {
                label3.Text     = "Already Exists";
                button1.Enabled = false;
                return;
            }
            label3.Text     = "";
            button1.Enabled = true;
        }
Example #5
0
        private void button5_Click(object sender, EventArgs e)
        {
            string RiskString = (string)listBoxRisk.SelectedItem;

            if (RiskString == null)
            {
                label12.Text = "Select a risk";
                return;
            }

            string name = "";

            string[] array = RiskString.Split('-');
            name = array[0].Trim();

            Risk current = this.p.GetRisks().Find(r => r.GetName().Equals(name));

            listBoxRisk.Items.Remove(current.GetName() + "   -   Status: " + current.GetStatus());
            p.RemoveRisk(current);
            label12.Text = "";
        }
Example #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Equals(""))
            {
                return;
            }

            Risk exists = this.Risks.Find(r => r.GetName() == textBox1.Text);

            if (exists == null)
            {
                Name   = textBox1.Text;
                Status = (string)comboBox1.SelectedItem;
                return;
            }
            else if (exists == this.risk)
            {
                Status = (string)comboBox1.SelectedItem;
                return;
            }
        }