private void goBack_Click(object sender, EventArgs e)
        {
            AnalyticPage analyticPage = new AnalyticPage();

            analyticPage.Show();
            this.Close();
        }
Example #2
0
        private void buttonLoginAsAnalytic_Click(object sender, EventArgs e)
        {
            var analyticPage = new AnalyticPage();

            analyticPage.Show();
            this.Close();
        }
        private void next_Click(object sender, EventArgs e)
        {
            if (!Validate())
            {
                //messagebox
                return;
            }

            var caption = "Некорректные данные";
            var experts = new List <int>();

            foreach (var row in dataGridView2.Rows.Cast <DataGridViewRow>())
            {
                if ((bool)row.Cells["Selected"].Value)
                {
                    experts.Add((int)row.Cells["Id"].Value);
                }
            }

            if (experts.Count < 2)
            {
                MessageBox.Show("Необходимо выбрать не менее двух экспертов", caption, MessageBoxButtons.OK);
                return;
                //messagebox with error
            }

            var alternatives = new List <Alternative>();

            foreach (var row in dataGridView1.Rows.Cast <DataGridViewRow>())
            {
                if (row.Cells[0].Value != null)
                {
                    alternatives.Add(new Alternative
                    {
                        Name        = (string)row.Cells[0].Value,
                        Description = (string)row.Cells[1].Value,
                    });
                }
            }

            if (alternatives.Count < 2)
            {
                MessageBox.Show("Необходимо добавить не менее двух альтернатив", caption, MessageBoxButtons.OK);
                return;
                //messagebox with error
            }

            var problem = new Problem
            {
                Name        = ProbleNameTextBox.Text,
                Description = textBoxProblemDescription.Text
            };

            var problemId = AppContext.Client.CreateProblem(problem);

            AppContext.Client.AssignExperts(problemId, experts);

            AppContext.Client.AssignAlternative(problemId, alternatives);

            MessageBox.Show("Проблема создана, ожидайте ее решения", "Создание прошло успешно", MessageBoxButtons.OK);
            //messagebox фсе ок!
            var page = new AnalyticPage();

            page.Show();
            this.Close();
        }