private void Button_SaveNew(object sender, MouseButtonEventArgs e) { String gender = null; if (Male.IsChecked == true) { gender = "male"; } else if (Female.IsChecked == true) { gender = "female"; } if (int.Parse(EnterEGN.Text) == key) { tempTeacher = new Teacher(EnterName.Text, int.Parse(EnterEGN.Text), EnterDepartment.Text, gender); StudentTeacherFunctions.ChangeTeacher(key, tempTeacher); this.Close(); } else if (!StudentTeacherFunctions.CheckInput(EnterEGN.Text)) { EnterEGN.Text = "Invalid input: must contain 10 numbers"; } else { StudentTeacherFunctions.RemoveTeacher(key); StudentTeacherFunctions.AddNewTeacher(EnterName.Text, int.Parse(EnterEGN.Text), EnterDepartment.Text, gender); this.Close(); } }
private void Button_SaveNew(object sender, MouseButtonEventArgs e) { String gender = null; if (Male.IsChecked == true) { gender = "male"; } else if (Female.IsChecked == true) { gender = "female"; } if (!StudentTeacherFunctions.CheckInput(EnterFacNum.Text)) { EnterFacNum.Text = "Invalid input: must contain 10 numbers"; } else if (!StudentTeacherFunctions.CheckInput(EnterEGN.Text)) { EnterEGN.Text = "Invalid input: must contain 10 numbers"; } else if (StudentTeacherFunctions.KeyExistsStudent(int.Parse(EnterEGN.Text))) { EnterEGN.Text = "EGN Already exists"; } else { StudentTeacherFunctions.AddNewStudent(EnterName.Text, int.Parse(EnterFacNum.Text), int.Parse(EnterEGN.Text), EnterFaculty.Text, EnterSpecialty.Text, gender); this.Close(); } }