예제 #1
0
        private void concludeButton_Click(object sender, EventArgs e)
        {
            string safetyMeasures = "";

            foreach (string item in safetyMeasuresListBox.Items.Cast <String>().ToList())
            {
                safetyMeasures += item + "\n";
            }

            createdRisk = new Risk(
                riskComboBox.Text,
                dangerComboBox.Text,
                safetyMeasures,
                frequencyClassificationComboBox.Text,
                severityClassificationComboBox.Text);

            try
            {
                createdRisk.CheckValidity();
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                createdRisk = null;
            }
        }
예제 #2
0
        private void CreateRiskList()
        {
            data = new List <Risk>();
            foreach (DataGridViewRow row in riskDataGridView.Rows)
            {
                if (row.Cells[0] != null && row.Cells[0].Value != null)
                {
                    Risk risk = new Risk(
                        row.Cells[0].Value.ToString(),
                        row.Cells[1].Value.ToString(),
                        row.Cells[2].Value.ToString(),
                        row.Cells[3].Value == null ? "" : row.Cells[3].Value.ToString(),
                        row.Cells[4].Value == null ? "" : row.Cells[4].Value.ToString());

                    risk.CheckValidity();
                    data.Add(risk);
                }
            }
        }