private void btnCancel_Click(object sender, EventArgs e) { StudentInterface studentInterface = new StudentInterface(); studentInterface.Show(); Close(); }
private void submitBtn_Click(object sender, EventArgs e) { //Validates collection of textboxes on form to ensure they are not empty var textBoxCollection = new[] { textBoxStudentId, textBoxEmail, textBoxPhone, textBoxAddressL1, textBoxAddressL2, textBoxCity, textBoxLevel }; bool atleastOneTextboxEmpty = textBoxCollection .Any(t => string.IsNullOrWhiteSpace(t.Text)); //If one is empty, form will not submit if (atleastOneTextboxEmpty) { MessageBox.Show("No fields can be left empty."); DialogResult = DialogResult.None; } //Email validation else if (!IsValidEmail(textBoxEmail.Text)) { MessageBox.Show("Email address must be valid format"); DialogResult = DialogResult.None; } else { Student.editStudent(int.Parse(textBoxStudentId.Text), textBoxEmail.Text, textBoxPhone.Text, textBoxAddressL1.Text, textBoxAddressL2.Text, textBoxCity.Text, cBoxCounty.Text, textBoxLevel.Text); StudentInterface studentInterface = new StudentInterface(); studentInterface.Show(); Close(); } }
//Form buttons private void btnDeleteStudent_Click(object sender, EventArgs e) { Student.deleteStudent(int.Parse(textBoxStudentId.Text)); StudentInterface studentInterface = new StudentInterface(); studentInterface.Show(); Close(); }
public StudentService(StudentInterface studentInterface) { _studentInterface = studentInterface; }