//private void dataGridViewSources_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        //{
        //    if (e.ColumnIndex == 1 && dataGridViewSources.RowCount > 1)
        //    {
        //        if (Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value) != 0 && e.RowIndex != 0 && e.RowIndex != 8 && e.RowIndex != 12 && e.RowIndex != 16 && e.RowIndex != 22)
        //            dataGridViewSources[1, e.RowIndex].Value = "1";
        //        if (e.RowIndex < 12)
        //        {
        //            rs.eventIdentifyRisk[0][e.RowIndex] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
        //        }
        //        else if (e.RowIndex < 22)
        //        {
        //            rs.eventIdentifyRisk[1][e.RowIndex - 12] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
        //        }
        //        else if (e.RowIndex < 34)
        //        {
        //            rs.eventIdentifyRisk[2][e.RowIndex - 22] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
        //        }
        //        else if (e.RowIndex < 51)
        //        {
        //            rs.eventIdentifyRisk[3][e.RowIndex - 34] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
        //        }

        //        rs.CountPotentialRiskEvents();
        //        ShowResult();
        //    }
        //}

        private void dataGridViewSources1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 1 && dataGridViewSources.RowCount > 1)
            {
                if (Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value) != 0 && e.RowIndex != 0 && e.RowIndex != 12 && e.RowIndex != 22 && e.RowIndex != 34 && e.RowIndex != 51)
                {
                    dataGridViewSources[1, e.RowIndex].Value = "1";
                }
                if (e.RowIndex < 12)
                {
                    rs.eventIdentifyRisk[0][e.RowIndex] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
                }
                else if (e.RowIndex < 22)
                {
                    CheckCorrect(e.RowIndex);
                    rs.eventIdentifyRisk[1][e.RowIndex - 12] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
                }
                else if (e.RowIndex < 34)
                {
                    CheckCorrect(e.RowIndex);
                    rs.eventIdentifyRisk[2][e.RowIndex - 22] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
                }
                else if (e.RowIndex < 51)
                {
                    CheckCorrect(e.RowIndex);
                    rs.eventIdentifyRisk[3][e.RowIndex - 34] = Convert.ToInt32(dataGridViewSources[1, e.RowIndex].Value);
                }

                rs.CountPotentialRiskEvents();
                ShowResult();
            }
        }
        public FormPotentialRiskEvents(RiskManagement _rs)
        {
            rs = _rs;
            InitializeComponent();

            rs.CountPotentialRiskEvents();
            CreateTable();
        }
Esempio n. 3
0
        private void dataGridViewSources_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            double numb;

            if (e.ColumnIndex > 0 && e.ColumnIndex < 10 && dataGridViewSources.RowCount > 1)
            {
                if (double.TryParse(dataGridViewSources[e.ColumnIndex, e.RowIndex].Value.ToString(), out numb) && numb >= 0 && numb <= 1)
                {
                    if (e.RowIndex < 12)
                    {
                        rs.analisIdentifyRisk[0][e.RowIndex, e.ColumnIndex - 1] = numb;
                        dataGridViewSources[e.ColumnIndex, e.RowIndex].Value    = numb.ToString();
                    }
                    else if (e.RowIndex < 22)
                    {
                        rs.analisIdentifyRisk[1][e.RowIndex - 12, e.ColumnIndex - 1] = numb;
                        dataGridViewSources[e.ColumnIndex, e.RowIndex].Value         = numb.ToString();
                    }
                    else if (e.RowIndex < 34)
                    {
                        rs.analisIdentifyRisk[2][e.RowIndex - 22, e.ColumnIndex - 1] = numb;
                        dataGridViewSources[e.ColumnIndex, e.RowIndex].Value         = numb.ToString();
                    }
                    else if (e.RowIndex < 51)
                    {
                        rs.analisIdentifyRisk[3][e.RowIndex - 34, e.ColumnIndex - 1] = numb;
                        dataGridViewSources[e.ColumnIndex, e.RowIndex].Value         = numb.ToString();
                    }
                }
                else
                {
                    dataGridViewSources[e.ColumnIndex, e.RowIndex].Value = "0";
                }
                rs.CountPotentialRiskEvents();
                //ShowResult();
            }
        }