Ejemplo n.º 1
0
        public void AddExpert(Expert expert)
        {
            experts.Add(expert);
            expertMatrixDictionary.Add(expert, new Matrix[Enum.GetValues(typeof(SolvingMethod)).Length]);

            InitMatrix(expert);
        }
Ejemplo n.º 2
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            string expertName = nameTextBox.Text;
            Expert expert     = null;

            foreach (var problem in Data.problems)
            {
                expert = problem.Experts.FirstOrDefault(x => x.name == expertName);
                if (expert != null)
                {
                    break;
                }
            }

            if (expert == null)
            {
                expert = new Expert(expertName, 1);
            }

            ChooseProblemForm chooseProblemForm = new ChooseProblemForm(expert);

            chooseProblemForm.Closed += (s, args) => Show();
            chooseProblemForm.Show();

            Hide();
        }
Ejemplo n.º 3
0
        public ChooseProblemForm(Expert expert)
        {
            this.expert = expert;

            InitializeComponent();

            nameLabel.Text = "Эксперт: " + expert.name;

            InitProblems(expert);
        }
Ejemplo n.º 4
0
 public Matrix GetMatrix(Expert expert, SolvingMethod solvingMethod)
 {
     if (expertMatrixDictionary.ContainsKey(expert))
     {
         return(expertMatrixDictionary[expert][(int)solvingMethod]);
     }
     else
     {
         AddExpert(expert);
         return(GetMatrix(expert, solvingMethod));
     }
 }
        private void expertsGrid_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            string cellValue = (sender as DataGridView).CurrentCell.Value.ToString();
            Expert expert;

            if (e.RowIndex < problem.Experts.Count)
            {
                expert = problem.Experts[e.RowIndex];
            }
            else
            {
                expert = new Expert("", 1);
                problem.AddExpert(expert);

                DataGridViewButtonCell button = expertsGrid.Rows[e.RowIndex].Cells[expertsGrid.Rows[e.RowIndex].Cells.Count - 1] as DataGridViewButtonCell;
                MakeButtonActive(button);

                expertsGrid.Rows.Add(new string[] { (problem.Experts.Count + 1).ToString(), "", "" });
            }

            switch (e.ColumnIndex)
            {
            case 1:
            {
                expert.name = cellValue;
                break;
            }

            case 2:
            {
                double expertCompetence = double.Parse(cellValue);
                if (expertCompetence < 1.0d || expertCompetence > 12.0d)
                {
                    MessageBox.Show("Компетенция должна быть в пределах от 1 до 12");

                    (sender as DataGridView).CurrentCell.Value = "1";

                    break;
                }

                expert.competence = double.Parse(cellValue);
                break;
            }

            default:
            {
                break;
            }
            }
        }
Ejemplo n.º 6
0
        public void InitMatrix(Expert expert)
        {
            if (!expertMatrixDictionary.ContainsKey(expert))
            {
                AddExpert(expert);
            }

            expertMatrixDictionary[expert] = new Matrix[Enum.GetValues(typeof(SolvingMethod)).Length];

            expertMatrixDictionary[expert][(int)SolvingMethod.PairComparison]    = new Matrix(alternatives.Count, alternatives.Count);
            expertMatrixDictionary[expert][(int)SolvingMethod.WeightedJudgement] = new Matrix(1, alternatives.Count);
            expertMatrixDictionary[expert][(int)SolvingMethod.Prefer]            = new Matrix(1, alternatives.Count);
            expertMatrixDictionary[expert][(int)SolvingMethod.Rang]             = new Matrix(1, alternatives.Count);
            expertMatrixDictionary[expert][(int)SolvingMethod.FullPairMatching] = new Matrix(alternatives.Count, alternatives.Count);
        }
Ejemplo n.º 7
0
        private void InitProblems(Expert expert)
        {
            problemsList.Items.Clear();

            problems = Data.problems.Where(x => x.Experts.Any(y => y == expert) && x.Status == Status.Оценивание).ToList();

            int rowIndex = 0;

            for (int i = 0; i < problems.Count; i++)
            {
                for (int methodIndex = 0; methodIndex < Enum.GetValues(typeof(SolvingMethod)).Length; methodIndex++)
                {
                    problemsList.Items.Add(new ListViewItem(new string[] { (rowIndex + 1).ToString(), problems[i].Name +
                                                                           " (" + ConvertMethodToString((SolvingMethod)methodIndex) + ")" }));
                    rowIndex++;
                }
            }

            DrawProblemList();
        }
Ejemplo n.º 8
0
 public Matrix GetMatrix(Expert expert, int solvingMethodIndex)
 {
     return(GetMatrix(expert, (SolvingMethod)solvingMethodIndex));
 }
Ejemplo n.º 9
0
 public PairComprasionExpert(Matrix matrix, Expert expert)
 {
     this.matrix = matrix;
     this.expert = expert;
 }