Example #1
0
        //////////////Ранжування експертів корстувачеm////////////////////

        public void makeRangeByUser(DataGridView matrix, NumericUpDown objCounts, bool direct)
        {
            int objCount = Decimal.ToInt32(objCounts.Value);

            int [,] grid = new int[expertsCount, objCount];
            if (matrix.RowCount == objCount && matrix.ColumnCount == expertsCount)
            {
                for (int i = 0; i < expertsCount; i++)
                {
                    for (int j = 0; j < objCount; j++)
                    {
                        grid[i, j] = Convert.ToInt32(matrix[i, j].Value);
                    }
                }
            }

            if (direct && !checkDirectRange(grid))
            {
                grid = new int[expertsCount, objCount];
            }
            else if (!direct && !checkUnDirectRange(grid))
            {
                grid = new int[expertsCount, objCount];
            }
            try
            {
                ManyRankForm.Dialog(ref grid, direct);
            }
            catch (Exception)
            {
                MessageBox.Show("Ви намагаєтесь змінити некорректну матрицю!");
                return;
            }

            matrix.Columns.Clear();
            for (int column = 0; column < expertsCount; column++)
            {
                matrix.Columns.Add("expert" + column.ToString(), "Експерт " + Convert.ToString(column + 1));
            }

            matrix.RowCount = objCount;
            for (int i = 0; i < expertsCount; i++)
            {
                for (int j = 0; j < objCount; j++)
                {
                    matrix[i, j].Value = grid[i, j];
                }
            }
        }
Example #2
0
        public static bool Dialog(ref int[,] expertsMarks, bool strict)
        {
            ManyRankForm f = new ManyRankForm();

            return(f._Dialog(ref expertsMarks, strict));
        }