Ejemplo n.º 1
0
 //Professor Classes
 private void buttonSearch_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(textBoxSearch.Text))
     {
         if (StudentMapper.Get(textBoxSearch.Text) != null) //If the student exists
         {
             //Display student's grades on the NumericUpDowns
             searchUser = StudentMapper.Get(textBoxSearch.Text);
             for (int i = 0; i < 10; i++)
             {
                 gradesList[i].Visible = true;
                 gradesList[i].Value   = searchUser.StudentProgress.PropaideiaProgress[i];
             }
             gradesList[10].Visible = true;
             gradesList[10].Value   = searchUser.StudentProgress.FinalExam;
         }
         else
         {
             MessageBox.Show("Δεν βρέθηκε ο μαθητής!", "Δεν βρέθηκε", MessageBoxButtons.OK);
         }
     }
     else
     {
         MessageBox.Show("Παρακαλούμε πληκτρολογήστε το όνομα χρήστη του μαθητή πρώτα!", "Ειδοποίηση", MessageBoxButtons.OK);
     }
 }
Ejemplo n.º 2
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            MainScreen mainForm = new MainScreen();

            if (!String.IsNullOrEmpty(textBoxUsername.Text) && !String.IsNullOrEmpty(textBoxPassword.Text))
            {
                userType = Database.Login(textBoxUsername.Text, textBoxPassword.Text); //Try to login, if it successed the user's type is returned
                if (userType == UserTypes.STUDENT)
                {
                    activeUser = StudentMapper.Get(textBoxUsername.Text).Username;
                    this.Hide();
                    mainForm.Show();
                }
                else if (userType == UserTypes.PROFESSOR)
                {
                    activeUser = ProfessorMapper.Get(textBoxUsername.Text).Username;
                    this.Hide();
                    mainForm.Show();
                }
                else
                {
                    MessageBox.Show("Δεν βρέθηκε ο χρήστης! Για να δημιουργήσετε ένα λογαριασμό παρακαλούμε πατήστε το κουμπί Εγγραφή!", "Ειδοποίηση", MessageBoxButtons.OK);
                }
            }
            else
            {
                MessageBox.Show("Παρακαλούμε εισάγετε ένα όνομα χρήστη!", "Ειδοποίηση", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 3
0
 private void buttonRegister_Click(object sender, EventArgs e)
 {
     if (!labelRegisterName.Visible) //First button click shows the rest of the fields that need to be filled in
     {
         labelRegisterName.Visible      = true;
         labelRegisterSurname.Visible   = true;
         textBoxRegisterName.Visible    = true;
         textBoxRegisterSurname.Visible = true;
     }
     else //After the rest of the fields are visible, the register button tries to register the user in the DB
     {
         if (!String.IsNullOrEmpty(textBoxUsername.Text) && !String.IsNullOrEmpty(textBoxPassword.Text) && !String.IsNullOrEmpty(textBoxRegisterName.Text) && !String.IsNullOrEmpty(textBoxRegisterSurname.Text))
         {
             Student newStudent = new Student(textBoxUsername.Text, textBoxRegisterName.Text, textBoxRegisterSurname.Text);
             if (StudentMapper.Get(newStudent.Username) == null) //If the student doesn't already exist
             {
                 if (StudentMapper.Insert(newStudent, textBoxPassword.Text))
                 {
                     if (MessageBox.Show("Ο χρήστης εγγράφηκε επιτυχώς!", "Επιτυχής Εγγραφή!", MessageBoxButtons.OK) == DialogResult.OK)
                     {
                         //auto login after register
                         buttonLogin.PerformClick();
                     }
                 }
                 else
                 {
                     MessageBox.Show("Υπήρξε ένα σφάλμα κατά την δημιουργία του χρήστη!", "Σφάλμα", MessageBoxButtons.OK);
                 }
             }
             else
             {
                 MessageBox.Show("Υπάρχει ήδη ένας χρήστης με αυτό το όνομα χρήστη!", "Σφάλμα", MessageBoxButtons.OK);
             }
         }
         else
         {
             MessageBox.Show("Παρακαλούμε συμπληρώστε όλα τα παραπάνω πεδιά πριν συνεχίσετε!", "Σφάλμα", MessageBoxButtons.OK);
         }
     }
 }
Ejemplo n.º 4
0
        private void MainScreen_Load(object sender, EventArgs e)
        {
            panelBlank.Visible = false;
            panelMult.Visible  = false;
            panelTF.Visible    = false;
            buttonList.Add(button1);
            buttonList.Add(button2);
            buttonList.Add(button3);
            buttonList.Add(button4);
            buttonList.Add(button5);
            buttonList.Add(button6);
            buttonList.Add(button7);
            buttonList.Add(button8);
            buttonList.Add(button9);
            buttonList.Add(button10);
            buttonList.Add(buttonFinalExam);
            questionPanelList.Add(panelBlank);
            questionPanelList.Add(panelMult);
            questionPanelList.Add(panelTF);

            if (LoginScreen.userType == "student") //User is a Student
            {
                activeStudent = StudentMapper.Get(LoginScreen.activeUser);
                if (activeStudent.Level < 12) //Update buttons based on quiz completion (Level)
                {
                    for (int i = 0; i < activeStudent.Level; i++)
                    {
                        buttonList[i].Enabled = true;
                        buttonList[i].Image   = Resources.tick;
                        toolTipMain.SetToolTip(buttonList[i], "Έχει ολοκληρωθεί η προπαίδεια του " + (i + 1).ToString());
                    }
                    buttonList[activeStudent.Level - 1].Image = Resources.unlock;
                    toolTipMain.SetToolTip(buttonList[activeStudent.Level - 1], "Διαβάστε την προπαίδεια και όταν είστε έτοιμοι δοκιμάστε το τεστ!");
                    buttonList[activeStudent.Level - 1].PerformClick();
                }
                else //Update all buttons as complete
                {
                    for (int i = 0; i <= 10; i++)
                    {
                        buttonList[i].Enabled = true;
                        buttonList[i].Image   = Resources.tick;
                        toolTipMain.SetToolTip(buttonList[i], "Έχει ολοκληρωθεί η προπαίδεια του " + (i + 1).ToString());
                    }
                    buttonList[10].PerformClick();
                }

                pictureBoxGrades.Visible = true;

                studentGrades.Add(labelGradeShow1);
                studentGrades.Add(labelGradeShow2);
                studentGrades.Add(labelGradeShow3);
                studentGrades.Add(labelGradeShow4);
                studentGrades.Add(labelGradeShow5);
                studentGrades.Add(labelGradeShow6);
                studentGrades.Add(labelGradeShow7);
                studentGrades.Add(labelGradeShow8);
                studentGrades.Add(labelGradeShow9);
                studentGrades.Add(labelGradeShow10);
                studentGrades.Add(labelGradeShowFinal);
            }
            else //User is a professor
            {
                activeProfessor = ProfessorMapper.Get(LoginScreen.activeUser);
                for (int i = 0; i < 11; i++)
                {
                    buttonList[i].Visible = false;
                }
                buttonSave.Visible         = true;
                panelProf.Visible          = true;
                buttonTakeQuiz.Visible     = false;
                pictureBoxSettings.Enabled = false;
                labelTitle.Text            = "Διαχείριση Μαθητών";
                labelTitleNumber.Visible   = false;

                gradesList.Add(numericUpDown1);
                gradesList.Add(numericUpDown2);
                gradesList.Add(numericUpDown3);
                gradesList.Add(numericUpDown4);
                gradesList.Add(numericUpDown5);
                gradesList.Add(numericUpDown6);
                gradesList.Add(numericUpDown7);
                gradesList.Add(numericUpDown8);
                gradesList.Add(numericUpDown9);
                gradesList.Add(numericUpDown10);
                gradesList.Add(numericUpDownFinal);
            }
        }