public IActionResult Get_Destiny(Guid id) { var result = _service.Get_DestiniesProcedure(id); if (!result.IsSuccess) { return(BadRequest(result)); } return(Ok(result.Response)); }
public ServiceResult <byte[]> ReportPrintAsync(Guid solicitationId) { var newDirectory = Path.Combine(StaticFilesDirectory, "Reports", "VR_REPORT.rdl"); var files = new FileInfo(newDirectory); var notif = new ServiceResult <byte[]>(); if (!files.Exists) { notif.AddError("Error", "El Reporte no fue encontrado."); return(notif); } var rv = new reportingNameSpace.LocalReport(newDirectory); var solic = _solicitationSubsidyService.GetByIdSubsidy(solicitationId).Response; if (solic == null) { notif.AddError("Error", "La solicitud no existe"); return(notif); } var destiny = _destinyService.Get_DestiniesProcedure(solicitationId).Response; var images = _solicitationSubsidyService.SolicitationApprovedBySupervisorId(solicitationId, solic.UserId).Response; var totalLetter = _context.GetLetterNumberTotalSolicitationAsync(destiny.Sum(x => x.Amount).ToString("F").Replace(",", "."), "."); rv.AddDataSource("SolicitationDTODataSet", new List <FindByIdSolicitationSubsidyDto>() { solic }); rv.AddDataSource("UserDataSet", new List <UserDto>() { solic.User }); rv.AddDataSource("Destination", destiny); rv.AddDataSource("SignSupervisorImage", new List <UrlSignHolograph>() { images }); rv.AddDataSource("DestinationDataSet", solic.Destinies); rv.AddDataSource("ExpenditureDataSet", solic.Expenditures); rv.AddDataSource("Common", new List <ReportDto>() { new ReportDto() { TodayDate = DateTime.Today.ToString("d"), TotalLetter = totalLetter.FirstOrDefault() == null ? "" : totalLetter.FirstOrDefault().LetterNumber } }); System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); var result = rv.Execute(reportingNameSpace.RenderType.Pdf); return(new ServiceResult <byte[]>(result.MainStream)); }