Esempio n. 1
0
        /// <summary>
        /// When the save button is clicked, saves corrected information
        /// </summary>
        public void Save()
        {
            // Order is important
            if (EntryBoxesValueCheck.Check(new List <TextEntryViewModel>
            {
                StudentID,
                StudentFirstName,
                StudentMiddleName,
                StudentLastName,
                StudentBirthDate,
                StudentRegistration,
                StudentCourse,
                StudentGroup,
                StudentFaculty,
                StudentGender,
                StudentINN,
                StudentSNILS,
                StudentProfilePhoto,
                PassportNumber,
                PassportSeries,
                PassportIssuedBy,
                PassportIssuedDate,
                ParentLastName,
                ParentFirstName,
                ParentMiddleName,
                ParentPhone,
                SecondParentLastName,
                SecondParentFirstName,
                SecondParentMiddleName,
                SecondParentPhone,
                InsurencePolicyNumber,
                InsurencePolicyCompany,
                EducationFile1,
                EducationEndDate1,
                EducationFile2,
                EducationEndDate2,
                EducationFile3,
                EducationEndDate3
            }))
            {
                // Order is important
                SqlDbConnect.UpdateInfromation(new List <TextEntryViewModel>
                {
                    // Student table info
                    StudentID,
                    StudentLastName,
                    StudentFirstName,
                    StudentMiddleName,
                    StudentBirthDate,
                    StudentRegistration,
                    StudentCourse,
                    StudentGroup,
                    StudentFaculty,
                    StudentGender,
                    StudentINN,
                    StudentSNILS,
                    StudentProfilePhoto,
                    PassportNumber,
                    PassportSeries,
                    PassportIssuedBy,
                    PassportIssuedDate,
                    InsurencePolicyNumber,
                    InsurencePolicyCompany
                }, new List <TextEntryViewModel>
                {
                    // Parent table info
                    ParentLastName,
                    ParentFirstName,
                    ParentMiddleName,
                    ParentPhone,
                    SecondParentLastName,
                    SecondParentFirstName,
                    SecondParentMiddleName,
                    SecondParentPhone
                }, new List <TextEntryViewModel>
                {
                    // Education table info
                    EducationFile1,
                    EducationEndDate1,
                    EducationFile2,
                    EducationEndDate2,
                    EducationFile3,
                    EducationEndDate3
                });

                // Shows message that update was success
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Congratulation!",
                    Message = "Student information was successfully updated!",
                    OkText  = "OK"
                });

                // Gets all new items from data base
                StudentListDesignModel.Instance.Items = SqlDbConnect.CreateStudentsListViewModel();
            }
            else
            {
                // Shows message that update failed
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Error!",
                    Message = "Information didn't updated!",
                    OkText  = "OK"
                });
            }
        }