示例#1
0
        private void btnLogIn_Click(object sender, RoutedEventArgs e)
        {
            context = new DatabaseContext();
            User u = new User();

            var prof = context.Users.Where(q => q.IsAdmin == true && q.EMail == txtEmail.Text && q.Password == pswBox.Password);
            var std  = context.Users.Where(q => q.IsAdmin == false && q.EMail == txtEmail.Text && q.Password == pswBox.Password);


            if (prof.Count() != 0)
            {
                Professor P = new Windows.Professor();
                P.Owner = this;
                this.Hide();
                P.ShowDialog();
                // this.Close();
            }
            else if (std.Count() != 0)
            {
                Student S = new Student();

                S.ShowDialog();
                S.Owner = this;
            }
            else
            {
                MessageBox.Show("Invalid username and/or password");
            }
        }
示例#2
0
        private void btProfessor_Click(object sender, RoutedEventArgs e)
        {
            Professor P = new Windows.Professor();

            P.Owner = this;
            this.Hide();
            P.ShowDialog();
            this.Close();
        }