Exemplo n.º 1
0
        /// <summary>
        /// Справка трудови договори
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult EmploymentContracts(int?id)
        {
            SetViewBagEmploymentContracts();
            RegixEmploymentContractsVM model = null;

            if ((id ?? 0) > 0)
            {
                model = service.GetEmploymentContractsById(id ?? 0);
            }
            else
            {
                model = new RegixEmploymentContractsVM();
                model.Report.CourtId = userContext.CourtId;
            }
            return(View(model));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Справка трудови договори
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult EmploymentContracts(int?id)
        {
            SetViewBagEmploymentContracts();
            RegixEmploymentContractsVM model = null;

            if ((id ?? 0) > 0)
            {
                model = service.GetEmploymentContractsById(id ?? 0);
            }
            else
            {
                model = new RegixEmploymentContractsVM();
                SetRegixReportMainData(model.Report);
            }
            SetHelpFile(HelpFileValues.Inquiry5);

            return(View(model));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> EmploymentContracts(RegixEmploymentContractsVM model)
        {
            SetViewBagEmploymentContracts();
            ValidateReason(model.Report);
            if (!ModelState.IsValid)
            {
                return(View(nameof(EmploymentContracts), model));
            }
            var currentId = model.Report.Id;

            if (service.EmploymentContracts_SaveData(model))
            {
                await RegixReportSaveFile(NomenclatureConstants.RegixType.EmploymentContracts, model.Report.Id);

                this.SaveLogOperation(currentId == 0, model.Report.Id);
                SetSuccessMessage("Четенето премина успешно");
                return(RedirectToAction(nameof(EmploymentContracts), new { id = model.Report.Id }));
            }
            else
            {
                SetErrorMessage("Проблем при четене на данните");
            }
            return(View(nameof(EmploymentContracts), model));
        }
Exemplo n.º 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);
        }