Files
2021-05-04 18:15:33 +02:00

220 lines
5.9 KiB
C#

using MapoSDK;
using SteamWare;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MP_SITE.WebUserControls
{
public partial class mod_AnPro_ODL : SteamWare.UserControl
{
#region Public Events
public event EventHandler eh_reset;
public event EventHandler eh_selVal;
#endregion Public Events
#region Public Properties
/// <summary>
/// Cod articolo selezionato
/// </summary>
public string CodArticolo
{
get
{
string answ = "";
try
{
answ = grView.SelectedDataKey["CodArticolo"].ToString();
}
catch
{ }
return answ;
}
}
/// <summary>
/// IdxMacchina selezionata
/// </summary>
public string IdxMacchina
{
get
{
string answ = "";
try
{
answ = grView.SelectedDataKey["IdxMacchina"].ToString();
}
catch
{ }
return answ;
}
}
#endregion Public Properties
#region Private Methods
/// <summary>
/// aggiorno numero righe da mostrare
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Mod_righePag_eh_newNum(object sender, EventArgs e)
{
grView.PageSize = mod_righePag.numRowPag;
}
#endregion Private Methods
#region Protected Methods
protected void grView_DataBound(object sender, EventArgs e)
{
if (grView.Rows.Count > 0)
{
LinkButton lb;
// aggiorno gli headers
foreach (TableCell cella in grView.HeaderRow.Cells)
{
try
{
lb = (LinkButton)cella.Controls[0];
lb.Text = traduci(lb.Text);
}
catch
{ }
}
}
}
protected void grView_PageIndexChanged(object sender, EventArgs e)
{
grView.SelectedIndex = -1;
grView.DataBind();
raiseEvent(tipoEvento.reset);
}
/// <summary>
/// comando selezione
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
raiseEvent(tipoEvento.selection);
}
protected void grView_Sorted(object sender, EventArgs e)
{
grView.SelectedIndex = -1;
grView.DataBind();
raiseEvent(tipoEvento.reset);
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtReset_Click(object sender, EventArgs e)
{
grView.SelectedIndex = -1;
grView.DataBind();
raiseEvent(tipoEvento.reset);
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
mod_righePag.numRowPag = memLayer.ML.CRI("_righeDataGridShort");
grView.PageSize = mod_righePag.numRowPag;
}
mod_righePag.eh_newNum += Mod_righePag_eh_newNum;
}
/// <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
public string cssByStato(object stato)
{
return string.Format("css_{0}", stato); ;
}
/// <summary>
/// formato grafico post verifica qta > 0
/// </summary>
/// <param name="qty"></param>
/// <returns></returns>
public string cssFromQty(object qty)
{
string answ = "";
if (Convert.ToInt32(qty) >= 0)
{
answ = "valOk";
}
else
{
answ = "valKo";
}
return answ;
}
/// <summary>
/// aggiorna visualizzazione
/// </summary>
/// <param name="idxMulti">Idx Macchine</param>
/// <param name="OdlChiusi">Si/No ODL già conclusi</param>
/// <param name="OdlAperti">Si/No ODL in corso</param>
/// <param name="OdlNew">Si/No ODL da attrezzare</param>
/// <summary>
/// aggiorna visualizzazione
/// </summary>
public void doUpdate(string idxMulti, bool OdlChiusi, bool OdlAperti, bool OdlNew)
{
grView.SelectedIndex = -1;
hfIdxMulti.Value = idxMulti;
hfClosed.Value = OdlChiusi.ToString();
hfOpen.Value = OdlAperti.ToString();
hfNew.Value = OdlNew.ToString();
grView.DataBind();
}
#endregion Public Methods
}
}