예제 #1
0
        public void CreateStuButton()
        {
            var detail = new CreateStudentViewModel();

            detail.Title          = "New Student";
            detail.StudentService = StudentService;
            detail.ClassList      = ClassList;
            manager.ShowDialog(detail);
            SearchButton(StudentList); //call search again to reset studentlist
        }
예제 #2
0
 //update student button
 public void ModifyButton()
 {
     if (SelectedStudent != null)
     {
         var detail = new CreateStudentViewModel();
         detail.Title           = "Modify Student";
         detail.SelectedStudent = SelectedStudent;
         detail.ClassList       = ClassList;
         detail.StudentId       = SelectedStudent.StudentId;
         detail.FirstName       = SelectedStudent.FirstName;
         detail.LastName        = SelectedStudent.LastName;
         detail.BirthDate       = SelectedStudent.Birthdate;
         detail.GenderConvert(SelectedStudent.Gender); //convert a gender type string to bool
         detail.City  = SelectedStudent.City;
         detail.Email = SelectedStudent.Email;
         detail.Class = SelectedStudent.Class;
         manager.ShowDialog(detail);
         SearchButton(StudentList); //call search again to reset studentlist
     }
     else
     {
         MessageBox.Show("Please select student to update", "Wrong input", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }