Esempio n. 1
0
 private void buttonLogin_Click(object sender, EventArgs e)
 {
     Program.currentUser = Convert.ToInt32(listOfUsers.SelectedIndex);
     textBox1.AppendText("Hello " + Program.currentUser + "\r\n");
     if (Program.users[Program.currentUser].isAdmin)
     {
         AdminForm mainForm = new AdminForm();
         mainForm.Tag = this;
         mainForm.Show(this);
         Hide();
     }
     else
     {
         StudentForm mainForm = new StudentForm();
         mainForm.Tag = this;
         mainForm.Show(this);
         Hide();
     }
 }
Esempio n. 2
0
 //Aurelio Arango 4-1-14
 //This funtion creates a new form for the student to take the test
 private void buildStudentForm()
 {
     
     bool foundForm = false; 
     foreach (Form f in Application.OpenForms)
     {
         if (f.GetType() == typeof(StudentForm))
         {
             f.Show();
             foundForm = true;
             this.Hide();
         }
     }
     if (!foundForm)
     { 
         StudentForm loginForm = new StudentForm();
         loginForm.Tag = this;
         loginForm.Show(this);
         this.Hide(); 
     }
 }
Esempio n. 3
0
        /*Aurelio Arango 3-25-14
        //This funtion creates a new Form in which the selected student needs to authenticate itself
        private void buildStudentLoginForm()
        {
            
            bool foundForm = false; 
            foreach (Form f in Application.OpenForms)
            {
                if (f.GetType() == typeof(StudentLoginForm))
                {
                    f.Show();
                    foundForm = true;
                    this.Hide();
                }
            }
            if (!foundForm)
            { 
                StudentLoginForm loginForm = new StudentLoginForm();
                loginForm.Tag = this;
                loginForm.Show(this);
                this.Hide();
                
            }
        }*/

        /*4-25-14
         * Jorge Torres and Aurelio Arango
         *Loading appropriate form based on student password enabled or disabled
         */
        private void buildStudentLoginForm(Boolean passWordEnabled)
        {

            bool foundForm = false;
            foreach (Form f in Application.OpenForms)
            {
                if (f.GetType() == typeof(StudentLoginForm) && passWordEnabled == true)
                {
                    f.Show();
                    foundForm = true;
                    this.Hide();
                }
                else if (f.GetType() == typeof(StudentForm) && passWordEnabled == false)
                {
                    f.Show();
                    foundForm = true;
                    this.Hide();
                }
            }

            if (!foundForm)
            {
                if (passWordEnabled)
                {
                    StudentLoginForm loginForm = new StudentLoginForm();
                    loginForm.Tag = this;
                    loginForm.Show(this);
                    this.Hide();
                }
                else
                {
                    StudentForm loginform = new StudentForm();
                    loginform.Tag = this;
                    loginform.Show(this);
                    this.Hide();
                }
            }
        }