Example #1
0
        private void OnLoginHit(object obj)
        {
            var x = _authorizeService.GetAuthorizedUser(_id, _pw);

            if (x == null)
            {
                return;
            }

            _loggedUserService.ActiveUser = x;

            if (x.Role.Name == AppRoles.Opiekun.ToString())
            {
                _moduleManager.LoadModule(typeof(SupervisorModule).Name);
                _regionManager.RequestNavigate(RegionNames.ContentRegion, typeof(SupervisorStudentsView).ToString());
                _regionManager.RequestNavigate(RegionNames.MenuRegion, typeof(SupervisorMenuView).ToString());
            }
            else if (x.Role.Name == AppRoles.Admin.ToString())
            {
                _moduleManager.LoadModule(typeof(AdminModule).Name);
                _regionManager.RequestNavigate(RegionNames.ContentRegion, typeof(AdminUsersView).ToString());
                _regionManager.RequestNavigate(RegionNames.MenuRegion, typeof(AdminMenuView).ToString());
            }
            else if (x.Role.Name == AppRoles.Firma.ToString())
            {
                _moduleManager.LoadModule(typeof(CompanyModule).Name);
                _regionManager.RequestNavigate(RegionNames.ContentRegion, typeof(CompanyDepartmentsView).ToString());
                _regionManager.RequestNavigate(RegionNames.MenuRegion, typeof(CompanyMenuView).ToString());
            }
            else if (x.Role.Name == AppRoles.Student.ToString())
            {
                _moduleManager.LoadModule(typeof(StudentModule).Name);
                _regionManager.RequestNavigate(RegionNames.ContentRegion, typeof(StudentCompaniesView).ToString());
                _regionManager.RequestNavigate(RegionNames.MenuRegion, typeof(StudentMenuView).ToString());
            }
            else
            {
                return;
            }


            _regionManager.RequestNavigate(RegionNames.NavRegion, typeof(AccountToolbar).ToString());

            _loggedUserService.UserIsLogged = true;

            _eventAggregator.GetEvent <LoginEvent>().Publish("");
        }