private DirectorOrPartnerViewModel SetupGetPart(int id)
        {
            var licenceId = Session.GetCurrentLicenceId();
            var dopId     = Session.GetCurrentDopId();

            var model = LicenceApplicationViewModelBuilder.Build <DirectorOrPartnerViewModel, DirectorOrPartner>(
                licenceId, l => l.DirectorOrPartners.SingleOrDefault(d => d.Id == dopId));

            if (model.Id.HasValue)
            {
                Session.SetCurrentDopStatus(model.Id.Value,
                                            model.IsPreviousPrincipalAuthority.IsPreviousPrincipalAuthority ?? false);
            }

            if (model.PrincipalAuthorityId.HasValue)
            {
                Session.SetCurrentPaStatus(model.PrincipalAuthorityId.Value,
                                           model.IsPreviousPrincipalAuthority.IsPreviousPrincipalAuthority ?? false);
            }

            if (ViewData["IsSubmitted"] == null)
            {
                var currentStatus = LicenceStatusViewModelBuilder.BuildLatestStatus(licenceId);
                ViewData["IsSubmitted"] = currentStatus.Id == ConstantService.ApplicationSubmittedOnlineStatusId;
            }

            Session.SetLoadedPage(id);
            return(model);
        }
Exemple #2
0
        private AlternativeBusinessRepresentativeViewModel SetupGetPart(int id)
        {
            var licenceId = Session.GetCurrentLicenceId();
            var abrId     = Session.GetCurrentAbrId();

            var model =
                LicenceApplicationViewModelBuilder
                .Build <AlternativeBusinessRepresentativeViewModel, AlternativeBusinessRepresentative>(licenceId,
                                                                                                       x => x.AlternativeBusinessRepresentatives.FirstOrDefault(a => a.Id == abrId)) ??
                new AlternativeBusinessRepresentativeViewModel();

            if (model.Id.HasValue)
            {
                Session.SetCurrentAbrId(model.Id.Value);
            }

            if (ViewData["IsSubmitted"] == null)
            {
                var currentStatus = LicenceStatusViewModelBuilder.BuildLatestStatus(licenceId);
                ViewData["IsSubmitted"] = currentStatus.Id == ConstantService.ApplicationSubmittedOnlineStatusId;
            }

            Session.SetLoadedPage(id);
            return(model);
        }
        public IActionResult Portal()
        {
            var licenceId = Session.GetCurrentLicenceId();

            var model = LicenceApplicationViewModelBuilder.Build(licenceId);

            ViewData["IsSubmitted"] = false;

            model.NewLicenceStatus = LicenceStatusViewModelBuilder.BuildLatestStatus(licenceId);

            if (model.NewLicenceStatus.Id == ConstantService.ApplicationSubmittedOnlineStatusId ||
                model.NewLicenceStatus.Id == ConstantService.ApplicationSubmittedByPhoneId)
            {
                ViewData["IsSubmitted"] = true;
            }

            return(View(nameof(Portal), model));
        }
        public async Task <IActionResult> ViewApplication()
        {
            var user = await userManager.GetUserAsync(HttpContext.User);

            var model = LicenceApplicationViewModelBuilder.BuildLicencesForUser(user.Id).FirstOrDefault();

            var licenceId = Session.GetCurrentLicenceId();

            if (model != null)
            {
                model.NewLicenceStatus = LicenceStatusViewModelBuilder.BuildLatestStatus(model.Id);

                ViewData["IsSubmitted"] = model.NewLicenceStatus.Id == ConstantService.ApplicationSubmittedOnlineStatusId;

                return(View(model));
            }
            else
            {
                return(RedirectToAction(nameof(TaskList)));
            }
        }
Exemple #5
0
        private NamedIndividualViewModel SetupGetPart(int id)
        {
            var licenceId         = Session.GetCurrentLicenceId();
            var namedIndividualId = Session.GetCurrentNamedIndividualId();

            var model = LicenceApplicationViewModelBuilder
                        .Build <NamedIndividualViewModel, NamedIndividual>(licenceId,
                                                                           x => x.NamedIndividuals.FirstOrDefault(y => y.Id == namedIndividualId));

            if (model.Id.HasValue)
            {
                Session.SetCurrentNamedIndividualId(model.Id.Value);
            }

            if (ViewData["IsSubmitted"] == null)
            {
                var currentStatus = LicenceStatusViewModelBuilder.BuildLatestStatus(licenceId);
                ViewData["IsSubmitted"] = currentStatus.Id == ConstantService.ApplicationSubmittedOnlineStatusId;
            }

            Session.SetLoadedPage(id);
            return(model);
        }