Beispiel #1
0
        private void CopyStudent(Data.Student source, EditableStudent target)
        {
            target.StudentGuid = source.StudentGuid;
            target.EditMode    = EditMode;

            EditableContact.Contacts = new ObservableCollection <Contact>(source.Contacts.ToList());
            target.Biometrics        = new ObservableCollection <Biometric>();
            target.Organizations     = new ObservableCollection <Organization>();

            if (EditMode)
            {
                target.OrigStudentId        = source.StudentID;
                target.StudentID            = source.StudentID;
                target.FirstName            = source.FirstName;
                target.MiddleName           = source.MiddleName;
                target.LastName             = source.LastName;
                target.LevelID              = source.LevelID;
                target.SectionID            = source.SectionID;
                target.BirthDate            = source.BirthDate;
                target.Gender               = source.Gender;
                target.Street               = source.Street;
                target.City                 = source.City;
                target.State                = source.State;
                target.ImageData            = source.ImageData;
                target.Attendances          = source.Attendances;
                target.Contacts             = new ObservableCollection <Contact>(source.Contacts);
                target.Level                = source.Level;
                target.Section              = source.Section;
                target.RelBiometrics        = new ObservableCollection <RelBiometric>(source.RelBiometrics);
                target.RelDistributionLists = source.RelDistributionLists;
                target.RelOrganizations     = new ObservableCollection <RelOrganization>(source.RelOrganizations);


                SelectedLevelId   = source.LevelID;
                SelectedSectionId = source.SectionID;
            }

            if (target.RelBiometrics != null)
            {
                foreach (RelBiometric relBiometric in target.RelBiometrics)
                {
                    target.Biometrics.Add(relBiometric.Biometric);
                }
            }
            if (target.RelOrganizations != null)
            {
                foreach (RelOrganization group in target.RelOrganizations)
                {
                    target.Organizations.Add(group.Organization);
                }
            }
        }
Beispiel #2
0
 private void UpdateStudent(EditableStudent source, Data.Student target)
 {
     target.StudentID  = source.StudentID;
     target.FirstName  = source.FirstName;
     target.MiddleName = source.MiddleName;
     target.LastName   = source.LastName;
     target.LevelID    = SelectedLevelId;
     target.SectionID  = SelectedSectionId;
     target.BirthDate  = source.BirthDate;
     target.Gender     = source.Gender;
     target.Street     = source.Street;
     target.City       = source.City;
     target.State      = source.State;
     target.ImageData  = source.ImageData;
 }
Beispiel #3
0
        public void SetStudent(Data.Student student)
        {
            _editingStudent = student;

            if (Student != null)
            {
                Student.ErrorsChanged -= RaiseCanExecuteChanged;
            }
            if (EditableContact != null)
            {
                EditableContact.ErrorsChanged -= RaiseCanExecuteChanged;
            }

            Student         = new EditableStudent();
            EditableContact = new EditableContact();

            Student.ErrorsChanged         += RaiseCanExecuteChanged;
            EditableContact.ErrorsChanged += RaiseCanExecuteChanged;

            CopyStudent(student, Student);
        }