Files
2021-03-17 16:56:41 +01:00

252 lines
7.0 KiB
C#

using MapoSDK;
using SteamWare;
using System;
namespace MP_ADM.WebUserControls
{
public partial class cmp_planStats : BaseUserControl
{
#region Public Events
public event EventHandler eh_reset;
public event EventHandler eh_selVal;
#endregion Public Events
#region Public Properties
/// <summary>
/// CodArticoloo selezionato in GridView
/// </summary>
public string CodArticolo
{
get
{
return cmp_planStats_Art.SelCodArt;
}
}
/// <summary>
/// CodCliente selezionato in GridView
/// </summary>
public string CodCliente
{
get
{
return cmp_planStats_Cli.SelCodCliente;
}
}
/// <summary>
/// CodFase selezionato in GridView
/// </summary>
public string CodFase
{
get
{
return cmp_planStats_Fasi.SelCodFase;
}
}
/// <summary>
/// IdxMacchina selezionato in GridView
/// </summary>
public string IdxMacchina
{
get
{
return cmp_planStats_Mac.SelIdxMacchina;
}
}
#endregion Public Properties
#region Private Methods
private void Cmp_planStats_Art_eh_resetSelezione(object sender, EventArgs e)
{
hfCodArt.Value = "*";
raiseEvent(tipoEvento.reset);
}
private void Cmp_planStats_Art_eh_selValore(object sender, EventArgs e)
{
hfCodArt.Value = cmp_planStats_Art.SelCodArt;
raiseEvent(tipoEvento.selection);
}
private void Cmp_planStats_Cli_eh_resetSelezione(object sender, EventArgs e)
{
hfCodCli.Value = "*";
raiseEvent(tipoEvento.reset);
}
private void Cmp_planStats_Cli_eh_selValore(object sender, EventArgs e)
{
hfCodCli.Value = cmp_planStats_Cli.SelCodCliente;
raiseEvent(tipoEvento.selection);
}
private void Cmp_planStats_Fasi_eh_resetSelezione(object sender, EventArgs e)
{
hfCodGrp.Value = "*";
raiseEvent(tipoEvento.reset);
}
private void Cmp_planStats_Fasi_eh_selValore(object sender, EventArgs e)
{
hfCodGrp.Value = cmp_planStats_Fasi.SelCodFase;
cmp_planStats_Mac.CodGrp = hfCodGrp.Value;
cmp_planStats_Art.CodGrp = hfCodGrp.Value;
raiseEvent(tipoEvento.selection);
}
private void Cmp_planStats_Mac_eh_resetSelezione(object sender, EventArgs e)
{
hfIdxMacc.Value = "*";
raiseEvent(tipoEvento.reset);
}
private void Cmp_planStats_Mac_eh_selValore(object sender, EventArgs e)
{
hfIdxMacc.Value = cmp_planStats_Mac.SelIdxMacchina;
raiseEvent(tipoEvento.selection);
}
private void doResetArt()
{
cmp_planStats_Art.doReset();
raiseEvent(tipoEvento.reset);
}
private void doResetCli()
{
cmp_planStats_Cli.doReset();
raiseEvent(tipoEvento.reset);
}
private void doResetGrp()
{
cmp_planStats_Fasi.doReset();
raiseEvent(tipoEvento.reset);
}
private void doResetMac()
{
cmp_planStats_Mac.doReset();
raiseEvent(tipoEvento.reset);
}
#endregion Private Methods
#region Protected Methods
protected void ddlTipoStat_SelectedIndexChanged(object sender, EventArgs e)
{
frmView.DataBind();
}
protected void gvParetoArt_SelectedIndexChanged(object sender, EventArgs e)
{
raiseEvent(tipoEvento.selection);
}
protected void lbtForceReload_Click(object sender, EventArgs e)
{
// chiamo stored x importazione...
DataLayerObj.taArcaGiac.stp_IMP_All_Import_Process(null, null, null, null);
DataLayerObj.taArcaGiac.stp_IMP_All_Ordini_Process(null, null, null, null, null);
}
protected void lbtToggle_Click(object sender, EventArgs e)
{
divDetail.Visible = !divDetail.Visible;
tgIcon.Attributes["class"] = divDetail.Visible ? "fa fa-chevron-up" : "fa fa-chevron-down";
}
protected void Page_Load(object sender, EventArgs e)
{
cmp_planStats_Fasi.eh_resetSelezione += Cmp_planStats_Fasi_eh_resetSelezione;
cmp_planStats_Fasi.eh_selValore += Cmp_planStats_Fasi_eh_selValore;
cmp_planStats_Mac.eh_resetSelezione += Cmp_planStats_Mac_eh_resetSelezione;
cmp_planStats_Mac.eh_selValore += Cmp_planStats_Mac_eh_selValore;
cmp_planStats_Cli.eh_resetSelezione += Cmp_planStats_Cli_eh_resetSelezione;
cmp_planStats_Cli.eh_selValore += Cmp_planStats_Cli_eh_selValore;
cmp_planStats_Art.eh_resetSelezione += Cmp_planStats_Art_eh_resetSelezione;
cmp_planStats_Art.eh_selValore += Cmp_planStats_Art_eh_selValore;
}
/// <summary>
/// innalzo evento in base al tipo richiesto
/// </summary>
protected void raiseEvent(tipoEvento evReq)
{
switch (evReq)
{
case tipoEvento.reset:
// raise dell'evento
if (eh_reset != null)
{
eh_reset(this, new EventArgs());
}
break;
case tipoEvento.selection:
// raise dell'evento
if (eh_selVal != null)
{
eh_selVal(this, new EventArgs());
}
break;
case tipoEvento.edit:
case tipoEvento.delete:
default:
break;
}
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// Reset controllo
/// </summary>
public void doReset()
{
hfCodArt.Value = "*";
hfCodCli.Value = "*";
hfCodGrp.Value = "*";
hfIdxMacc.Value = "*";
doResetGrp();
doResetMac();
doResetCli();
doResetArt();
frmView.DataBind();
}
public void doUpdate()
{
frmView.DataBind();
cmp_planStats_Mac.doUpdate();
}
public string showData(object valOre, object valNum)
{
string answ = "";
if (ddlTipoStat.SelectedValue == "0")
{
answ = $"{valNum}";
}
else
{
answ = $"{valOre:N2}";
}
return answ;
}
#endregion Public Methods
}
}