Ejemplo n.º 1
0
        private void Criterias_dgv_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (!ahp.VerifyPairwiseComparisonRanking(Convert.ToDouble(Criterias_dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)))
            {
                Criterias_dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Red;
                MessageBox.Show("Ranking value can't be less than 1 or greater than 9");
                Criterias_dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = 1;
                Criterias_dgv.Rows[e.ColumnIndex].Cells[e.RowIndex].Value = 1;
            }
            else
            {
                Criterias_dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.White;
                ahp.PairwiseComparing(Criterias_dgv);
                column_total = ahp.SumUpColumns(Criterias_dgv);

                //Get Normalized Table
                normalized_matrix = ahp.NormalizeMatrix(Criterias_dgv, column_total);
                DataTable NormalizedTable = ahp.GetTable(parametersToCompare, normalized_matrix);
                NormalizedMatrix_dgv.Show();
                label1.Show();
                ahp.DisplayTable(NormalizedTable, NormalizedMatrix_dgv, parametersToCompare);
                NormalizedMatrix_dgv.Show();

                //Get Criteria Weight Table
                criteria_weight = ahp.GetCriteriaWeight(normalized_matrix, NormalizedMatrix_dgv);
                ahp.VectorToTable(criteria_weight, normalized_matrix, NormalizedMatrix_dgv, CriteriaWeight_dgv);
                CriteriaWeight_label.Show();
                CheckConsistency_button.Show();
            }
            AssignLocalWeightToParameters(CriteriaWeight_dgv, parametersToCompare);
            AssignGlobalWeightToParameter(parameterList);
        }