private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         var score      = 0;
         var chosenTest = cbxTest.SelectedItem.ToString();
         var test       = new TestManager().GetByName(Convert.ToInt32(chosenTest));
         if (tbxQ1Answer.Text == test.Answer1)
         {
             score = score + 1;
         }
         if (tbxQ2Answer.Text == test.Answer2)
         {
             score = score + 1;
         }
         if (tbxQ3Answer.Text == test.Answer3)
         {
             score = score + 1;
         }
         Applicant.Score += score;
         Applicant.Test   = Applicant.Test + $",{chosenTest}";
         var manager = new ApplicantManager();
         manager.Update(Applicant);
         MyForms.GetForm <ApplicantListForm>().LoadData();
         Close();
         MessageBox.Show($"{lblName.Text} got {score} right answers, his/her score is improved by {score} marks", "Result");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
 public void CreateNewTest()
 {
     Mode = FormMode.CreateNew;
     Test = new Test();
     InitializeControls();
     MdiParent = MyForms.GetForm <ParentForm>();
     Show();
 }
Beispiel #3
0
 public void UpdateTest(Test test)
 {
     Mode = FormMode.Update;
     Test = test;
     InitializeControls();
     ShowTestInControls();
     MdiParent = MyForms.GetForm <ParentForm>();
     Show();
 }
Beispiel #4
0
 public void UpdateApplicant(Applicant applicant)
 {
     Mode      = FormMode.Update;
     Applicant = applicant;
     InitializeControls();
     ShowApplicantInControls();
     MdiParent = MyForms.GetForm <ParentForm>();
     Show();
 }
        public void TestTake(Applicant applicant)
        {
            Applicant = applicant;
            MdiParent = MyForms.GetForm <ParentForm>();
            Show();
            lblName.Text = Applicant.Name;
            var allTests = new TestManager().GetAllNames();

            cbxTest.DataSource = allTests;
        }
Beispiel #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                GrabUserInput();
                var manager = new TestManager();
                if (Mode == FormMode.CreateNew)
                {
                    manager.Create(Test);
                }
                else
                {
                    manager.Update(Test);
                }

                MyForms.GetForm <TestlistForm>().LoadData();
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #7
0
 private void allTestsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MyForms.GetForm <TestlistForm>().Show();
 }
Beispiel #8
0
 private void allApplicantsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MyForms.GetForm <ApplicantListForm>().Show();
     // The MDI parent form of applicantlist form is ParentForm
     //When I click on the All applicants and I will be redirected to this all applicant form
 }
 private void TestListForm_Load(object sender, EventArgs e)
 {
     MdiParent = MyForms.GetForm <ParentForm>();
     LoadData();
 }
Beispiel #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     MyForms.GetForm <TakeTest>().Show();
 }