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); } }
public void CreateNewTest() { Mode = FormMode.CreateNew; Test = new Test(); InitializeControls(); MdiParent = MyForms.GetForm <ParentForm>(); Show(); }
public void UpdateTest(Test test) { Mode = FormMode.Update; Test = test; InitializeControls(); ShowTestInControls(); MdiParent = MyForms.GetForm <ParentForm>(); Show(); }
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; }
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); } }
private void allTestsToolStripMenuItem_Click(object sender, EventArgs e) { MyForms.GetForm <TestlistForm>().Show(); }
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(); }
private void button1_Click(object sender, EventArgs e) { MyForms.GetForm <TakeTest>().Show(); }