Ejemplo n.º 1
0
        //Stephanie Yao
        /* CONTEXT: A user has already been selected from the list of assigned students. 
         * PURPOSE: Deletes a user from the group (in memory only- no XML writing).*/
        public void delUserFromGroupBtn_Click(object sender, EventArgs e)
        {
            //Remove from the list of the affiliated group (given by active Tab Page)
            string group="U";

            //JT: we need to actually update the targetUserGroup variable to know what student we are moving
            //targetUserGroup = currentTeacher.students[1];

            targetUserGroup  = update_var_targetuserGroup();
            
            if (targetUserGroup != null)
            {
                switch (manageGroupTabControl.SelectedTab.Name)
                {
                    case "GroupPageA":
                        GroupA.Remove(targetUserGroup);
                        //group="A";
                        Console.WriteLine("we are removing from groupA:::" + targetUserGroup.fullName);
                        break;
                    case "GroupPageB":
                        GroupB.Remove(targetUserGroup);
                        //group="B";
                        Console.WriteLine("we are removing from groupB:::" + targetUserGroup.fullName);
                        break;
                    case "GroupPageC":
                        GroupC.Remove(targetUserGroup);
                        //group="C";
                        Console.WriteLine("we are removing from groupC:::" + targetUserGroup.fullName);
                        break;
                }
            //check if user is in the list, if it is dont add it
            //Aurelio Arango
            
                if (!checkStudentIsInList(Unassigned, targetUserGroup.userID))
                {
                    
                    changeStudentGroup(targetUserGroup.userID, group);
                    Unassigned.Add(targetUserGroup);

                    //Update the listBox
                    load_valid_students();
                    load_ManageStudentList();
                    //refresh_ManageStudentListBoxes();
                }
            }

            //JT: set the student to null becase we are done moving students. before it was saving the last student we  moved
            targetUserGroup = null;

        }//end function
Ejemplo n.º 2
0
 }//end function
 //Stephanie Yao
 private void groupRosterC_SelectedIndexChanged(object sender, EventArgs e)
 {
     //userChangeGroupIndex = Convert.ToInt32(groupRosterC.SelectedIndex);
     int size = groupRosterC.Items.Count;
     //Debug.WriteLine(size);
     if (size > 0 && manageGroupTabControl.SelectedTab.Name.Equals("GroupPageC"))
     {
         Debug.WriteLine(manageGroupTabControl.SelectedTab.Name);
         userChangeGroupIndex = Convert.ToInt32(groupRosterA.SelectedIndex);
         if(userChangeGroupIndex >=0 && GroupC.Count != 0)
         {
             //Debug.WriteLine(groupRosterC.Text);
             //Debug.WriteLine(size);
              targetUserGroup = GroupC[userChangeGroupIndex];
         }
     }
     //Console.WriteLine("from groupRosterC");
 }//end function
Ejemplo n.º 3
0
 }//end function
 //Aurelio Arango
 //4-7-14
 private void manageStudentList_SelectedIndexChanged(object sender, EventArgs e)
 {
     int size = manageStudentList.Items.Count;
     
     if (size > 0 )
     {
         manageStudentIndex = Convert.ToInt32(manageStudentList.SelectedIndex);
         if (manageStudentIndex >= 0 )
         {
             //Debug.WriteLine(manageStudentList.Text);
             //Debug.WriteLine(size);
             targetUserUnassigned = Unassigned[manageStudentIndex];//
         }
         //Console.WriteLine("the current person clicked on is:" + Unassigned[manageStudentIndex].fullName);
     }
 }
Ejemplo n.º 4
0
        }//end validate input

//
//------------------------------------------------Set Problems page end
//
//
//----------------------------------------Manage Users page start
// 
         //Aurelio Arango and Stephanie Yao
        //Laod all the lists based on the user info
        /*  COMPONENT: Called in AdminForm_Load(..., ...).*/
        private void load_ManageStudentList()
        {
            Unassigned = new List<Student>();
            GroupA = new List<Student>();
            GroupB = new List<Student>();
            GroupC = new List<Student>();
            Student targetUserUnassigned = new Student();
            Student targetUserGroup = new Student();

            for (int i = 0; i < valid_students.Count; i++)
            {
                switch (valid_students[i].group)
                {
                    case "U": Unassigned.Add(valid_students[i]); break;
                    case "A": GroupA.Add(valid_students[i]); break;
                    case "B": GroupB.Add(valid_students[i]); break;
                    case "C": GroupC.Add(valid_students[i]); break;
                }//end switch
            }//end for
            refresh_ManageStudentListBoxes();
            clearListBoxes();
        }
Ejemplo n.º 5
0
        //When you select someone from the list, save to a variable which member it is, and personalize a message.
        /* SELECTEDINDEXCHANGED event triggered when selecting a different student for whom to create problems
         * Will update the label (Generating problems for...) and the file path.
         * Kevin and Uriah
         */

       
        private void listOfStudents_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Program.targetUser = Convert.ToInt32(listOfStudents.SelectedIndex);
            int selectedIndex = Convert.ToInt32(listOfStudents.SelectedIndex);;
            //Debug.WriteLine(listOfStudents.SelectedIndex);
            if (selectedIndex <= 0)
            {
                selectedIndex = 0;
            }
            //targetUser = Program.teachers[Program.currentTeacherIndex].students[Program.currentStudentIndex];
            setProblems_targetStudent = new Student();
            setProblems_targetStudent = Program.teachers[Program.currentTeacherIndex].students[selectedIndex];
            
            //Aurelio Arango
            //adding string for date and user
            //string admin_welcome = "Welcome " + currentUser.fullName + " "+getUserDate(currentUser.userID);
            string admin_welcome = "Welcome " + currentTeacher.fullName + " " + currentTeacher.lastLogin;

            fileName = @"c:\users\public\MathDrills\ProblemSets\" + setProblems_targetStudent.userID + ".xml";

            //labelGenProblemsFor.Text = admin_welcome;// +"\nCreating problems for " + setProblems_targetStudent.fullName;
            //labelGenProblemsFor.Left = (((this.ClientSize.Width - 179) - labelGenProblemsFor.Width) / 2) + 179; //Center the greeting. 179 accounts for the list of users on the side.
        }
Ejemplo n.º 6
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 = "";
                }
            }

        }
Ejemplo n.º 7
0
        }//end function
        //Aurelio Arango
        //4-7-14
        private void manageStudentList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int size = manageStudentList.Items.Count;
            
            if (size > 0 )
            {
                manageStudentIndex = Convert.ToInt32(manageStudentList.SelectedIndex);
                if (manageStudentIndex >= 0 )
                {
                    //Debug.WriteLine(manageStudentList.Text);
                    //Debug.WriteLine(size);
                    targetUserUnassigned = Unassigned[manageStudentIndex];//
                }
            }

        }
Ejemplo n.º 8
0
        /*Aurelio Arango
         * This method retrieves the last login date for a given user based user id.
         * Returns a string of the last date a student was logged. 
         */
        //Aurelio Arango
        //Not in use because student object holds last loggin
       /* public string getDate(int user_id)
        {
            string string_date="";
            XElement studentListXML;
            studentListXML = XElement.Load(Program.USERSFILE);

            foreach (XElement user in studentListXML.Descendants("Student"))
            {
                if (Convert.ToInt32(user.Element("UserID").Value) == user_id)
                {
                    string_date = user.Element("LastLogin").Value;
                }
            }

            return string_date;
        }*/
        
        /*
         *Jorge Torres & Aurelio Arango & Kevin Novak 24/29/2014 - Reload all the data when the form is reloaded
         */
        private void loadAll()
        {
            currentUser = new Student();
            //currentUser = Program.Student[Program.currentStudentIndex];
            
            currentUser = Program.students[Program.currentStudentIndex]; //Program.teachers[Program.currentTeacherIndex].students[Program.currentStudentIndex];

            Console.WriteLine(currentUser.fullName);
        }