Exemplo n.º 1
0
        /// <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(object sender, EventArgs e)
        {
            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("Sorry that is not the right password", "Incorrect Password", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtPassword.Text = String.Empty;
                return;  // selected user must authenticate
            }


            loginForm.Hide();
            loginForm.Close();


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

                problemSetList.Clear();

                if (currentStudent.IncompleteAssignments > 0)
                {
                    ctrlStudent = new CtrlStudent(this);
                    ctrlStudent.TakeControl(this);
                    UpdateLocalLists();
                }
                else
                {
                    MessageBox.Show(currentUser.ScreenName + " currently has no assignments. Please go see your teacher.", "Go See Teacher", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    keepAlive = true;
                    currentUser.Logout(this);
                }
            }
            else if (currentUser.UserType == UserType.Administrator)
            {
                ctrlAdmin = new CtrlAdmin(this);
                ctrlAdmin.TakeControl(this);
                UpdateLocalLists();
            }

        }
Exemplo n.º 2
0
        /// <summary>
        /// 9 April 2014
        /// Jonathan Sanborn
        /// 
        /// Constructor for an Assignment Session
        /// </summary>
        /// <param name="mmControl">The Control Object</param>
        /// <param name="assign">The Assignment for this session</param>
        internal CtrlMathDrill(CtrlStudent mmControl, Student currentStudent)
        {
            init();
            parentControl = mmControl;
            //loggedInStudent = new Student();
            loggedInStudent = currentStudent;
            assignmentAttempt = new AssignmentAttempt();
            studentDrillForm = new frmStudentDrill(this);
            studentResultForm = new frmDrillResult(this);
            

        }