Ejemplo n.º 1
0
        //------------------------------------------------------------------//
        // Authors: Cody Jordan, Cian Carota                                //
        // Date: 4/5/14                                                     //
        //------------------------------------------------------------------//
        /// <summary>Adding a new record to Student XML. </summary>
        /// <param name="student">Student object to be modified.</param>
        /// <param name="RecordToAdd">Record to be added.</param>
        /// <returns>Boolean confirmation.</returns>
        public bool AddNewRecord(Student student, Record RecordToAdd)
        {
            XDocument data = XDocument.Load(student.RecordsPath);

            XElement newRecord = CreateRecordNode(RecordToAdd);

            newRecord.SetAttributeValue("ID", GetNextAvailableID(student.RecordsPath, "record"));
            RecordToAdd.ID = Convert.ToInt32(newRecord.Attribute("ID").Value);

            data.Element("Records").Add(newRecord);
            student.curRecordList.Add(RecordToAdd);
            data.Save(student.RecordsPath);
            return true;
        }
Ejemplo n.º 2
0
        //------------------------------------------------------------------//
        // Authors: Cody Jordan, Cian Carota                                //
        // Date: 4/5/14                                                     //
        //------------------------------------------------------------------//
        /// <summary>Add a drill to a student in Student XML.</summary>
        /// <param name="student">Student object to be modified</param>
        /// <param name="drillToAdd">Drill object to be added.</param>
        /// <param name="studentXMLPath">Student XML file path.</param>
        /// <returns>Boolean confirming success.</returns>
        public bool AddDrillToStudentXML(Student student, Drill drillToAdd, string studentXMLPath)
        {
            XDocument data = XDocument.Load(studentXMLPath);

            XElement studentElement = data.Descendants("stu").Where(s => s.Attribute("ID").Value.Equals(student.ID.ToString())).FirstOrDefault();
            bool isDrillAlreadyAssignedToStudent = isDrillAssigned(student, drillToAdd);
            if ((studentElement != null) && (!isDrillAlreadyAssignedToStudent))
            {
                XElement newStudentDrill = new XElement("drill", drillToAdd.ID);
                student.curDrillList.Add(drillToAdd);

                studentElement.Add(newStudentDrill);
                data.Save(studentXMLPath);
                return true;
            }
            return false;
        }
Ejemplo n.º 3
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/5/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Add data from active session to XML.</summary>
 /// <param name="currentStudent">Student object to be modified.</param>
 /// <param name="currentDrill">Drill object to be modified.</param>
 public void WriteCurrentSession(Student currentStudent, Drill currentDrill)
 {
     XMLStudentDriver.WriteCurrentSession(currentStudent, currentDrill);
     /*
     Record RecordToAdd = new Record(currentDrill.DrillName, DateTime.Now.ToString("M/d/yyyy"), currentDrill.Questions, currentDrill.RangeStart,
         currentDrill.RangeEnd, currentDrill.Operand, currentDrill.Wrong, currentDrill.Percent, currentDrill.Skipped);
     AddRecordToStudent(currentStudent, RecordToAdd);*/
 }
Ejemplo n.º 4
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/5/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Creating Student XML for addition of first student.
 /// </summary>
 /// <param name="newStudentEntry">Student object to be added.</param>
 /// <param name="studentXMLPath">Student XML file path.</param>
 /// <param name="studentList">List of student objects.</param>
 /// <returns>Boolean confirmation.</returns>
 public bool InitialCreateStudentXml(Student newStudentEntry, string studentXMLPath, List<Student> studentList)
 {
     return XMLStudentDriver.InitialCreateStudentXml(newStudentEntry, studentXMLPath, studentList);
 }
Ejemplo n.º 5
0
 //----------------------------------------------------------------------------------------------//
 // Authors: Joshua Boone and Justine Dinh                                                       //
 // Date: 4/14/14                                                                                //
 //----------------------------------------------------------------------------------------------//
 //------------------------------------------------------------------//
 /// <summary>Calls the update student's reward data in student XML function.</summary>
 /// <param name="student">Student object to be modified.</param>
 public void EditRewardAmount(Student selectedStudent)
 {
     XMLStudentDriver.EditRewardAmount(selectedStudent, studentXMLPath, dataDirectory);
 }
Ejemplo n.º 6
0
 ////------------------------------------------------------------------//
 //// Authors: Cody Jordan, Cian Carota                                //
 //// Date: 4/5/14                                                     //
 ////------------------------------------------------------------------//
 ///// <summary>Edit data in Student XML.</summary>
 ///// <param name="newFName">Student's first name.</param>
 ///// <param name="newLName">Student's last name.</param>
 ///// <param name="selectedStudent">Student object to be modified</param>
 ///// <param name="group">Group object associated with student.</param>
 ///// <param name="studentList">List of student objects.</param>
 ///// <returns>bool, bool</returns>
 //public Tuple<bool, bool> editStudent(string newFName, string newLName, Student selectedStudent, Group group, List<Student> studentList)
 //{
 //    return XMLStudentDriver.editStudent(newFName, newLName, selectedStudent, group, studentList, studentXMLPath, groupXMLPath, dataDirectory);
 //}
 //----------------------------------------------------------------------------------------------//
 // Authors: Joshua Boone and Justine Dinh                                                       //
 // Date: 4/12/14                                                                                //
 //----------------------------------------------------------------------------------------------//
 //------------------------------------------------------------------//
 /// <summary>Edit a student's group placement.</summary>
 /// <param name="selectedStudent">Student object to be modified</param>
 /// <param name="group">Group object associated with student.</param>
 public void EditGroup(Student selectedStudent, Group group)
 {
     selectedStudent.GroupID = group.ID;
     XMLStudentDriver.EditGroup(selectedStudent, studentXMLPath, groupXMLPath, dataDirectory);
 }
Ejemplo n.º 7
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/5/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Add a studet to student XML.</summary>
 /// <param name="newStudent">Student object to be added.</param>
 /// <param name="studentList">List of student objects.</param>
 /// <returns>Boolean confirmation.</returns>
 public bool AddUserToXML(Student newStudent, List<Student> studentList)
 {
     return XMLStudentDriver.AddUserToXML(newStudent, studentList, studentXMLPath, dataDirectory);
 }
Ejemplo n.º 8
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/5/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Adding a new student to Student XML.</summary>
 /// <param name="student">Student object to be added.</param>
 /// <param name="studentXMLPath">Student XML's file path.</param>
 /// <param name="studentList">List of student objects.</param>
 /// <returns>Boolean confirmation.</returns>
 public bool AddNewStudent(Student student, string studentXMLPath, List<Student> studentList)
 {
     return XMLStudentDriver.AddNewStudent(student, studentXMLPath, studentList);
 }
Ejemplo n.º 9
0
 //----------------------------------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                                            //
 // Date: 4/3/14                                                                                 //
 //----------------------------------------------------------------------------------------------//
 /// <summary>Add all group's drills to student's XML file.</summary>
 /// <param name="group">Group object acting as source.</param>
 /// <param name="student">Student object to be modified.</param>
 public void AddGroupDrillsToStudent(Group group, Student student)
 {
     if ((group != null) && (student != null))
     {
         foreach(Drill drill in group.groupDrillList)
         {
             AddDrillToStudent(student, drill);
         }
     }
 }
Ejemplo n.º 10
0
 //----------------------------------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                                            //
 // Date: 4/3/14                                                                                 //
 //----------------------------------------------------------------------------------------------//
 /// <summary>Remove a drill from student's XML file.</summary>
 /// <param name="student">Student object to be modified.</param>
 /// <param name="drillToRemove">Drill object to be removed.</param>
 /// <returns>Boolean confirming removal success.</returns>
 public bool RemoveDrillFromStudent(Student student, Drill drillToRemove)
 {
     return XMLDriver.RemoveDrillFromStudentXML(student, drillToRemove);
 }
Ejemplo n.º 11
0
 //----------------------------------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                                            //
 // Date: 4/3/14                                                                                 //
 //----------------------------------------------------------------------------------------------//
 /// <summary>Add a drill to student's XML file.</summary>
 /// <param name="student">Student object to be modified.</param>
 /// <param name="drillToAdd">Drill object to be added.</param>
 /// <returns>Boolean confirming addition success.</returns>
 public bool AddDrillToStudent(Student student, Drill drillToAdd)
 {
     return XMLDriver.AddDrillToStudentXML(student, drillToAdd);
 }
Ejemplo n.º 12
0
 //----------------------------------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                                            //
 // Date: 4/3/14                                                                                 //
 //----------------------------------------------------------------------------------------------//
 /// <summary>Validation of student data input.</summary>
 /// <param name="studentToValidate">Stdent object to validate.</param>
 /// <returns>Boolean confirming validity.</returns>
 public bool isStudentInfoValid(Student studentToValidate)
 {
     if (!(studentToValidate.FirstName.Equals(string.Empty))
         && (studentToValidate.FirstName.All(char.IsLetter))
         && !(studentToValidate.LastName.Equals(string.Empty))
         && (studentToValidate.LastName.All(char.IsLetter))
         && (studentToValidate.GroupID > 0)
         && (groupList.Any(group => group.ID.Equals(studentToValidate.GroupID)))
         && (!adminList.Any(admin => admin.LoginName.Equals(studentToValidate.LoginName))))
     {
         return true;
     }
     return false;
 }
Ejemplo n.º 13
0
        //------------------------------------------------------------------//
        // Authors: Joshua Boone and Justine Dinh                           //
        // Date: 4/12/14                                                    //
        //------------------------------------------------------------------//
        public float GetAverageWrongStudent(Student student)
        {
            float average = 0.0f;
            int totalQuestions = 0;
            string date = "";
            if (student.curRecordList.Count > 0)
            {
                foreach (Record currentRecord in student.curRecordList)
                {
                    date = currentRecord.DateTaken;
                    if ((DateTime.Parse(date) >= StartDate) && (DateTime.Parse(date) <= EndDate))
                    {
                        average = average + Convert.ToInt32(currentRecord.Wrong);
                        totalQuestions = totalQuestions + Convert.ToInt32(currentRecord.Question);
                    }
                }
                if (totalQuestions != 0)
                {
                    average = (average / totalQuestions)*100;
                }
            }

            return average;
        }
Ejemplo n.º 14
0
        //------------------------------------------------------------------//
        // Authors: Joshua Boone and Justine Dinh                           //
        // Date: 4/12/14                                                    //
        //------------------------------------------------------------------//
        public float GetAveragePercentStudent(Student student)
        {
            float average = 0.0f;
            string date = "";
            if (student.curRecordList.Count > 0)
            {
                foreach (Record currentRecord in student.curRecordList)
                {
                    date = currentRecord.DateTaken;
                    if ((DateTime.Parse(date) >= StartDate) && (DateTime.Parse(date) <= EndDate))
                    {
                        average = average + float.Parse(currentRecord.Percent);
                    }
                }
                average = average / student.curRecordList.Count;
            }

            return average;
        }
Ejemplo n.º 15
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/3/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Will refresh 'Stu/Grp' and 'Select 
 /// Drill' combo boxes relative to intent to unassign a drill to a 
 /// student.</summary>
 /// <param name="student">The student to be modified</param>
 private void RefreshUnassignedStudentCmboBoxes(Student student)
 {
     RefreshStudentCmboBox();
     RefreshSelectUnassignedDrillCmbo(student);
 }
Ejemplo n.º 16
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/5/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Add a drill to Student XML.</summary>
 /// <param name="student">Student object to be modified.</param>
 /// <param name="drillToAdd">Drill object to be added.</param>
 /// <returns>Boolean confirmation.</returns>
 public bool AddDrillToStudentXML(Student student, Drill drillToAdd)
 {
     return XMLStudentDriver.AddDrillToStudentXML(student, drillToAdd, studentXMLPath);
 }
Ejemplo n.º 17
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/5/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Adding a new record to Student XML. </summary>
 /// <param name="student">Student object to be modified.</param>
 /// <param name="RecordToAdd">Record to be added.</param>
 /// <returns>Boolean confirmation.</returns>
 public bool AddNewRecord(Student student, Record RecordToAdd)
 {
     return XMLStudentDriver.AddNewRecord(student, RecordToAdd);
 }
Ejemplo n.º 18
0
 //----------------------------------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                                            //
 // Date: 4/3/14                                                                                 //
 //----------------------------------------------------------------------------------------------//
 /// <summary>Remove all group's drills from student's XML file.</summary>
 /// <param name="group">Group object acting as source.</param>
 /// <param name="student">Student object to be modified.</param>
 public void RemoveGroupDrillsFromStudent(Group group, Student student)
 {
     if ((group != null) && (student != null))
     {
         foreach (Drill drill in group.groupDrillList)
         {
             RemoveDrillFromStudent(student, drill);
         }
     }
 }
Ejemplo n.º 19
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/5/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Add a record to student data.</summary>
 /// <param name="student">Student object to be modified.</param>
 /// <param name="RecordToAdd">Record object to be added.</param>
 public void AddRecordToStudent(Student student, Record RecordToAdd)
 {
     XMLStudentDriver.AddRecordToStudent(student, RecordToAdd);
 }
Ejemplo n.º 20
0
        //----------------------------------------------------------------------------------------------//
        // Authors: Cody Jordan, Cian Carota                                                            //
        // Date: 4/3/14                                                                                 //
        //----------------------------------------------------------------------------------------------//
        /// <summary>Establish current student.</summary>
        /// <param name="currentUser">Name of current user.</param>
        /// <returns>Boolean confirmation.</returns>
        public bool SetCurrentStudent(string currentUser)
        {
            currentStudent = FindStudent(currentUser);
            if (currentStudent != null)
                return true;

            return false;
        }
Ejemplo n.º 21
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/5/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Delete a student from Student XML.</summary>
 /// <param name="student">Student object to be removed.</param>
 /// <param name="studentList">List of student object.</param>
 /// <returns>Boolean confirmation.</returns>
 public bool Delete(Student student, List<Student> studentList)
 {
     return XMLStudentDriver.Delete(student, studentList, studentXMLPath);
 }
Ejemplo n.º 22
0
 //------------------------------------------------------------------//
 // Kyle Bridges                                                     //
 // Date: 2/26/2014                                                  //
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/3/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Clears local data current student object.</summary>
 public void ClearStudentUser()
 {
     if(currentStudent != null)
     {
         currentStudent.LastLogin = currentUserLogin;
         studentList.Add(currentStudent);
         currentStudent = new Student(); // Clear student
     }
 }
Ejemplo n.º 23
0
 //----------------------------------------------------------------------------------------------//
 // Authors: Joshua Boone and Justine Dinh                                                       //
 // Date: 4/12/14                                                                                //
 //----------------------------------------------------------------------------------------------//
 //------------------------------------------------------------------//
 /// <summary>Edit a student's group placement.</summary>
 /// <param name="selectedStudent">Student object to be modified</param>
 /// <param name="group">Group object associated with student.</param>
 public void EditName(Student selectedStudent)
 {
     XMLStudentDriver.EditName(selectedStudent, studentXMLPath, dataDirectory);
 }
Ejemplo n.º 24
0
 public void CreateRecord()
 {
     //Student currentStudent;
     Random random = new Random();
     int randomNumber = 0;  random.Next(0, 100);
     for (int i = 0; i < 5; i++)
     {
         foreach (Student stu in studentList)
         {
             currentStudent = stu;
             foreach (Drill drill in mainDrillList)
             {
                 currentStudent.curDrill = drill;
                 randomNumber = random.Next(0, (Convert.ToInt32(currentStudent.curDrill.Questions)+1));
                 currentStudent.curDrill.Wrong = randomNumber.ToString();
                 randomNumber = random.Next(0, ((Convert.ToInt32(currentStudent.curDrill.Questions) - Convert.ToInt32(currentStudent.curDrill.Wrong)))+1);
                 currentStudent.curDrill.Skipped = randomNumber.ToString();
                 currentStudent.curDrill.Wrong = (Convert.ToInt32(currentStudent.curDrill.Wrong) + Convert.ToInt32(currentStudent.curDrill.Skipped)).ToString();
                 currentStudent.curDrill.Percent = CalculatePercentage();
                 UpdateRewards();
                 XMLDriver.WriteCurrentSession(currentStudent, currentStudent.curDrill);
             }
         }
     }
 }
Ejemplo n.º 25
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/5/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Creating Record XML for addition of first record.
 /// </summary>
 /// <param name="RecordToAdd">Record object to added.</param>
 /// <param name="student">Student object related to record.</param>
 /// <returns>Boolean confirmation.</returns>
 public bool InitialCreateRecordXML(Student student, Record RecordToAdd)
 {
     return XMLStudentDriver.InitialCreateRecordXML(student, RecordToAdd);
 }
Ejemplo n.º 26
0
        //------------------------------------------------------------------//
        // Authors: Joshua Boone and Justine Dinh                           //
        // Date: 4/16/14                                                    //
        //------------------------------------------------------------------//
        /// <summary>Validate the student info and then add the student to the student XML</summary>
        /// <param name="groupID">Student's group ID.</param>
        /// <param name="firstName">Student's first name.</param>
        /// <param name="lastName">Student's last name.</param>
        /// <param name="lastLogin">Student's last login date.</param>
        /// <returns>Boolean confirming creation success.</returns>
        public int CreateStudent(string groupName, string firstName, string lastName, string lastLogin)
        {
            int returnCode = 0;
            int groupID = FindGroupIDByName(groupName);
            if (groupID == 0)
            {
                returnCode = 1;
            }
            bool isCreatedUser = false;
            Student newStudent = new Student(groupID, firstName, lastName, lastLogin);

            bool isUserInfoValid = isStudentInfoValid(newStudent);
            if (isUserInfoValid)
                isCreatedUser = XMLDriver.AddUserToXML(newStudent, studentList);
            if (isCreatedUser)
            {
                Group group = groupList.Where(grp => grp.ID.ToString().Equals(newStudent.GroupID.ToString())).FirstOrDefault();
                AddGroupDrillsToStudent(group, newStudent);
            }
            return returnCode;
        }
Ejemplo n.º 27
0
 //------------------------------------------------------------------//
 // Authors: Cody Jordan, Cian Carota                                //
 // Date: 4/5/14                                                     //
 //------------------------------------------------------------------//
 /// <summary>Remove a drill from Student XML.</summary>
 /// <param name="student">Student object to be modified.</param>
 /// <param name="DrillToRemove">Drill object to be removed.</param>
 /// <returns>Boolean confirmation.</returns>
 public bool RemoveDrillFromStudentXML(Student student, Drill DrillToRemove)
 {
     return XMLStudentDriver.RemoveDrillFromStudentXML(student, DrillToRemove, studentXMLPath);
 }
Ejemplo n.º 28
0
        //----------------------------------------------------------------------------------------------//
        // Authors: Cody Jordan, Cian Carota                                                            //
        // Date: 4/3/14                                                                                 //
        //----------------------------------------------------------------------------------------------//
        /// <summary>Validate the student info and then add the student to the student XML</summary>
        /// <param name="groupID">Student's group ID.</param>
        /// <param name="firstName">Student's first name.</param>
        /// <param name="lastName">Student's last name.</param>
        /// <param name="lastLogin">Student's last login date.</param>
        /// <returns>Boolean confirming creation success.</returns>
        public bool CreateUser(int groupID, string firstName, string lastName, string lastLogin)
        {
            bool isCreatedUser = false;
            Student newStudent = new Student(groupID, firstName, lastName, lastLogin);

            bool isUserInfoValid = isStudentInfoValid(newStudent);
            if(isUserInfoValid)
                isCreatedUser = XMLDriver.AddUserToXML(newStudent, studentList);
            if(isCreatedUser)
            {
                Group group = groupList.Where(grp => grp.ID.ToString().Equals(newStudent.GroupID.ToString())).FirstOrDefault();
                AddGroupDrillsToStudent(group, newStudent);
            }
            return isCreatedUser;
        }
Ejemplo n.º 29
0
 //------------------------------------------------------------------//
 // Authors: Joshua Boone and Justine Dinh                           //
 // Date: 4/28/14                                                    //
 //------------------------------------------------------------------//
 /// <summary>Function to actually fill the data grid with the assigned drills of the selected student.</summary>
 private void FillAvailableDrillsStudentDataGrid(Student student)
 {
     foreach (Drill drill in localManager.mainDrillList)
     {
         Drill studentDrill = student.CurDrillList.Where(dri => dri.ID.ToString().Equals(drill.ID.ToString())).FirstOrDefault();
         if (studentDrill == null)
         {
             DataGridViewRow newRow = (DataGridViewRow)AvailableDrillDataDisplay.Rows[0].Clone();
             newRow.Cells[0].Value = drill.DrillName;
             AvailableDrillDataDisplay.Rows.Add(newRow);
         }
     }
 }
Ejemplo n.º 30
0
        //------------------------------------------------------------------//
        // Kyle Bridges                                                     //
        // Date: 2/26/2014                                                  //
        //------------------------------------------------------------------//
        public Student FindStudentForReport(string currentUser)
        {
            Student aStudent = new Student();

            foreach (Student student in studentList)
            {
                if (student.LoginName == currentUser)
                {
                    aStudent = student;
                    break;
                }
            }

            return aStudent;
        }