7d289a3b64
pulizia codice...
277 lines
8.4 KiB
C#
277 lines
8.4 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
public partial class mod_reportInterventi : System.Web.UI.UserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
// traduzioni
|
|
traduciObj();
|
|
// popolo valori default
|
|
setDefaultValues();
|
|
// fixed visibilità modulo export excel
|
|
divExcelExp.Visible = memLayer.ML.confReadBool("showExcelExpRep");
|
|
}
|
|
}
|
|
|
|
protected override void OnInit(EventArgs e)
|
|
{
|
|
base.OnInit(e);
|
|
mod_periodoAnalisi1.eh_doUpdate += new EventHandler(mod_periodoAnalisi1_eh_doUpdate);
|
|
}
|
|
|
|
void mod_periodoAnalisi1_eh_doUpdate(object sender, EventArgs e)
|
|
{
|
|
setDefaultValues();
|
|
}
|
|
/// <summary>
|
|
/// wrapper traduzione
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(object lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma.ToString());
|
|
}
|
|
private void traduciObj()
|
|
{
|
|
lblMostraStati.Text = traduci("lblMostraStati");
|
|
lblImpiantiInteressati.Text = traduci("lblImpiantiSel");
|
|
lblMacchineInteressate.Text = traduci("lblMacchineSel");
|
|
lnkGuidaPerReport.Text = traduci("lnkGuidaPerReport");
|
|
lnkGuidaPerReport.NavigateUrl = string.Format("~/help/{0}/index.html", user_std.UtSn.lingua);
|
|
lblReportInterventi.Text = traduci("lblReportInterventi");
|
|
lblReportMTBFMTTR.Text = traduci("lblReportMTBFMTTR");
|
|
lblExcelExportAllData.Text = traduci("lblExcelExportAllData");
|
|
lblExcelPowerPivot.Text = traduci("lblExcelPowerPivot");
|
|
lblExcelInstruction.Text = traduci("lblExcelInstruction");
|
|
hlExcelExportIntExt.Text = traduci("lblExcelExportIntExt");
|
|
chkShowOnlyMacchFerma.Text = traduci("chkShowOnlyMacchFerma");
|
|
chkShowMtzPrev.Text = traduci("chkShowMtzPrev");
|
|
hlElencoInterventi_Pdf.ToolTip = traduci("hlElencoInterventi_Pdf");
|
|
hlMTBF_MTTR_Pdf.ToolTip = traduci("hlMTBF_MTTR_Pdf");
|
|
hlExcelExportAllData.ToolTip = traduci("hlExcelExportAllData");
|
|
hlExcelPowerPivot.ToolTip = traduci("hlExcelPowerPivot");
|
|
hlExcelExportIntExt.ToolTip = traduci("hlExcelExportIntExt");
|
|
}
|
|
private void setDefaultValues()
|
|
{
|
|
// valori degli hyperlink
|
|
hlElencoInterventi_Pdf.NavigateUrl = formattaUrl(reportRichiesto.ElencoInterventi, mod_periodoAnalisi1.intervalloAnalisi);
|
|
hlMTBF_MTTR_Pdf.NavigateUrl = formattaUrl(reportRichiesto.MTBF_MTTR, mod_periodoAnalisi1.intervalloAnalisi);
|
|
}
|
|
/// <summary>
|
|
/// costruisce un URL valido e formattato a partire da quanto filtrato...
|
|
/// </summary>
|
|
/// <param name="tipo"></param>
|
|
/// <param name="periodo"></param>
|
|
/// <returns></returns>
|
|
private string formattaUrl(reportRichiesto tipo, intervalloDate periodo)
|
|
{
|
|
string answ = String.Format(memLayer.ML.confReadString("exportFormat3"), Convert.ToInt32(tipo), periodo.inizio, periodo.fine, user_std.UtSn.userNameAD);
|
|
// effettuo controlli valori checkBox
|
|
if (chkShowMtzPrev.Checked)
|
|
{
|
|
answ += "&mtzPrev=true";
|
|
}
|
|
else
|
|
{
|
|
answ += "&mtzPrev=false";
|
|
}
|
|
if (chkShowOnlyMacchFerma.Checked)
|
|
{
|
|
answ += "&onlyMacchFerm=true";
|
|
}
|
|
else
|
|
{
|
|
answ += "&onlyMacchFerm=false";
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
#region gestione selettori valori multipli
|
|
|
|
#region stati
|
|
|
|
/// <summary>
|
|
/// valorizzazione iniziale filtro stati
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void listaStati_DataBound(object sender, EventArgs e)
|
|
{
|
|
foreach (ListItem item in ((ListBox)sender).Items)
|
|
{
|
|
// solo gli item che NON sono "annullato"...
|
|
if (item.Value != "4")
|
|
{
|
|
item.Selected = true;
|
|
}
|
|
}
|
|
generaFiltroStati();
|
|
}
|
|
/// <summary>
|
|
/// salva elenco stati selected
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void listaStati_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
generaFiltroStati();
|
|
}
|
|
|
|
private void generaFiltroStati()
|
|
{
|
|
// svuoto elenco utente delle macchine selezionate
|
|
TA_app.obj.taFiltSta.EmptyUserData(user_std.UtSn.userNameAD);
|
|
// spazzo TUTTE le righe del controllo...
|
|
foreach (ListItem riga in listaStati.Items)
|
|
{
|
|
// se è selezionata creo riga anche x lei...
|
|
if (riga.Selected)
|
|
{
|
|
TA_app.obj.taFiltSta.Insert(user_std.UtSn.userNameAD, Convert.ToInt32(riga.Value));
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region impianti
|
|
|
|
/// <summary>
|
|
/// valorizzazione iniziale filtro impianti
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void listImpianti_DataBound(object sender, EventArgs e)
|
|
{
|
|
foreach (ListItem item in ((ListBox)sender).Items)
|
|
{
|
|
item.Selected = true;
|
|
}
|
|
generaFiltroImpianti();
|
|
}
|
|
/// <summary>
|
|
/// salvo elenco impianti selected
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void listImpianti_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
generaFiltroImpianti();
|
|
}
|
|
|
|
private void generaFiltroImpianti()
|
|
{
|
|
// svuoto elenco utente delle macchine selezionate
|
|
TA_app.obj.taFiltImp.EmptyUserData(user_std.UtSn.userNameAD);
|
|
// spazzo TUTTE le righe del controllo...
|
|
foreach (ListItem riga in listImpianti.Items)
|
|
{
|
|
// se è selezionata creo riga anche x lei...
|
|
if (riga.Selected)
|
|
{
|
|
TA_app.obj.taFiltImp.Insert(user_std.UtSn.userNameAD, Convert.ToInt32(riga.Value));
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region macchine
|
|
|
|
/// <summary>
|
|
/// valorizzazione iniziale filtro macchine
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void listMacchine_DataBound(object sender, EventArgs e)
|
|
{
|
|
foreach (ListItem item in ((ListBox)sender).Items)
|
|
{
|
|
item.Selected = true;
|
|
}
|
|
generaFiltroMacchine();
|
|
}
|
|
/// <summary>
|
|
/// salvo elenco macchine selected
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void listMacchine_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
generaFiltroMacchine();
|
|
}
|
|
|
|
private void generaFiltroMacchine()
|
|
{
|
|
// svuoto elenco utente delle macchine selezionate
|
|
TA_app.obj.taFiltMac.EmptyUserData(user_std.UtSn.userNameAD);
|
|
// spazzo TUTTE le righe del controllo...
|
|
foreach (ListItem riga in listMacchine.Items)
|
|
{
|
|
// se è selezionata creo riga anche x lei...
|
|
if (riga.Selected)
|
|
{
|
|
TA_app.obj.taFiltMac.Insert(user_std.UtSn.userNameAD, Convert.ToInt32(riga.Value));
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// salva filtro impianti/macchine
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSaveFiltro_Click(object sender, EventArgs e)
|
|
{
|
|
generaFiltroImpianti();
|
|
generaFiltroMacchine();
|
|
}
|
|
|
|
#region checkbox
|
|
/// <summary>
|
|
/// evento check mtz pre
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void chkShowMtzPrev_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
setDefaultValues();
|
|
}
|
|
/// <summary>
|
|
/// evento check su macchian ferma
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void chkShowOnlyMacchFerma_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
setDefaultValues();
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected void rblFormato_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (rblFormato.SelectedValue == "PRO")
|
|
{
|
|
hlExcelPowerPivot.NavigateUrl = "~/Reports/WebGIM_PowerPivot.xlsx";
|
|
}
|
|
else
|
|
{
|
|
hlExcelPowerPivot.NavigateUrl = "~/Reports/WebGIM_PivotExcel.xlsx";
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
}
|