Beispiel #1
0
        private void LogIn()
        {
            LoginForm lf = new LoginForm();
            if (lf.ShowDialog() == DialogResult.OK)
            {

                Student student = StudentValidation.IsThereStudent(lf.user);
                if (lf.user.Role==3)
                {

                    ShowStudentInfo(student);
                    EnableControls();
                    userStatus = UserStatus.ADMIN;
                    MessageBox.Show("welcome admin!");

                    registracionToolStripMenuItem.Visible = true;
                    infoGroupToolStripMenuItem.Visible = true;

                    btnAddStudent.Visible = true;

                    miLoginOut.Text = "LogOut";
                }
                if (lf.user.Role == 1)
                {
                    ShowStudentInfo(student);
                    EnableControls();
                    userStatus = UserStatus.STUDENT;
                    miLoginOut.Text = "LogOut";
                }
            }
        }
        void LogIn()
        {
            LoginForm login = new LoginForm();
            DialogResult res = login.ShowDialog();
            if (res == DialogResult.OK)
            {
                EnableAllControls();
                //takes the data for the student
                Data.Student student = StudentValidation.IsThereStudent(login.user);
                showStudentInfo(student);
                miLogIn.Text = "Logout";
                userStatus = UserStatus.STUDENT;

                if (login.user.Role == 3)
                {
                    userStatus = UserStatus.ADMIN;
                    btnAddStudent.Visible = true;
                    bntAddUser.Visible = true;
                }
                else
                {
                    userStatus = UserStatus.STUDENT;
                }
            }
        }
Beispiel #3
0
        private void Login()
        {
            LoginForm form = new LoginForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                EnableAllControls();

                if (UserData.HasAdminRights(form.user.Username))
                {
                    status = UserStatus.ADMIN;
                    addStudentBtn.Visible = true;
                    return;
                }

                Student result = UserData.GetStudentDataByUser(form.user.FacNumber);

                if (result != null)
                {
                    ShowStudentInfo(result);
                    status = UserStatus.STUDENT;
                }
            }
        }