Example #1
0
        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();
            }
        }
Example #2
0
 private void Button_Search(object sender, MouseButtonEventArgs e)
 {
     key = int.Parse(Search.Text);
     if (StudentTeacherFunctions.KeyExistsStudent(key))
     {
         tempStudent    = StudentTeacherFunctions.ViewStudents(key);
         EnterName.Text = tempStudent.studentName;
         String facNum = Convert.ToString(tempStudent.facNum);
         EnterFacNum.Text = facNum;
         String egn = Convert.ToString(tempStudent.studentEGN);
         EnterEGN.Text       = egn;
         EnterFaculty.Text   = tempStudent.faculty;
         EnterSpecialty.Text = tempStudent.specialty;
         if (tempStudent.gender == "male")
         {
             Male.IsChecked = true;
         }
         else if (tempStudent.gender == "female")
         {
             Female.IsChecked = true;
         }
     }
     else
     {
         Search.Text         = "No such key exists";
         EnterName.Text      = "";
         EnterFacNum.Text    = "";
         EnterEGN.Text       = "";
         EnterFaculty.Text   = "";
         EnterSpecialty.Text = "";
     }
 }
Example #3
0
 private void Button_Search(object sender, MouseButtonEventArgs e)
 {
     key = int.Parse(Search.Text);
     if (StudentTeacherFunctions.KeyExistsTeacher(key))
     {
         tempTeacher    = StudentTeacherFunctions.ViewTeachers(key);
         EnterName.Text = tempTeacher.teacherName;
         String egn = Convert.ToString(tempTeacher.teacherEGN);
         EnterEGN.Text        = egn;
         EnterDepartment.Text = tempTeacher.department;
         if (tempTeacher.gender == "male")
         {
             Male.IsChecked = true;
         }
         else if (tempTeacher.gender == "female")
         {
             Female.IsChecked = true;
         }
     }
     else
     {
         Search.Text          = "No such key exists";
         EnterName.Text       = "";
         EnterEGN.Text        = "";
         EnterDepartment.Text = "";
     }
 }
Example #4
0
        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();
            }
        }
Example #5
0
 private void Button_Delete(object sender, MouseButtonEventArgs e)
 {
     StudentTeacherFunctions.RemoveTeacher(key);
     this.Close();
 }