84 lines
1.9 KiB
C#
84 lines
1.9 KiB
C#
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace C_TRACK.WebUserControls
|
|
{
|
|
public partial class mod_numKeyb : System.Web.UI.UserControl
|
|
{
|
|
/// <summary>
|
|
/// evento comando registrato
|
|
/// </summary>
|
|
public event EventHandler eh_comandoRegistrato;
|
|
/// <summary>
|
|
/// evento comando registrato
|
|
/// </summary>
|
|
public event EventHandler eh_reset;
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
lblNumber.Text = "";
|
|
}
|
|
}
|
|
|
|
protected void lbt_Click(object sender, EventArgs e)
|
|
{
|
|
// recupero chiamata e aggiorno testo...
|
|
LinkButton lbt = (LinkButton)sender;
|
|
string cmd = lbt.CommandArgument;
|
|
switch (cmd)
|
|
{
|
|
case "OK":
|
|
// controllo QTA... se diversa da NULL...
|
|
if (lblNumber.Text != "")
|
|
{
|
|
// solleva evento
|
|
if (eh_comandoRegistrato != null)
|
|
{
|
|
eh_comandoRegistrato(this, new EventArgs());
|
|
}
|
|
}
|
|
//altrimenti chiudo
|
|
else
|
|
{
|
|
// solleva evento
|
|
if (eh_reset != null)
|
|
{
|
|
eh_reset(this, new EventArgs());
|
|
}
|
|
}
|
|
// reset!
|
|
lblNumber.Text = "";
|
|
break;
|
|
case "CLR":
|
|
if (lblNumber.Text == "")
|
|
{
|
|
// solleva evento
|
|
if (eh_reset != null)
|
|
{
|
|
eh_reset(this, new EventArgs());
|
|
}
|
|
}
|
|
lblNumber.Text = "";
|
|
break;
|
|
default:
|
|
lblNumber.Text += cmd;
|
|
break;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Numero selezionato col controllo...
|
|
/// </summary>
|
|
public int numSelected
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(lblNumber.Text, out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
}
|
|
} |