Пример #1
0
        /// <summary>
        /// Default contructor
        /// </summary>
        private StudentListDesignModel()
        {
            mItems = SqlDbConnect.CreateStudentsListViewModel();

            FilteredItems = mItems;

            SearchCommand = new RelayCommand(Search);
        }
Пример #2
0
        /// <summary>
        /// Delete Student from data base
        /// </summary>
        public void Delete()
        {
            // Check if delete is
            if (SqlDbConnect.DeleteInformation(int.Parse(StudentID.OriginalText)))
            {
                // Shows message that update was success
                IoC.UI.ShowMessage(new MessageBoxDialogViewModel
                {
                    Title   = "Congratulation!",
                    Message = "Student was successfully deleted!",
                    OkText  = "OK"
                });

                // Gets all new items from data base
                StudentListDesignModel.Instance.Items = SqlDbConnect.CreateStudentsListViewModel();

                // Shows block screen
                IoC.Application.BlockScreenVisible = true;
            }
        }
Пример #3
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"
         });
     }
 }
Пример #4
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"
                });
            }
        }
Пример #5
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") : " "
            };
        }