示例#1
0
        // Clears all the data in this View Model
        private void ResetAll()
        {
            // Reset all of the lists
            AvailableClasses.Clear();
            AvailableParents.Clear();
            AvailableStudents.Clear();
            AvailableCourses.Clear();
            AvailableCoursesMustChoose.Clear();
            AvailableHomeroomClasses.Clear();

            // Reset all properties
            Username  = "";
            FirstName = "";
            LastName  = "";
            Email     = "";
            Phone     = "";
            Birthdate = new DateTime();

            IsNewStudent   = false;
            IsNewTeacher   = false;
            IsNewParent    = false;
            IsNewSecretary = false;

            SelectedHomeroomClass = null;
            SelectedParent        = null;
            SelectedStudent       = null;
            SelectedClass         = null;
            SelectedCourse1       = null;
            SelectedCourse2       = null;
            SelectedCourse3       = null;
            SelectedCourse4       = null;
        }
示例#2
0
        public void Initialize(Person connectedPerson)
        {
            // Reset all information
            ConnectedPerson = connectedPerson;
            AvailableUserTypes.Clear();
            AvailableUsers.Clear();
            AvailableClasses.Clear();
            AvailableParents.Clear();
            AvailableStudents.Clear();
            AvailableCourses.Clear();
            AvailableCoursesMustChoose.Clear();
            AvailableHomeroomClasses.Clear();

            if (HasRequiredPermissions)
            {
                _schoolData = new SchoolEntities();

                // Create a list of all the editable user types
                if (!CanEditManagement)
                {
                    AvailableUserTypes.AddRange(new List <string>()
                    {
                        Globals.USER_TYPE_STUDENT, Globals.USER_TYPE_TEACHERS, Globals.USER_TYPE_PARENTS
                    });
                }
                else
                {
                    AvailableUserTypes.AddRange(new List <string>()
                    {
                        Globals.USER_TYPE_STUDENT, Globals.USER_TYPE_TEACHERS, Globals.USER_TYPE_PARENTS,
                        Globals.USER_TYPE_SECRETARIES, Globals.USER_TYPE_PRINCIPAL
                    });
                }
                SelectedUserType = AvailableUserTypes[0];

                // Create a list of all the classes in the school
                _schoolData.Classes.ToList().ForEach(currClass => AvailableClasses.Add(currClass.classID, currClass.className));

                AvailableHomeroomClasses.Add(FIELD_NOT_SET, "לא מוגדר");
                _schoolData.Classes.Where(currClass => currClass.Teachers.Count() == 0).ToList()
                .ForEach(currClass => AvailableHomeroomClasses.Add(currClass.classID, currClass.className));

                // Create a list of all the parents in the school
                AvailableParents.Add(FIELD_NOT_SET, "לא מוגדר");
                _schoolData.Persons.Where(p => p.isParent).ToList()
                .ForEach(parent => AvailableParents.Add(parent.personID, parent.firstName + " " + parent.lastName));

                // Create a list of all the students in the school
                _schoolData.Persons.Where(p => p.isStudent).ToList()
                .ForEach(student => AvailableStudents.Add(student.personID, student.firstName + " " + student.lastName));

                // Create a list of all the courses in the school
                _schoolData.Courses.Where(course => course.isHomeroomTeacherOnly == false).ToList()
                .ForEach(course => AvailableCoursesMustChoose.Add(course.courseID, course.courseName));
                AvailableCourses.Add(FIELD_NOT_SET, "לא מוגדר");
                AvailableCoursesMustChoose.ToList().ForEach(course => AvailableCourses.Add(course.Key, course.Value));
            }
        }