Example #1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult res = MessageBox.Show("Add student?", "Verification", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (res == MessageBoxResult.No)
            {
                newStu = null;
                return;
            }

            //code missing:
            //test each textbox, combobox value with more TKINUT KELET etc.
            // make sure each field has value
            //if not takin shoe message box, and return.
            //else
            try
            {
                bl.AddStudent(newStu);
                this.Close();
            }
            catch (BO.BadStudentIdException ex)
            {
                MessageBox.Show(ex.Message, "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Example #2
0
        public void AddStudent(BO.Student student)
        {
            //Add new student  (DO.Person + DO.Student)
            //with no courses (courses will be added one by one through AddStudentInCourse()

            //Add DO.Person
            DO.Person personDO = new DO.Person();
            student.CopyPropertiesTo(personDO);
            try
            {
                dl.AddPerson(personDO);
            }
            catch (DO.BadPersonIdException ex)
            {
                throw new BO.BadStudentIdException("Student ID is illegal", ex);
            }

            //Add DO.Student
            DO.Student studentDO = new DO.Student();
            student.CopyPropertiesTo(studentDO);
            try
            {
                dl.AddStudent(studentDO);
            }
            catch (DO.BadPersonIdException ex)
            {
                throw new BO.BadStudentIdException("Student ID is illegal", ex);
            }
        }
Example #3
0
        public void UpdateStudentPersonalDetails(BO.Student student)
        {
            //Update DO.Person
            DO.Person personDO = new DO.Person();
            student.CopyPropertiesTo(personDO);
            try
            {
                dl.UpdatePerson(personDO);
            }
            catch (DO.BadPersonIdException ex)
            {
                throw new BO.BadStudentIdException("Student ID is illegal", ex);
            }

            //Update DO.Student
            DO.Student studentDO = new DO.Student();
            student.CopyPropertiesTo(studentDO);
            try
            {
                dl.UpdateStudent(studentDO);
            }
            catch (DO.BadPersonIdException ex)
            {
                throw new BO.BadStudentIdException("Student ID is illegal", ex);
            }
        }
Example #4
0
        private void cbStudentID_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            curStu = (cbStudentID.SelectedItem as BO.Student);
            gridOneStudent.DataContext = curStu;

            //list of courses of selected student
            RefreshAllRegisteredCoursesGrid();
            //list of all courses (that selected student is not registered to it)
            RefreshAllNotRegisteredCoursesGrid();
        }
Example #5
0
        private void WinAddStudent_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            BO.Student newStu = (sender as AddStudentWindow).newStu;

            //Fix: using observable collection instead of RefreshAllStudentComboBox();
            if (newStu != null)
            {
                obsColStudents.Add(newStu);
                cbStudentID.SelectedItem = newStu; //the selected item should be the new just added item
            }
        }
Example #6
0
        BO.Student studentDoBoAdapter(DO.Student studentDO)
        {
            BO.Student studentBO = new BO.Student();
            DO.Person  personDO;
            int        id = studentDO.ID;

            try
            {
                personDO = dl.GetPerson(id);
            }
            catch (DO.BadPersonIdException ex)
            {
                throw new BO.BadStudentIdException("Student ID is illegal", ex);
            }
            personDO.CopyPropertiesTo(studentBO);
            //studentBO.ID = personDO.ID;
            //studentBO.BirthDate = personDO.BirthDate;
            //studentBO.City = personDO.City;
            //studentBO.Name = personDO.Name;
            //studentBO.HouseNumber = personDO.HouseNumber;
            //studentBO.Street = personDO.Street;
            //studentBO.PersonalStatus = (BO.PersonalStatus)(int)personDO.PersonalStatus;

            studentDO.CopyPropertiesTo(studentBO);
            //studentBO.StartYear = studentDO.StartYear;
            //studentBO.Status = (BO.StudentStatus)(int)studentDO.Status;
            //studentBO.Graduation = (BO.StudentGraduate)(int)studentDO.Graduation;

            studentBO.ListOfCourses = from sic in dl.GetStudentsInCourseList(sic => sic.PersonId == id)
                                      let course = dl.GetCourse(sic.CourseId)
                                                   select course.CopyToStudentCourse(sic);

            //new BO.StudentCourse()
            //{
            //    ID = course.ID,
            //    Number = course.Number,
            //    Name = course.Name,
            //    Year = course.Year,
            //    Semester = (BO.Semester)(int)course.Semester,
            //    Grade = sic.Grade
            //};

            return(studentBO);
        }
Example #7
0
 public void DeleteStudent(BO.Student uistudents)
 {
     DAL.Student dal_student = new DAL.Student();
     dal_student.DeleteStudent(uistudents);
 }
Example #8
0
 public void UpdateStudent(BO.Student uistudents)
 {
     DAL.Student dal_student = new DAL.Student();
     dal_student.UpdateStudent(uistudents);
 }
Example #9
0
 public bool AddStudent(BO.Student uistudents)
 {
     DAL.Student dal_student = new DAL.Student();
     return(dal_student.AddStudent(uistudents));
 }
Example #10
0
 private void btnCancel_Click(object sender, RoutedEventArgs e)
 {
     newStu = null;
     this.Close();
 }