148 lines
4.4 KiB
C#
148 lines
4.4 KiB
C#
using CMS_SC_Data;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web.UI;
|
|
|
|
namespace CMS_SC
|
|
{
|
|
public partial class ReportCompleto : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
ddlFase.DataBind();
|
|
ddlLingue.DataBind();
|
|
string _idxDossier = memLayer.ML.QSS("IdxDossier");
|
|
int idxReq = 0;
|
|
int.TryParse(_idxDossier, out idxReq);
|
|
idxDossier = idxReq;
|
|
// se c'è seleziono fase...
|
|
ddlFase.SelectedValue = memLayer.ML.QSS("Fase");
|
|
// fix x revisione...
|
|
ddlRev.DataBind();
|
|
// fix x button download
|
|
lbtExportWithAttach.DataBind();
|
|
//mod_reportCompleto.Fase = ddlFase.SelectedValue;
|
|
//mod_reportCompleto.Lingua = ddlLingue.SelectedValue;
|
|
fixSelReport();
|
|
fixFullReportVisibility();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Controllo visibilità button full report: SOLO SE utente ha permesso...
|
|
/// </summary>
|
|
private void fixFullReportVisibility()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Valore dossier salvato nell'hidden input
|
|
/// </summary>
|
|
protected int idxDossier
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(hfIdxDossier.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfIdxDossier.Value = value.ToString();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// wrapper traduzione
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(string lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma);
|
|
}
|
|
/// <summary>
|
|
/// cambio fase
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlFase_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// update ddl rev...
|
|
odsRev.DataBind();
|
|
ddlRev.DataBind();
|
|
// fix!
|
|
fixSelReport();
|
|
}
|
|
/// <summary>
|
|
/// cambio lingua
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlLingue_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
fixSelReport();
|
|
}
|
|
/// <summary>
|
|
/// Cambio revisione
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlRev_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
fixSelReport();
|
|
}
|
|
/// <summary>
|
|
/// Sistemazione report con parametri
|
|
/// </summary>
|
|
private void fixSelReport()
|
|
{
|
|
// recupero num revisione
|
|
int rev = 0;
|
|
int.TryParse(ddlRev.SelectedValue, out rev);
|
|
// imposto!
|
|
mod_reportCompleto.Fase = ddlFase.SelectedValue;
|
|
mod_reportCompleto.Rev = rev;
|
|
mod_reportCompleto.Lingua = ddlLingue.SelectedValue;
|
|
mod_reportCompleto.fixReport();
|
|
}
|
|
|
|
protected void lbtExportWithAttach_Click(object sender, EventArgs e)
|
|
{
|
|
// effettua merge Report Completo + allegati: registro in primis la richiesta!
|
|
var tabDoss = DtProxy.man.taED.getByDossier(idxDossier);
|
|
if (tabDoss.Count > 0)
|
|
{
|
|
var currDoss = tabDoss[0];
|
|
DtProxy.man.taFRGL.insertQuery(OpAuth.currAuth.email, idxDossier, DateTime.Now, currDoss.Matricola, currDoss.FaseAct, currDoss.RevAct);
|
|
// step 1: genera directory lavoro
|
|
string currOutPath = $"\\tmp\\{idxDossier}";
|
|
fileMover.obj.setDirectoryMapPath(currOutPath);
|
|
fileMover.obj.checkDir();
|
|
// path scehde!
|
|
string urlSchede = memLayer.ML.CRS("urlSchede");
|
|
string pdfInFullPath = "";
|
|
List<string> elencoPdf = new List<string>();
|
|
// step 2: esporta pdf collaudo in dir temporanea come PRIMO file !!!FARE!!!
|
|
|
|
// step 3: colleziona allegati schede e li copia in locale
|
|
var tabDati = DtProxy.man.taASC.getByDossier(idxDossier);
|
|
foreach (var item in tabDati)
|
|
{
|
|
pdfInFullPath = "";
|
|
if (!elencoPdf.Contains(item.Path))
|
|
{
|
|
pdfInFullPath = Server.MapPath(string.Format(urlSchede, item.Path));
|
|
elencoPdf.Add(pdfInFullPath);
|
|
}
|
|
}
|
|
// step 4: MERGE di tutti i pdf nel file di output
|
|
string outFile = $"{Server.MapPath(currOutPath)}\\ReportFull_{idxDossier}.pdf";
|
|
pdfUtils.mergePdfFiles(outFile, elencoPdf);
|
|
// step 5: rimanda a pagina x download nuovo file composto...
|
|
}
|
|
}
|
|
}
|
|
} |