コード例 #1
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public AddStudentViewModel()
        {
            // Create commands
            CloseCommand = new RelayCommand(Close);
            OpenCommand  = new RelayCommand(Open);
            SaveCommand  = new RelayCommand(Save);

            // Student textboxes
            StudentFirstName = new TextEntryViewModel {
                Label = "First Name", OriginalText = " "
            };
            StudentMiddleName = new TextEntryViewModel {
                Label = "Middle Name", OriginalText = " "
            };
            StudentLastName = new TextEntryViewModel {
                Label = "Last Name", OriginalText = " "
            };
            StudentBirthDate = new TextEntryViewModel {
                Label = "Birth Date", OriginalText = " "
            };
            StudentRegistration = new TextEntryViewModel {
                Label = "Registration", OriginalText = " "
            };
            StudentCourse = new TextEntryViewModel {
                Label = "Course", OriginalText = " "
            };
            StudentGroup = new TextEntryViewModel {
                Label = "Group", OriginalText = " "
            };
            StudentFaculty = new TextEntryViewModel {
                Label = "Faculty", OriginalText = " "
            };
            StudentGender = new TextEntryViewModel {
                Label = "Gender", OriginalText = " "
            };
            StudentINN = new TextEntryViewModel {
                Label = "INN", OriginalText = " "
            };
            StudentSNILS = new TextEntryViewModel {
                Label = "SNILS", OriginalText = " "
            };
            StudentProfilePhoto = new TextEntryViewModel {
                Label = "Profile Photo", OriginalText = " "
            };

            // Passport textboxes
            PassportNumber = new TextEntryViewModel {
                Label = "Number", OriginalText = " "
            };
            PassportSeries = new TextEntryViewModel {
                Label = "Series", OriginalText = " "
            };
            PassportIssuedBy = new TextEntryViewModel {
                Label = "Issued By", OriginalText = " "
            };
            PassportIssuedDate = new TextEntryViewModel {
                Label = "Issued Date", OriginalText = " "
            };

            // Parent textboxes
            _parents.Add(ParentLastName = new TextEntryViewModel {
                Label = "Last Name", OriginalText = " "
            });
            _parents.Add(ParentFirstName = new TextEntryViewModel {
                Label = "First Name", OriginalText = " "
            });
            _parents.Add(ParentMiddleName = new TextEntryViewModel {
                Label = "Middle Name", OriginalText = " "
            });
            _parents.Add(ParentPhone = new TextEntryViewModel {
                Label = "Phone", OriginalText = " "
            });
            _parents.Add(SecondParentLastName = new TextEntryViewModel {
                Label = "Last Name", OriginalText = " "
            });
            _parents.Add(SecondParentFirstName = new TextEntryViewModel {
                Label = "First Name", OriginalText = " "
            });
            _parents.Add(SecondParentMiddleName = new TextEntryViewModel {
                Label = "Middle Name", OriginalText = " "
            });
            _parents.Add(SecondParentPhone = new TextEntryViewModel {
                Label = "Phone", OriginalText = " "
            });

            // Insurance Policy textboxes
            InsurencePolicyNumber = new TextEntryViewModel {
                Label = "Number", OriginalText = " "
            };
            InsurencePolicyCompany = new TextEntryViewModel {
                Label = "Company", OriginalText = " "
            };

            // Documents On Education textboxes
            _educations.Add(EducationFile1 = new TextEntryViewModel {
                Label = "File", OriginalText = " "
            });
            _educations.Add(EducationEndDate1 = new TextEntryViewModel {
                Label = "Date Of End", OriginalText = " "
            });
            _educations.Add(EducationFile2 = new TextEntryViewModel {
                Label = "File", OriginalText = " "
            });
            _educations.Add(EducationEndDate2 = new TextEntryViewModel {
                Label = "Date Of End", OriginalText = " "
            });
            _educations.Add(EducationFile3 = new TextEntryViewModel {
                Label = "File", OriginalText = " "
            });
            _educations.Add(EducationEndDate3 = new TextEntryViewModel {
                Label = "Date Of End", OriginalText = " "
            });
        }
コード例 #2
0
        /// <summary>
        /// Default contructer
        /// </summary>
        public StudentsInformationViewModel()
        {
            // Create commands
            AttachmentButtonCommand = new RelayCommand(AttachmentButton);
            PopupClickawayCommand   = new RelayCommand(PopupClickaway);
            SaveChangesCommand      = new RelayCommand(Save);
            DeleteCommand           = new RelayCommand(Delete);

            // Make a default menu
            AttachmentMenu = new StudentInformationAttachmentPopupMenuViewModel();

            StudentInformation = StudentInformation ?? SqlDbConnect.TakeStudents().FirstOrDefault();

            teParents      = _parents.Where(x => x.StudentId == StudentInformation.StudentID).ToList();
            tempEducations = _educations.Where(x => x.StudentID == StudentInformation.StudentID).ToList();

            // Student textboxes
            StudentID = new TextEntryViewModel {
                Label = "ID", OriginalText = StudentInformation.StudentID.ToString()
            };
            StudentFirstName = new TextEntryViewModel {
                Label = "First Name", OriginalText = StudentInformation.StudentFirstName
            };
            StudentMiddleName = new TextEntryViewModel {
                Label = "Middle Name", OriginalText = StudentInformation.StudentMiddleName
            };
            StudentLastName = new TextEntryViewModel {
                Label = "Last Name", OriginalText = StudentInformation.StudentLastName
            };
            StudentBirthDate = new TextEntryViewModel {
                Label = "Birth date", OriginalText = StudentInformation.StudentBirthDate.ToString("dd/M/yyyy")
            };
            StudentRegistration = new TextEntryViewModel {
                Label = "Registration", OriginalText = StudentInformation.StudentRegistration
            };
            StudentCourse = new TextEntryViewModel {
                Label = "Course", OriginalText = StudentInformation.StudentCourse.ToString()
            };
            StudentGroup = new TextEntryViewModel {
                Label = "Group", OriginalText = StudentInformation.StudentGroup.ToString()
            };
            StudentFaculty = new TextEntryViewModel {
                Label = "Faculty", OriginalText = StudentInformation.StudentFaculty.ToString()
            };
            StudentGender = new TextEntryViewModel {
                Label = "Gender", OriginalText = StudentInformation.StudentGender
            };
            StudentINN = new TextEntryViewModel {
                Label = "INN", OriginalText = StudentInformation.StudentINN.ToString()
            };
            StudentSNILS = new TextEntryViewModel {
                Label = "SNILS", OriginalText = StudentInformation.StudentSNILS.ToString()
            };
            StudentProfilePhoto = new TextEntryViewModel {
                Label = "Profile Photo", OriginalText = "lico.png"
            };

            //// Passport textboxes
            PassportNumber = new TextEntryViewModel {
                Label = "Number", OriginalText = StudentInformation.PassportNumber.ToString()
            };
            PassportSeries = new TextEntryViewModel {
                Label = "Series", OriginalText = StudentInformation.PassportSeries.ToString()
            };
            PassportIssuedBy = new TextEntryViewModel {
                Label = "Issued By", OriginalText = StudentInformation.PassportIssuedBy
            };
            PassportIssuedDate = new TextEntryViewModel {
                Label = "Issued Date", OriginalText = StudentInformation.PassportIssuedDate.ToString("dd/M/yyyy")
            };

            // Parent textboxes
            ParentLastName = new TextEntryViewModel {
                Label = "Last Name", OriginalText = teParents.Count > 0 ? teParents[0].ParentLastName : " "
            };
            ParentFirstName = new TextEntryViewModel {
                Label = "First Name", OriginalText = teParents.Count > 0 ? teParents[0].ParentFirstName : " "
            };
            ParentMiddleName = new TextEntryViewModel {
                Label = "Middle Name", OriginalText = teParents.Count > 0 ? teParents[0].ParentMiddleName : " "
            };
            ParentPhone = new TextEntryViewModel {
                Label = "Phone", OriginalText = teParents.Count > 0 ? teParents[0].ParentPhone.ToString() : " "
            };
            SecondParentLastName = new TextEntryViewModel {
                Label = "Last Name", OriginalText = teParents.Count > 1 ? teParents[1].ParentLastName : " "
            };
            SecondParentFirstName = new TextEntryViewModel {
                Label = "First Name", OriginalText = teParents.Count > 1 ? teParents[1].ParentFirstName : " "
            };
            SecondParentMiddleName = new TextEntryViewModel {
                Label = "Middle Name", OriginalText = teParents.Count > 1 ? teParents[1].ParentMiddleName : " "
            };
            SecondParentPhone = new TextEntryViewModel {
                Label = "Phone", OriginalText = teParents.Count > 1 ? teParents[1].ParentPhone.ToString() : " "
            };


            //// Insurance Policy textboxes
            InsurencePolicyNumber = new TextEntryViewModel {
                Label = "Number", OriginalText = StudentInformation.InsuranceNumber.ToString()
            };
            InsurencePolicyCompany = new TextEntryViewModel {
                Label = "Company", OriginalText = StudentInformation.InsuranceCompany
            };

            //// Documents On Education textboxes
            EducationFile1 = new TextEntryViewModel {
                Label = "File", OriginalText = tempEducations.Count > 0 ? tempEducations[0].EducationFile : " "
            };
            EducationEndDate1 = new TextEntryViewModel {
                Label = "Date Of End", OriginalText = tempEducations.Count > 0 ? tempEducations[0].EducationDateOfEnd.ToString("dd/M/yyyy") : " "
            };
            EducationFile2 = new TextEntryViewModel {
                Label = "File", OriginalText = tempEducations.Count > 1 ? tempEducations[1].EducationFile : " "
            };
            EducationEndDate2 = new TextEntryViewModel {
                Label = "Date Of End", OriginalText = tempEducations.Count > 1 ? tempEducations[1].EducationDateOfEnd.ToString("dd/M/yyyy") : " "
            };
            EducationFile3 = new TextEntryViewModel {
                Label = "File", OriginalText = tempEducations.Count > 2 ? tempEducations[2].EducationFile : " "
            };
            EducationEndDate3 = new TextEntryViewModel {
                Label = "Date Of End", OriginalText = tempEducations.Count > 2 ? tempEducations[2].EducationDateOfEnd.ToString("dd/M/yyyy") : " "
            };
        }