Example #1
0
 /// <summary>
 /// Save the student and close add student menu
 /// </summary>
 public void Save()
 {
     if (EntryBoxesValueCheck.Check(new List <TextEntryViewModel>
     {
         // Order is importnant
         StudentProfilePhoto,
         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
     }))
     {
         if (SqlDbConnect.CreateStudent(StudentLastName.OriginalText, StudentFirstName.OriginalText,
                                        StudentGroup.OriginalText, StudentFaculty.OriginalText, StudentCourse.OriginalText,
                                        StudentINN.OriginalText, StudentSNILS.OriginalText, PassportNumber.OriginalText,
                                        PassportSeries.OriginalText, PassportIssuedBy.OriginalText, PassportIssuedDate.OriginalText,
                                        InsurencePolicyNumber.OriginalText, InsurencePolicyCompany.OriginalText, _parents, _educations, StudentGender.OriginalText,
                                        StudentRegistration.OriginalText, StudentBirthDate.OriginalText, StudentMiddleName.OriginalText))
         {
             IoC.UI.ShowMessage(new MessageBoxDialogViewModel
             {
                 Title   = "Congratulation!",
                 Message = "The student successfully added to data base!",
                 OkText  = "OK"
             });
             IoC.Application.AddStudentMenuVisible = false;
             IoC.Application.PictureControlVisible = false;
             StudentListDesignModel.Instance.Items = SqlDbConnect.CreateStudentsListViewModel();
             IoC.Application.SideMenuVisible       = true;
         }
     }
     else
     {
         IoC.UI.ShowMessage(new MessageBoxDialogViewModel
         {
             Title   = "Error!",
             Message = "The student hand't added to data base!",
             OkText  = "OK"
         });
     }
 }
Example #2
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"
                });
            }
        }