예제 #1
0
        private void btnOpenTeacherRoot_Click(object sender, RoutedEventArgs e)
        {
            // They want to work as a teacher, so open the teacherroot.
            TeacherRoot tRoot = new TeacherRoot(currentUser);

            tRoot.ShowDialog();
        }
예제 #2
0
        private bool attemptLogin_Staff(string username, string password)
        {
            // Check if there's any staff that meet the parameters provided
            List <Staff> login = (from staff in App.db.Staffs
                                  where staff.StaffID.ToString() == username &&
                                  staff.StaffPassword == password
                                  select staff).ToList();

            // If none, return false (cancel)
            if (login.Count() == 0)
            {
                return(false);
            }

            // If there are, grab the first (Should be the only, but just to be safe we use First)
            Staff loginStaff = login.First();

            // Now we check if they're an admin or not and open either the sysadminroot or the teacherroot depending on whether they are admin or not respectively.
            if (loginStaff.IsAdministrative.Value)
            {
                SysAdminRoot sar = new SysAdminRoot(loginStaff);
                this.Hide();
                sar.ShowDialog();
                this.Show();
            }
            else
            {
                TeacherRoot tr = new TeacherRoot(loginStaff);
                this.Hide();
                //tr.ShowDialog();
                this.Show();
            }

            // Notify that login was successful after finished
            return(true);
        }