public static DocsPaVO.Procedimento.Report.ReportProcedimentoResponse GetProcedimentiReport(DocsPaVO.Procedimento.Report.ReportProcedimentoRequest request) { DocsPaVO.Procedimento.Report.ReportProcedimentoResponse response = new DocsPaVO.Procedimento.Report.ReportProcedimentoResponse(); try { DocsPaVO.documento.FileDocumento report = new DocsPaVO.documento.FileDocumento(); DocsPaDB.Query_DocsPAWS.Procedimenti proc = new DocsPaDB.Query_DocsPAWS.Procedimenti(); List <DocsPaVO.filtri.FiltroRicerca> filters = new List <DocsPaVO.filtri.FiltroRicerca>(); filters.Add(new DocsPaVO.filtri.FiltroRicerca() { argomento = "ID_TIPO_FASC", valore = request.IdProcedimento }); filters.Add(new DocsPaVO.filtri.FiltroRicerca() { argomento = "ANNO", valore = request.Anno }); List <DettaglioProcedimento> items = proc.GetProcedimentiReport(filters); if (items.Count > 0) { BusinessLogic.Modelli.AsposeModelProcessor.PdfModelProcessor processor = new Modelli.AsposeModelProcessor.PdfModelProcessor(); report = processor.CreaReportProcedimentoSingolo(request, items); response.Doc = report; } response.Success = true; } catch (Exception ex) { logger.Error("Errore in GetProcedimentiReport: ", ex); response.Doc = null; response.Success = false; } return(response); }
public DocsPaVO.documento.FileDocumento CreaReportProcedimentoSingolo(DocsPaVO.Procedimento.Report.ReportProcedimentoRequest request, List <DocsPaVO.Procedimento.DettaglioProcedimento> list) { DocsPaVO.documento.FileDocumento doc = new DocsPaVO.documento.FileDocumento(); Document pdf = new Document(); Page page = pdf.Pages.Add(); page.SetPageSize(PageSize.A4.Width, PageSize.A4.Height); page.PageInfo.Margin.Left = 10; page.PageInfo.Margin.Right = 10; page.PageInfo.Margin.Top = 90; page.PageInfo.Margin.Bottom = 10; page.PageInfo.IsLandscape = true; // estrazione parametri string nomeProcedimento = BusinessLogic.ProfilazioneDinamica.ProfilazioneFascicoli.getTemplateFascById(request.IdProcedimento).DESCRIZIONE; double durataMedia = BusinessLogic.Procedimenti.AnalisiManager.DurataMediaProcedimento(list); int procedimentiChiusi = BusinessLogic.Procedimenti.AnalisiManager.ProcedimentiChiusi(list); // Fasi Dictionary <string, double> durataFasi = BusinessLogic.Procedimenti.AnalisiManager.DurataMediaFasiProcedimento(list, request.IdProcedimento, request.IdAmm); page.Paragraphs.Add(this.AddTitolo("Dettaglio del procedimento")); page.Paragraphs.Add(this.AddSottotitolo(nomeProcedimento)); if (!string.IsNullOrEmpty(request.Anno)) { page.Paragraphs.Add(this.AddSottotitolo("Anno di riferimento: " + request.Anno)); } Table t1 = this.AddTable(); t1.Rows.Add(this.AddRow(new string[] { "Procedimenti attivati nel periodo selezionato", list.Count.ToString() })); t1.Rows.Add(this.AddRow(new string[] { "Procedimenti conclusi", procedimentiChiusi.ToString() })); Table t2 = this.AddTable(); t2.Rows.Add(this.AddRow(new string[] { "Durata media Procedimento (giorni)", durataMedia < 0 ? "non disponibile" : durataMedia.ToString() })); if (durataFasi != null) { foreach (KeyValuePair <string, double> kvp in durataFasi) { t2.Rows.Add(this.AddRow(new string[] { string.Format("Durata media {0} (giorni)", kvp.Key), kvp.Value < 0 ? "non disponibile" : kvp.Value.ToString() })); } } page.Paragraphs.Add(t1); page.Paragraphs.Add(t2); using (MemoryStream stream = new MemoryStream()) { pdf.Save(stream); if (stream != null) { doc.content = stream.ToArray(); } stream.Close(); } return(doc); }