using SteamWare;
using System;
using System.Web.UI;
namespace MoonPro.WebUserControls
{
public partial class mod_AnPro_Totali : SteamWare.UserControl
{
public event EventHandler eh_selVal;
public event EventHandler eh_reset;
///
/// innalzo evento in base al tipo richiesto
///
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;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
mod_righePag.numRowPag = memLayer.ML.CRI("_righeDataGridMed");
grView.PageSize = mod_righePag.numRowPag;
}
mod_righePag.eh_newNum += Mod_righePag_eh_newNum;
}
///
/// aggiorno numero righe da mostrare
///
///
///
private void Mod_righePag_eh_newNum(object sender, EventArgs e)
{
grView.PageSize = mod_righePag.numRowPag;
}
///
/// aggiorna visualizzazione
///
/// Idx Macchine
/// Si/No ODL già conclusi
/// Si/No ODL in corso
/// Si/No ODL da attrezzare
///
/// aggiorna visualizzazione
///
public void doUpdate(string idxMulti, bool OdlChiusi, bool OdlAperti, bool OdlNew)
{
hfIdxMulti.Value = idxMulti;
hfClosed.Value = OdlChiusi.ToString();
hfOpen.Value = OdlAperti.ToString();
hfNew.Value = OdlNew.ToString();
grView.DataBind();
}
///
/// comando selezione
///
///
///
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
raiseEvent(tipoEvento.selection);
}
///
/// comando reset
///
///
///
protected void lbtReset_Click(object sender, EventArgs e)
{
grView.SelectedIndex = -1;
grView.DataBind();
raiseEvent(tipoEvento.reset);
}
///
/// IdxMacchina selezionata
///
public string IdxMacchina
{
get
{
string answ = "";
try
{
answ = grView.SelectedDataKey["IdxMacchina"].ToString();
}
catch
{ }
return answ;
}
}
///
/// Cod articolo selezionato
///
public string CodArticolo
{
get
{
string answ = "";
try
{
answ = grView.SelectedDataKey["CodArticolo"].ToString();
}
catch
{ }
return answ;
}
}
///
/// formato grafico post verifica qta > 0
///
///
///
public string cssFromQty(object qty)
{
string answ = "";
if (Convert.ToInt32(qty) >= 0)
{
answ = "valOk";
}
else
{
answ = "valKo";
}
return answ;
}
protected void grView_Sorted(object sender, EventArgs e)
{
grView.SelectedIndex = -1;
grView.DataBind();
raiseEvent(tipoEvento.reset);
}
protected void grView_PageIndexChanged(object sender, EventArgs e)
{
grView.SelectedIndex = -1;
grView.DataBind();
raiseEvent(tipoEvento.reset);
}
public string cssByStato(object stato)
{
return string.Format("css_{0}", stato); ;
}
}
}