Beispiel #1
0
        public async Task <IActionResult> Index(DuplicateRequestViewModel duplicateRequestViewModel)
        {
            var vm = await ReprintCertificate(duplicateRequestViewModel.CertificateId, duplicateRequestViewModel.SearchString,
                                              duplicateRequestViewModel.StdCode, duplicateRequestViewModel.Uln, duplicateRequestViewModel.Page);

            return(View(vm));
        }
Beispiel #2
0
        private async Task <DuplicateRequestViewModel> ReprintCertificate(Guid certificateId, string searchString, int larsCode, long uln, int page)
        {
            var username = _contextAccessor.HttpContext.User
                           .FindFirst("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn")?.Value;
            var certificate = await _apiClient.PostReprintRequest(new StaffCertificateDuplicateRequest
            {
                Id       = certificateId,
                Username = username
            });

            var certificateData = JsonConvert.DeserializeObject <CertificateData>(certificate.CertificateData);

            var nextScheduledRun = await _apiClient.GetNextScheduledRun((int)ScheduleType.PrintRun);

            var vm = new DuplicateRequestViewModel
            {
                CertificateId        = certificate.Id,
                IsConfirmed          = true,
                NextBatchDate        = nextScheduledRun?.RunTime.ToString("dd/MM/yyyy"),
                CertificateReference = certificate.CertificateReference,
                SearchString         = searchString,
                StdCode  = larsCode,
                Uln      = uln,
                Status   = certificate.Status,
                FullName = certificateData.FullName,
                Page     = page
            };

            return(vm);
        }
Beispiel #3
0
        public async Task <IActionResult> Index(
            Guid certificateId,
            int stdCode,
            long uln,
            string searchString,
            int page             = 1,
            bool?redirectToCheck = false)
        {
            var certificate = await _apiClient.GetCertificate(certificateId);

            var certificateData = JsonConvert.DeserializeObject <CertificateData>(certificate.CertificateData);

            var vm = new DuplicateRequestViewModel
            {
                CertificateId        = certificateId,
                IsConfirmed          = false,
                NextBatchDate        = "Fake Date",
                SearchString         = searchString,
                CertificateReference = certificate.CertificateReference,
                StdCode         = stdCode,
                Uln             = uln,
                FullName        = certificateData.FullName,
                Status          = certificate.Status,
                BackToCheckPage = redirectToCheck.Value,
                Page            = page
            };

            return(View(vm));
        }