Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var context = new IllusionsPerceptionContext();

            label7.Visible = false;
            label4.Visible = false;
            label5.Visible = false;
            var name        = textBox1.Text;
            var groupNumber = int.Parse(textBox2.Text);
            var user        = context.User.ToList();
            var number1     = int.Parse(context.Settings.First(x => x.Name == "Предъявлений1").Value);
            var _count1     = int.Parse(context.Settings.First(x => x.Name == "Предварительная").Value);
            var _count2     = int.Parse(context.Settings.First(x => x.Name == "Контрольная").Value);
            var number2     = _count1 + _count2;

            if (user.Any(x => x.Name == name &&
                         user.Any(m => m.Group == groupNumber)))
            {
                var id = user.First(x => x.Name == name).Id;

                if (context.Experiment1Result.Count(x => x.Id_User == id) == number1 &&
                    context.Experiment2Result.Count(x => x.Id_User == id) == number2)
                {
                    label6.Visible = true;
                }
                else
                {
                    var result = MessageBox.Show("У Вас есть незавершенные опыты, хотите продолжить?", "Незавершенные опыты", MessageBoxButtons.YesNo);

                    if (result == DialogResult.Yes)
                    {
                        var nForm = new Form17(id);
                        nForm.FormClosed += (o, ep) => this.Close();
                        nForm.Show();
                        this.Hide();
                    }
                }
            }
            else
            {
                context.User.Add(new User {
                    Name = name, Group = groupNumber, Date = DateTime.Now
                });
                context.SaveChanges();

                label4.Visible  = true;
                button3.Visible = true;
            }
        }
Beispiel #2
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (_continue)
     {
         var nForm = new Form17(_id);
         nForm.FormClosed += (o, ep) => this.Close();
         nForm.Show();
         this.Hide();
     }
     else
     {
         var nForm = new Form9(_id);
         nForm.FormClosed += (o, ep) => this.Close();
         nForm.Show();
         this.Hide();
     }
 }