Esempio n. 1
0
        //This method loads all the students that are visible
        protected void load_valid_students()
        {
            valid_students = new List<Student>();
            currentTeacher = Program.teachers[Program.currentTeacherIndex];

            /*
             * 
             * for (int i = 0; i < currentTeacher.students.Count; i++)
            {
                if (currentTeacher.students[i].invisible.Equals("n"))
                {
                    valid_students.Add(currentTeacher.students[i]);
                    //Debug.WriteLine(currentTeacher.students[i].fullName);
                    //Debug.WriteLine(currentTeacher.students[i].invisible);
                }
            }
             * /
            /*---------------------------------------------------------------------------------------
         * JORGE TORRES: Chaning above method to a foreach method.foreach methods are easier to 
             * understand, and visualise. We are chaning it to help read the code.
         *--------------------------------------------------------------------------------------*/
            
            foreach (Student load_student in currentTeacher.students)
            {
                if (load_student.invisible.Equals("n"))
                {
                    valid_students.Add(load_student);
                }
            }

            
            
        }
Esempio n. 2
0
        }//end of save function
        //Aurelio Arango
        //3-31-14
        //This method loads the current user from the xml
        public void load_users()
        {
            Program.teachers.Clear();
            teachersListXML = XElement.Load(Program.USERSFILE);
            int index = 0;
            foreach (XElement user in teachersListXML.Descendants("Teacher"))
            {
                string newName = user.Element("FullName").Value;
                string pass = user.Element("pass").Value;
                int userID = Convert.ToInt32(user.Element("UserID").Value);

                /*
                 * Jorge and Aurelio. Making sure that the security settings set by the teacer are being loaded appropirately.
                 */

                String setPass = user.Element("SetPass").Value;

                List<Student> studentList = getStudentList(user);
                Teacher tempTeacher = new Teacher(newName, userID, studentList, pass);

                Program.teachers.Add(tempTeacher);
                Program.teachers[index].lastLogin = Convert.ToDateTime(user.Element("LastLogin").Value);
                Program.teachers[index].setpass = setPass;
                index++;
            }
            //Debug code
            /*for (int i = 0; i < Program.teachers.Count; i++)
            {
                for (int j = 0; j < Program.teachers[i].students.Count; j++)
                {
                    Debug.WriteLine(Program.teachers[i].students[j].fullName);
                    Debug.WriteLine(Program.teachers[i].students[j].invisible);
                }
            }*/
        }//end of load_users
Esempio n. 3
0
        //Aurelio Arango
        //Helper method to fill/refresh all the data
        private void loadAll()
        {
            
            currentTeacher = new Teacher();
            currentTeacher = Program.teachers[Program.currentTeacherIndex];
            loadTime();
            load_valid_students();
            loadvisibleStudents();
            load_ManageStudentList();
            load_problemSetPage();
            load_dashboard();
            load_reportsPage();
            load_AddDeleteUserPage();
            load_aboutPage();

            /*
             * Jorge & Aurelio- THe method. load_security will load the security level that a teacher had set in a previous session.
             */
            load_security();

        }
Esempio n. 4
0
        //Aurelio ARango
        //This method was taken from Kevin's and Uriahs, and uses objects rather than accessing the xml
        //This method adds a new student or teacher to the xml
        private void add_student_button_Click(object sender, EventArgs e)
        {
            string userFullName = "";
            userFullName = inputFullName.Text;
            userFullName = removeSpecialChars(userFullName);
            if (userFullName.Count() > 0)
            {
                //if is a student, create a new student and add to main list
                if (add_delete_Student_radioButton.Checked)
                {

                    int total_students = Program.teachers[Program.currentTeacherIndex].students.Count;
                    int new_id = Program.teachers[Program.currentTeacherIndex].userID + total_students + 1;
                    Student newStudent = new Student(userFullName, new_id, "U", "1");
                    //add new student
                    Program.teachers[Program.currentTeacherIndex].students.Add(newStudent);
                    loadAll();//updating all pages
                    inputFullName.Text = "";
                }//add a teacher
                else
                {
                    int new_id = Program.teachers[Program.currentTeacherIndex].userID  + 100;//increase by 100 each id
                    List<Student> slist = new List<Student>();
                    Teacher newTeacher = new Teacher(userFullName,new_id,slist,"admin");
                    Program.teachers.Add(newTeacher);
                    loadAll();//updating all pages
                    inputFullName.Text = "";
                }
            }

        }
Esempio n. 5
0
 //This method loads all the students that are visible
 protected void load_valid_students()
 {
     valid_students = new List<Student>();
     currentTeacher = Program.teachers[Program.currentTeacherIndex];
     for (int i = 0; i < currentTeacher.students.Count; i++)
     {
         if (currentTeacher.students[i].invisible.Equals("n"))
         {
             valid_students.Add(currentTeacher.students[i]);
             //Debug.WriteLine(currentTeacher.students[i].fullName);
             //Debug.WriteLine(currentTeacher.students[i].invisible);
         }
     }
     
 }
Esempio n. 6
0
        //Aurelio Arango
        //Helper method to fill/refresh all the data
        private void loadAll()
        {
            
            currentTeacher = new Teacher();
            currentTeacher = Program.teachers[Program.currentTeacherIndex];
            loadTime();
            load_valid_students();
            loadvisibleStudents();
            load_ManageStudentList();
            load_problemSetPage();
            load_dashboard();
            load_reportsPage();
            load_AddDeleteUserPage();
            load_aboutPage();

        }
Esempio n. 7
0
        }//end of save function
        //Aurelio Arango
        //3-31-14
        //This method loads the current user from the xml
        public void load_users()
        {
            Program.teachers.Clear();
            teachersListXML = XElement.Load(Program.USERSFILE);
            int index = 0;
            foreach (XElement user in teachersListXML.Descendants("Teacher"))
            {
                string newName = user.Element("FullName").Value;
                string pass = user.Element("pass").Value;
                int userID = Convert.ToInt32(user.Element("UserID").Value);

                List<Student> studentList = getStudentList(user);
                Teacher tempTeacher = new Teacher(newName, userID, studentList, pass);

                Program.teachers.Add(tempTeacher);
                Program.teachers[index].lastLogin = Convert.ToDateTime(user.Element("LastLogin").Value);
                index++;
            }
            //Debug code
            /*for (int i = 0; i < Program.teachers.Count; i++)
            {
                for (int j = 0; j < Program.teachers[i].students.Count; j++)
                {
                    Debug.WriteLine(Program.teachers[i].students[j].fullName);
                    Debug.WriteLine(Program.teachers[i].students[j].invisible);
                }
            }*/
        }//end of load_users