Files

115 lines
2.9 KiB
C#

using AppData;
using SteamWare;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace C_TRACK.WebUserControls
{
public partial class mod_opr2post : BaseUserControl
{
/// <summary>
/// evento aggiunta record
/// </summary>
public event EventHandler eh_reqUpdate;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (mUtils.postIsMulti)
{
lbtClosePeriod.DataBind();
doUpdate();
}
}
}
public void doUpdate()
{
grView.DataBind();
}
/// <summary>
/// CodPost selezionato in sessione
/// </summary>
protected string codPost
{
get
{
return memLayer.ML.StringSessionObj("CodPost");
}
}
protected void lbtClosePeriod_Click(object sender, EventArgs e)
{
// chiude il turno andando a ripartire tutte le ore operatore sulle commesse attive e senza riportare attivi gli operatori
DLMan.taTR.checkAlloc(codPost, false);
grView.DataBind();
reportUpdate();
}
protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
reportUpdate();
}
private void reportUpdate()
{
// invoco update...
if (eh_reqUpdate != null)
{
eh_reqUpdate(this, new EventArgs());
}
}
/// <summary>
/// Input da processare (tipo codOperatore...)...
/// </summary>
public string newInput
{
set
{
processInput(value);
}
}
/// <summary>
/// Cod OPERATORE corrente
/// </summary>
public string codOper
{
get
{
return memLayer.ML.StringSessionObj("currCodOperMulti");
}
set
{
memLayer.ML.setSessionVal("currCodOperMulti", value);
}
}
/// <summary>
/// Effettua riconoscimento input e determina valori commessa / articolo / qta
/// </summary>
/// <param name="value"></param>
private void processInput(string value)
{
// verifico se sia un operatore...
Match testOper = Regex.Match(value, mUtils.reCodOper);
if (testOper.Success)
{
// salvo nuovo operatore SE non ci fosse...
codOper = value;
DLMan.taO2P.InsertQuery(codPost, codOper, DateTime.Now);
reportUpdate();
}
doUpdate();
}
}
}