Example #1
0
        private void Login(object sender, EventArgs e)
        {
            string password = Extentions.getHashCode(this.txt_password.Text);
            string email    = this.txt_email.Text;

            this.admin   = db.Admins.FirstOrDefault(a => a.email == email && a.password == password);
            this.student = db.Students.FirstOrDefault(s => s.student_email == email && s.student_password == password);
            this.mentor  = db.Mentors.FirstOrDefault(m => m.mentor_email == email && m.mentor_password == password);
            this.teacher = db.Teachers.FirstOrDefault(t => t.teacher_email == email && t.teacher_password == password);


            if (admin != null)
            {
                AdminPanelForm form = new AdminPanelForm();
                form.ShowDialog();
            }
            else if (student != null)
            {
                new StudentProfilForm(student).ShowDialog();
            }
            else if (mentor != null)
            {
                new ProfileForm(mentor).ShowDialog();
            }
            else if (teacher != null)
            {
                new ProfileForm(teacher).ShowDialog();
            }
            else
            {
                this.lblError.Text = "Email or Password incorrect";
            }
        }
Example #2
0
        private void Login(object sender, EventArgs e)
        {
            string  password = this.txt_password.Text;
            string  email    = this.txt_email.Text;
            Admin   admin    = db.Admins.FirstOrDefault(t => t.email == email && t.password == password);
            Student student  = db.Students.FirstOrDefault(s => s.student_email == email && s.student_password == password);
            Mentor  mentor   = db.Mentors.FirstOrDefault(m => m.mentor_email == email && m.mentor_password == password);
            Teacher teacher  = db.Teachers.FirstOrDefault(t => t.teacher_email == email && t.teacher_password == password);

            if (admin != null)
            {
                AdminPanelForm form1 = new AdminPanelForm();
                form1.ShowDialog();
            }
            else if (student != null)
            {
                MessageBox.Show("Strudent");
            }
            else if (mentor != null)
            {
                MentorProfileForm form1 = new MentorProfileForm();
                form1.ShowDialog();
            }
            else if (teacher != null)
            {
                MessageBox.Show("Teacher");
            }
            else
            {
                this.lblError.Text = "Email or Password incorrect";
            }
        }