Esempio n. 1
0
        ///// <summary>
        ///// 1 April 2014
        ///// Jonathan Sanborn
        /////
        ///// Gets the assignements and assignments of the passed in student.
        ///// </summary>
        ///// <param name="student">The Student to load with the assignment</param>
        //public void GetStudentAssignments(ref Student student)
        //{
        //    student.Assignments.Clear();
        //    student.AssignmentAttempts.Clear();

        //    student.Assignments.AddRange(FileHandler.GetAssignmentsByUser(student));

        //    foreach (Assignment assign in student.Assignments)
        //    {
        //        student.AssignmentAttempts.AddRange(FileHandler.GetAssignmentAttemptsByAssignmentID(assign.ID));
        //    }

        //}

        /// <summary>
        /// 22 March 2014
        /// Jonathan Sanborn & Harvey Mercado
        /// Called to login the user currently set
        ///
        /// 21 April 2014
        /// Jeff Bunce
        /// Refactored
        ///
        /// </summary>
        internal void UserLogin()
        {
            if (currentUser == null)
            {
                MessageBox.Show("Please Select a user.", "Select User", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;  // must select a user
            }


            TextBox txtPassword = LoginForm.Controls.Find("txtPassword", true)[0] as TextBox;

            if (AuthenticateUser(CurrentUser, txtPassword.Text))
            {
                txtPassword.Text = string.Empty;
                currentUser.Login();
            }
            else
            {
                MessageBox.Show("Wrong Password", "Wrong Password", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtPassword.Text = String.Empty;
                return;  // selected user must authenticate
            }


            if (currentUser.UserType == UserType.Student)
            {
                currentStudent = StudentList.Where(w => currentUser.ID == w.ID).First();

                ProblemSetList.Clear();

                if (currentStudent.IncompleteAssignments > 0)
                {
                    LoginForm.Hide();
                    LoginForm.Close();
                    Assignment assign = CurrentStudent.Assignments.Where(w => !w.IsCompleted).First();
                    assignmentSession  = new AssignmentSession(this, ref assign);
                    StudentWelcomeForm = new Forms.frmStudentWelcome(this);
                    StudentWelcomeForm.ShowDialog();
                }
                else
                {
                    MessageBox.Show(currentUser.ScreenName + " currently has no assignments. Please go see your teacher.", "Go See Teacher", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    currentUser.Logout(this);
                }
            }
            else if (currentUser.UserType == UserType.Administrator)
            {
                LoginForm.Hide();
                LoginForm.Close();

                ProblemSetList = FileHandler.GetAllProblemSets();

                AdminForm = new frmAdminControl(this);
                AdminForm.ShowDialog();
            }
        }
Esempio n. 2
0
        //#region EventHandlers for frmDrillSettings

        //#endregion
        //#region DrillSettings Logic Methods
        //#endregion


        //// Simple form ==> Logic is contained in here
        //#region EventHandlers for frmAbout

        ///// </summary>
        ///// 
        ///// </summary>
        ///// <author> Jeff Bunce </author>
        //internal void CloseAboutForm()
        //{
        //}
        //#endregion



        #region Constructors

        /// <summary> 
        /// Construct this object by instantiating all sub-forms
        /// </summary>
        /// <author>
        /// 26 April 2014
        /// Jeff Bunce
        /// </author>
        /// <changelog>
        /// Created
        /// </changelog>
        internal CtrlAdmin(Ctrl control)
        {
            init();
            LoadNumberOfAttempts();
            adminControlForm = new frmAdminControl(this);
            // parentReportForm = new frmParentReport();
            studentReportForm = new frmStudentReport(this);
            assignStudenstForm = new frmAssignStudents(this);
            addUserForm = new frmAddUser(this);
            modifyUserForm = new frmModifyUser(this);
            removeUsersForm = new frmRemoveUsers(this);
            addProblemSetForm = new frmAddProblemSet(this);
            removeProblemSetForm = new frmRemoveProblemSet(this);
            problemSetDefaultsForm = new frmProblemSetDefaults(this);
            drillScreenSettingsForm = new frmDrillScreenSettings(this);
            aboutForm = new frmAbout();
            studentDetailForm = new frmStudentDetail ( this );
            summaryReportForm = new frmSummary(this);

        }
Esempio n. 3
0
        ///// <summary>
        ///// 1 April 2014
        ///// Jonathan Sanborn
        ///// 
        ///// Gets the assignements and assignments of the passed in student.
        ///// </summary>
        ///// <param name="student">The Student to load with the assignment</param>
        //public void GetStudentAssignments(ref Student student)
        //{
        //    student.Assignments.Clear();
        //    student.AssignmentAttempts.Clear();

        //    student.Assignments.AddRange(FileHandler.GetAssignmentsByUser(student));

        //    foreach (Assignment assign in student.Assignments)
        //    {
        //        student.AssignmentAttempts.AddRange(FileHandler.GetAssignmentAttemptsByAssignmentID(assign.ID));
        //    }

        //}

        /// <summary>
        /// 22 March 2014
        /// Jonathan Sanborn & Harvey Mercado
        /// Called to login the user currently set
        /// 
        /// 21 April 2014
        /// Jeff Bunce
        /// Refactored
        /// 
        /// </summary>
        internal void UserLogin()
        {
            if (currentUser == null) 
            {
                MessageBox.Show("Please Select a user.", "Select User", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;  // must select a user
            }


            TextBox txtPassword = LoginForm.Controls.Find("txtPassword", true)[0] as TextBox;
            if (AuthenticateUser(CurrentUser, txtPassword.Text)) 
            {
                txtPassword.Text = string.Empty;
                currentUser.Login();
            }
            else
            {                
                MessageBox.Show("Wrong Password", "Wrong Password", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtPassword.Text = String.Empty;
                return;  // selected user must authenticate
            }


            if (currentUser.UserType == UserType.Student)
            {
                    currentStudent = StudentList.Where(w => currentUser.ID == w.ID).First();

                    ProblemSetList.Clear();

                    if (currentStudent.IncompleteAssignments > 0)
                    {
                        LoginForm.Hide();
                        LoginForm.Close();
                        Assignment assign = CurrentStudent.Assignments.Where(w => !w.IsCompleted).First();
                        assignmentSession = new AssignmentSession(this, ref assign);
                        StudentWelcomeForm = new Forms.frmStudentWelcome(this);
                        StudentWelcomeForm.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(currentUser.ScreenName + " currently has no assignments. Please go see your teacher.", "Go See Teacher", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        currentUser.Logout(this);
                    }
            }
            else if (currentUser.UserType == UserType.Administrator)
            {
                    LoginForm.Hide();
                    LoginForm.Close();

                    ProblemSetList = FileHandler.GetAllProblemSets();

                    AdminForm = new frmAdminControl(this);
                    AdminForm.ShowDialog();
            }
        }