/// <summary>
        /// Jonathan Sanborn
        /// 
        /// Problem Set Generator constructor.
        /// </summary>
        /// <param name="problemSet">The problemSet to generate the problems from</param>
        public ProblemSetGenerator(ProblemSet problemSet)
        {
            init();

            this.problemSet = problemSet;
            GenerateProblems();
        }
        /// <summary>
        /// Jonathan Sanborn
        ///
        /// Delete the passed in problem set from the XML
        /// </summary>
        /// <param name="problemSet">The Problem to delete</param>
        public void DeleteProblemSet(ProblemSet problemSet)
        {
            string fileName = Path.Combine(filePath, Properties.Settings.Default.problemSetsFilename);

            try
            {
                XDocument problemSetFile = OpenFile(fileName, MMFileType.ProblemSet);

                if (problemSetFile != null)
                {
                    try
                    {
                        problemSetFile.Descendants("ProblemSet").First(s => s.Element("ID").Value == problemSet.ID).Remove();
                        problemSetFile.Save(fileName);
                    }
                    catch (ArgumentNullException ex)
                    {
                        System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateUser failed null referance.\n" + ex.Message);
                    }
                    catch (InvalidOperationException ex)
                    {
                        System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateUser failed Invalid Operation.\n" + ex.Message);
                    }
                }
            }
            catch (FileNotFoundException ex)
            {
                System.Diagnostics.Debug.Write(ex.Message);
            }
        }
        /// <summary>
        /// Jonathan Sanborn
        /// 
        /// Problem Set Generator constructor.
        /// </summary>
        /// <param name="problemSet">The problemSet to generate the problems from</param>
        internal ProblemSetGenerator(ProblemSet problemSet)
        {
            init();

            this.problemSet = problemSet;
            GenerateProblems();
        }
        /// <summary>
        /// Jonathan Sanborn
        ///
        /// Problem Set Generator constructor.
        /// </summary>
        /// <param name="problemSet">The problemSet to generate the problems from</param>
        public ProblemSetGenerator(ProblemSet problemSet)
        {
            init();

            this.problemSet = problemSet;
            GenerateProblems();
        }
Exemple #5
0
        /// <summary>
        /// 22 March 2014 Jonathan Sanborn & Harvey Mercado
        /// Parameterized constructor for Assignment
        /// </summary>
        /// <param name="id">A unique ID for the Assignment</param>
        /// <param name="userID">The unique ID of the user that the assignment is assigned to.</param>
        /// <param name="problemSetId">the problem set Id of the for which the Problem Set that the assignment is built on</param>
        /// <param name="goal">The percent of problems that must be correct to pass this assignment values 0.0-1.0.</param>
        public Assignment(MMControl mmControl, string id, Student student, ProblemSet problemSet)
        {
            init();

            this.ID           = id;
            this.Student      = student;
            this.ProblemSet   = problemSet;
            this.DateAssigned = DateTime.Now;
            GetAssignmentAttempts(mmControl);
        }
        /// <summary>
        /// Jonathan Sanborn
        ///
        /// Saves the passed in Problem set to the XML
        /// </summary>
        /// <param name="problemSet">The Problem set to save</param>
        public void SaveNewProblemSet(ProblemSet problemSet)
        {
            string fileName = Path.Combine(filePath, Properties.Settings.Default.problemSetsFilename);

            try
            {
                XDocument problemSetFile = OpenFile(fileName, MMFileType.ProblemSet);

                if (problemSetFile != null)
                {
                    problemSetFile.Element("ProblemSets").Add(problemSet.GetXMLNode());
                    problemSetFile.Save(fileName);
                }
            }
            catch (FileNotFoundException ex)
            {
                System.Diagnostics.Debug.Write(ex.Message);
            }
        }
        /// <summary>
        /// 22 March 2014 Jonathan Sanborn & Harvey Mercado
        /// Parameterized constructor for Assignment
        /// </summary>
        /// <param name="mmControl">The Control Object</param>
        /// <param name="id">A unique ID for the Assignment</param>
        /// <param name="student">The student that this assignment belongs to.</param>
        /// <param name="problemSet">the problem set the assignment is built on</param>
        /// <param name="isCompleted">a boolean indicating that the assignment has been Completed</param>
        public Assignment(MMControl mmControl, string id, Student student, ProblemSet problemSet, bool isCompleted)
        {
            init();

            this.ID = id;
            this.Student = student;
            this.ProblemSet = problemSet;
            this.IsCompleted = isCompleted;
            this.DateAssigned = DateTime.Now;

            GetAssignmentAttempts(mmControl);
        }
        /// <summary>
        /// 22 March 2014 Jonathan Sanborn & Harvey Mercado
        /// Parameterized constructor for Assignment
        /// </summary>
        /// <param name="id">A unique ID for the Assignment</param>
        /// <param name="userID">The unique ID of the user that the assignment is assigned to.</param>
        /// <param name="problemSetId">the problem set Id of the for which the Problem Set that the assignment is built on</param>
        /// <param name="goal">The percent of problems that must be correct to pass this assignment values 0.0-1.0.</param>
        public Assignment(Ctrl mmControl, string id, Student student, ProblemSet problemSet)
        {
            init();

            this.ID = id;
            this.Student = student;
            this.ProblemSet = problemSet;
            this.DateAssigned = DateTime.Now;
            GetAssignmentAttempts(mmControl);
           
        }
 /// <summary>
 ///  22 March 2014
 /// Jonathan Sanborn & Harvey Mercado
 /// Add a new problem set to the system
 /// </summary>
 /// <param name="problemSet">The problem set to add to the system</param>
 internal void AddProblemSet(ProblemSet problemSet)
 {
     ProblemSetList.Add(problemSet);
     this.FileHandler.SaveNewProblemSet(problemSet);
 }
            /// <summary>
            /// Jonathan Sanborn
            /// 
            /// Delete the passed in problem set from the XML
            /// </summary>
            /// <param name="problemSet">The Problem to delete</param>
            public void DeleteProblemSet(ProblemSet problemSet)
            {
                string fileName = Path.Combine(filePath, Properties.Settings.Default.problemSetsFilename);

                try
                {
                    XDocument problemSetFile = OpenFile(fileName, MMFileType.ProblemSet);

                    if (problemSetFile != null)
                    {
                        try
                        {
                            problemSetFile.Descendants("ProblemSet").First(s => s.Element("ID").Value == problemSet.ID).Remove();
                            problemSetFile.Save(fileName);
                        }
                        catch (ArgumentNullException ex)
                        {
                            System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateUser failed null referance.\n" + ex.Message);
                        }
                        catch (InvalidOperationException ex)
                        {
                            System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateUser failed Invalid Operation.\n" + ex.Message);
                        }
                    }

                }
                catch (FileNotFoundException ex)
                {
                    System.Diagnostics.Debug.Write(ex.Message);
                }
            }
            /// <summary>
            /// Jonathan Sanborn
            /// 
            /// Saves the passed in Problem set to the XML
            /// </summary>
            /// <param name="problemSet">The Problem set to save</param>
            public void SaveNewProblemSet(ProblemSet problemSet)
            {
                string fileName = Path.Combine(filePath, Properties.Settings.Default.problemSetsFilename);

                try
                {
                    XDocument problemSetFile = OpenFile(fileName, MMFileType.ProblemSet);

                    if (problemSetFile != null)
                    {
                        problemSetFile.Element("ProblemSets").Add(problemSet.GetXMLNode());
                        problemSetFile.Save(fileName);
                    }
                }
                catch (FileNotFoundException ex)
                {
                    System.Diagnostics.Debug.Write(ex.Message);
                }
            
            }
Exemple #12
0
 /// <summary>
 ///  22 March 2014
 /// Jonathan Sanborn & Harvey Mercado
 /// Add a new problem set to the system
 /// </summary>
 /// <param name="problemSet">The problem set to add to the system</param>
 internal void AddProblemSet(ProblemSet problemSet)
 {
     ProblemSetList.Add(problemSet);
     this.FileHandler.SaveNewProblemSet(problemSet);
 }
        /// <summary> 
        /// Be handed control by CtrlStudnt object
        /// </summary>
        /// <author> Jeff Bunce </author>
        internal void TakeControl()
        {
            assignedDrill = loggedInStudent.Assignments.Where(w => !w.IsCompleted).First();

            problemSetGenerator = new ProblemSetGenerator(assignedDrill.ProblemSet);
            problemSet = assignedDrill.ProblemSet;
            problemList = problemSetGenerator.GetProblemList;
            attemptsRemaining = (int)assignedDrill.ProblemSet.NumberOfAttempts;
            currentProblem = problemList.First();
            problemList.Remove(CurrentProblem);
            ProblemNumber = 1;
            ProblemsCorrect = 0;
            ProblemsIncorrect = 0;
            sessionRunning = false;

            

            switch (problemSet.Operation.ToString())
            {
                case "Addition":
                    operationIndex = 1;
                    break;
                case "Subtraction":
                    operationIndex = 2;
                    break;
                case "Multiplication":
                    operationIndex = 3;
                    break;
                case "Division":
                    operationIndex = 4;
                    break;
                default:
                    operationIndex = 0;
                    break;
            }

            studentDrillForm.DisplayProblem(problemSet.NumberOfProblems.ToString(), (problemNumber).ToString(), operationIndex,
                currentProblem.Operand1.ToString(), currentProblem.Operand2.ToString());
            studentDrillForm.DisplayFeedback(String.Empty); // feedback given upon giving an answer

            studentDrillForm.ShowDialog();
        }