public void Login(Form _form)
        {
            loginProxy = new LoginProxy();
            var user = loginProxy.Login(UserName, Password);

            if (user != null)
            {
                if (user.AccountLevel == "admin")
                {
                    _form.Hide();
                    Form admin = new AdminDashboard();
                    admin.Show();
                }
                else if (user.AccountLevel == "student")
                {
                    _form.Hide();
                    Form student = new StudentDashboard(user.RegistrationID.ToString());
                    student.Show();
                }
                else if (user.AccountLevel == "teacher")
                {
                    _form.Hide();
                    Form teacher = new TeacherDashboard(user.RegistrationID.ToString());
                    teacher.Show();
                }
            }
            else
            {
                MessageBox.Show("Incorrect Username or Password!");
            }
        }
예제 #2
0
        private void Login()
        {
            if (string.IsNullOrWhiteSpace(txtUserName.Text))
            {
                MessageBox.Show("Username is required");
                return;
            }
            if (string.IsNullOrWhiteSpace(txtPassword.Text))
            {
                MessageBox.Show("password is required");
                return;
            }

            var loginrequest = new LoginRequestViewModel()
            {
                UserName = txtUserName.Text,
                Password = txtPassword.Text
            };
            var result = Services.UserService.Login(loginrequest);

            if (result.Status)
            {
                switch (result.Type)
                {
                case Common.UserType.Student:
                    StudentDashboard student = new StudentDashboard(result);
                    student.Show();
                    break;

                case Common.UserType.Teacher:
                    TeacherDashboard teacher = new TeacherDashboard(result);
                    teacher.Show();
                    break;

                case Common.UserType.Parent:
                    break;

                case Common.UserType.Admin:

                    AdminDashboard admin = new AdminDashboard(result);
                    admin.Show();
                    break;

                default:
                    break;
                }
                this.Hide();
            }
            else
            {
                MessageBox.Show(result.Message);
            }
        }
예제 #3
0
        public IActionResult Index(int id = 0)
        {
            TeacherDashboard model = new TeacherDashboard();

            model.Schedules.Add(new ScheduleItem()
            {
                Title     = "Englisch\n6a",
                DayOfWeek = DayOfWeek.Monday,
                TimeSlot  = 1,
                CssTag    = "Aqua",
            });

            model.Schedules.Add(new ScheduleItem()
            {
                Title     = "Englisch\n8a",
                DayOfWeek = DayOfWeek.Monday,
                TimeSlot  = 2,
                CssTag    = "Aqua",
            });

            model.Schedules.Add(new ScheduleItem()
            {
                Title     = "Biologie\n6a",
                DayOfWeek = DayOfWeek.Monday,
                TimeSlot  = 3,
                CssTag    = "Lime",
            });

            model.Schedules.Add(new ScheduleItem()
            {
                Title     = "Englisch\n5b",
                DayOfWeek = DayOfWeek.Monday,
                TimeSlot  = 6,
                CssTag    = "Aqua",
            });

            return(View(model));
        }