Files
NKC/NKC_WF/WebUserControls/cmp_orderExtList.ascx.cs
T
2023-08-04 18:45:43 +02:00

108 lines
2.5 KiB
C#

using System;
using System.Web.UI;
namespace NKC_WF.WebUserControls
{
public partial class cmp_orderExtList : BaseUserControl
{
#region Public Events
/// <summary>
/// Evento di richiesta move con parametro
/// </summary>
public event EventHandler<int> eh_reqMoveToMachine;
#endregion Public Events
#region Public Properties
public int BatchId
{
get
{
int answ = 0;
int.TryParse(hfBatchId.Value, out answ);
return answ;
}
set
{
hfBatchId.Value = $"{value}";
}
}
public bool enableMove
{
get
{
bool answ = false;
bool.TryParse(hfMoveEnab.Value, out answ);
return answ;
}
set
{
if (hfMoveEnab.Value != $"{value}")
{
hfMoveEnab.Value = $"{value}";
grView.DataBind();
}
}
}
public int SelOrderId
{
get
{
int answ = 0;
int.TryParse(grView.SelectedDataKey["OrdID"].ToString(), out answ);
return answ;
}
}
#endregion Public Properties
#region Public Methods
public void doUpdate()
{
grView.DataBind();
}
#endregion Public Methods
#region Protected Properties
protected string moveCss
{
get => enableMove ? "btn btn-dark btn-sm py-0" : "btn btn-secondary disabled btn-sm py-0";
}
#endregion Protected Properties
#region Protected Methods
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
// sollevo evento selezione on il parametro indicato (NE di destinazione)
int numNE = 0;
// recupero da valore argomento il num NE
// se qualcuno ascolta sollevo evento nuovo valore...
if (eh_reqMoveToMachine != null)
{
eh_reqMoveToMachine(this, numNE);
}
//raiseEvent();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
doUpdate();
}
}
#endregion Protected Methods
}
}