예제 #1
0
        public ActionResult Index()
        {
            if (_selfAuthUserAppService.AuthUser().Codperfil == "CTJE.Anotador" || _selfAuthUserAppService.AuthUser().Codperfil == "CTJE.Observador")
            {
                return(RedirectToAction("Index", "Annotation"));
            }

            var observationViewModel = Mapper.Map <IEnumerable <Observation>, IEnumerable <ObservationViewModel> >(_observationApp.GetAll(_selfAuthUserAppService.AuthUser(), _selfAuthUserAppService.AuthUser().ContextoAno));

            if (!observationViewModel.Any())
            {
                return(View("../Pages/Display404NotFoundPage"));
            }

            return(View(observationViewModel));
        }
        public IEnumerable <SelfEvaluation> GetAllByObserver(int contextoAno)
        {
            var user     = _authUserAppService.AuthUser();
            var observer = _observerService.GetByChapa(user.Chapa);

            return(_selfEvaluationService.GetAllByObserver(observer, contextoAno));
        }
예제 #3
0
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError(string.Empty, "The user name or password provided is incorrect.");
                return(View(model));
            }

            // TODO: Descomentar o código abaixo quando levar para produção.
            if (/*Membership.ValidateUser(model.UserName, model.Password) &&*/
                _selfAuthUserAppService.LoginIsValidWithTotvsAuth(model.UserName))
            {
                _selfAuthUserAppService.InitSession(model.UserName, Session);

                FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);

                switch (_selfAuthUserAppService.AuthUser().Codperfil)
                {
                case "CTJE.Teacher":
                    return(RedirectToAction("Index", "Home"));

                case "CTJE.Observador":
                    return(RedirectToAction("Index", "Observation"));

                case "CTJE.Anotador":
                    return(RedirectToAction("Index", "Annotation"));
                }

                if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                    !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                {
                    return(Redirect(returnUrl));
                }

                return(RedirectToAction("Index", "Home"));
            }

            ModelState.AddModelError(string.Empty, "The user name or password provided is incorrect.");

            return(View(model));
        }
예제 #4
0
        public ActionResult Index()
        {
            var teste = _observationApp.GetObservationDashboard(_selfAuthUserAppService.AuthUser(), _selfAuthUserAppService.AuthUser().ContextoAno);

            var observationViewModel = Mapper.Map <ObservationDashboard, ObservationDashboardViewModel>(teste);

            if (!observationViewModel.observations.Any())
            {
                return(View("../Pages/Display404NotFoundPage"));
            }

            return(View(observationViewModel));
        }
예제 #5
0
        public JsonResult GeyEmployeesByName(string search)
        {
            IEnumerable <Employee> employees = _evaluationNotesAppService.GetByName(search, _authUserAppService.AuthUser());

            return(Json(employees));
        }
예제 #6
0
        public ActionResult Index()
        {
            if (_selfAuthUserAppService.AuthUser().Codperfil == "CTJE.Anotador" || _selfAuthUserAppService.AuthUser().Codperfil == "CTJE.Observador")
            {
                return(RedirectToAction("Index", "Annotation"));
            }

            // TODO: Fazer os ajustes nnecessários.
            var selfEvaluationViewModel = Mapper.Map <SelfEvaluation, SelfEvaluationViewModel>(_selfEvaluationApp.Get(_selfAuthUserAppService.AuthUser().Chapa, _selfAuthUserAppService.AuthUser().ContextoAno));

            if (selfEvaluationViewModel == null)
            {
                return(View("../Pages/Display404NotFoundPageSelfEvaluation"));
            }

            return(View(selfEvaluationViewModel));
        }