Exemple #1
0
        /// <summary>
        /// Справка за адрес
        /// </summary>
        /// <param name="addressTypeId"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult PersonAddress(int addressTypeId, int?id)
        {
            SetViewBagPersonAddress(addressTypeId);
            RegixPersonAddressVM model = null;

            if ((id ?? 0) > 0)
            {
                model = service.GetPersonAddressById(id ?? 0);
            }
            else
            {
                model = new RegixPersonAddressVM();
                SetRegixReportMainData(model.Report);
                model.AddressTypeId = addressTypeId;
            }
            if (addressTypeId == NomenclatureConstants.RegixType.PersonPermanentAddress)
            {
                SetHelpFile(HelpFileValues.Inquiry2);
            }
            else if (addressTypeId == NomenclatureConstants.RegixType.PersonCurrentAddress)
            {
                SetHelpFile(HelpFileValues.Inquiry3);
            }

            return(View(model));
        }
Exemple #2
0
        /// <summary>
        /// Справка за адрес
        /// </summary>
        /// <param name="addressTypeId"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult PersonAddress(int addressTypeId, int?id)
        {
            SetViewBagPersonAddress(addressTypeId);
            RegixPersonAddressVM model = null;

            if ((id ?? 0) > 0)
            {
                model = service.GetPersonAddressById(id ?? 0);
            }
            else
            {
                model = new RegixPersonAddressVM();
                model.Report.CourtId = userContext.CourtId;
                model.AddressTypeId  = addressTypeId;
            }
            return(View(model));
        }
Exemple #3
0
        public async Task <IActionResult> PersonAddress(RegixPersonAddressVM model)
        {
            SetViewBagPersonAddress(model.AddressTypeId);
            ValidateReason(model.Report);
            if (!ModelState.IsValid)
            {
                return(View(nameof(PersonAddress), model));
            }
            var currentId = model.Report.Id;

            if (service.PersonAddress_SaveData(model))
            {
                await RegixReportSaveFile(model.AddressTypeId, model.Report.Id);

                this.SaveLogOperation(currentId == 0, model.Report.Id);
                SetSuccessMessage("Четенето премина успешно");
                return(RedirectToAction(nameof(PersonAddress), new { addressTypeId = model.AddressTypeId, id = model.Report.Id }));
            }
            else
            {
                SetErrorMessage("Проблем при четене на данните");
            }
            return(View(nameof(PersonAddress), model));
        }
Exemple #4
0
        private async Task <byte[]> RegixReportSaveFile(int regixTypeId, int id)
        {
            string html = "";

            switch (regixTypeId)
            {
            case NomenclatureConstants.RegixType.PersonData:
                RegixPersonDataVM modelPerson = service.GetPersonalDataById(id);
                html = await this.RenderPartialViewAsync("~/Views/RegixReport/", "_PersonDataResponse.cshtml", modelPerson, true);

                break;

            case NomenclatureConstants.RegixType.PersonPermanentAddress:
            case NomenclatureConstants.RegixType.PersonCurrentAddress:
                RegixPersonAddressVM modelAddress = service.GetPersonAddressById(id);
                html = await this.RenderPartialViewAsync("~/Views/RegixReport/", "_PersonAddressResponse.cshtml", modelAddress, true);

                break;

            case NomenclatureConstants.RegixType.EmploymentContracts:
                RegixEmploymentContractsVM modelEmployment = service.GetEmploymentContractsById(id);
                html = await this.RenderPartialViewAsync("~/Views/RegixReport/", "_EmploymentContractsResponse.cshtml", modelEmployment, true);

                break;

            case NomenclatureConstants.RegixType.DisabilityCompensationByPaymentPeriod:
            case NomenclatureConstants.RegixType.UnemploymentCompensationByPaymentPeriod:
                RegixCompensationByPaymentPeriodVM modelCompensation = service.GetCompensationByPaymentPeriodById(id);
                html = await this.RenderPartialViewAsync("~/Views/RegixReport/", "_CompensationByPaymentPeriodResponse.cshtml", modelCompensation, true);

                break;

            case NomenclatureConstants.RegixType.PensionIncomeAmount:
                RegixPensionIncomeAmountVM modelPension = service.GetPensionIncomeAmountReportById(id);
                html = await this.RenderPartialViewAsync("~/Views/RegixReport/", "_PensionIncomeAmountReportResponse.cshtml", modelPension, true);

                break;

            case NomenclatureConstants.RegixType.PersonalIdentityV2:
                RegixPersonalIdentityV2VM modelIdentityV2 = service.GetPersonalIdentityV2ById(id);
                html = await this.RenderPartialViewAsync("~/Views/RegixReport/", "_PersonalIdentityV2Response.cshtml", modelIdentityV2, true);

                break;

            case NomenclatureConstants.RegixType.ActualStateV3:
                (bool result, string errorMessage, RegixActualStateV3VM modelActualStateV3) = service.GetActualStateV3ById(id);
                html = await this.RenderPartialViewAsync("~/Views/RegixReport/", "_ActualStateV3Response.cshtml", modelActualStateV3, true);

                break;

            case NomenclatureConstants.RegixType.StateOfPlay:
                RegixStateOfPlayVM modelState = service.GetStateOfPlayById(id);
                html = await this.RenderPartialViewAsync("~/Views/RegixReport/", "_StateOfPlayResponse.cshtml", modelState, true);

                break;

            case NomenclatureConstants.RegixType.PersonDataAddress:
                RegixPersonDataAddressVM modelPersonDataAddress = service.GetPersonDataAddressById(id);
                html = await this.RenderPartialViewAsync("~/Views/RegixReport/", "_PersonDataAddressResponse.cshtml", modelPersonDataAddress, true);

                break;

            default:
                break;
            }

            var pdfBytes = await new ViewAsPdfByteWriter("CreatePdf", new BlankEditVM()
            {
                HtmlContent = html
            }).GetByte(this.ControllerContext);

            var pdfRequest = new CdnUploadRequest()
            {
                SourceType        = SourceTypeSelectVM.RegixReport,
                SourceId          = id.ToString(),
                FileName          = "regixreport.pdf",
                ContentType       = "application/pdf",
                Title             = "Справка",
                FileContentBase64 = Convert.ToBase64String(pdfBytes)
            };
            await cdnService.MongoCdn_AppendUpdate(pdfRequest);

            return(pdfBytes);
        }