Ejemplo n.º 1
0
        //Checks user info
        private void CheckUserInfo(object sender, EventArgs e)
        {
            if (cbxLoginUserType.Text == "Teacher")
            {
                UserType = 1;
            }
            else if (cbxLoginUserType.Text == "Student")
            {
                UserType = 2;
            }
            else if (cbxLoginUserType.Text == "Mentor")
            {
                UserType = 3;
            }

            if (db.Logins.ToList().Any(t => t.LoginEmail == tbxLoginEmail.Text && t.LoginPassword == tbxLoginPassword.Text && t.UserTypeId == UserType))
            {
                //holds user email
                UserEmail = tbxLoginEmail.Text;

                //Disables th ebutton
                btnSignIn.Enabled = false;

                if (UserType == 1)
                {
                    TeacherForm teacher = new TeacherForm();
                    teacher.Show();
                    teacher.FillTeacherInfo(tbxLoginEmail.Text);
                }
                else if (UserType == 2)
                {
                    StudentForm student = new StudentForm();
                    student.Show();
                    student.FillStudentInfo(tbxLoginEmail.Text);
                }
                else if (UserType == 3)
                {
                    MentorForm mentor = new MentorForm();
                    mentor.Show();
                    mentor.FillMentorInfo(tbxLoginEmail.Text);
                }
            }
            else
            {
                MessageBox.Show("Wrong data was provided.");
            }
        }