Files
C.TRACK/C-TRACK/WebUserControls/mod_opr2post.ascx.cs
T
Samuele E. Locatelli 4e3901b9e1 FIX POST MULTI!!!
2019-09-27 11:00:46 +02:00

115 lines
2.5 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 : System.Web.UI.UserControl
{
/// <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
dataLayer.man.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;
dataLayer.man.taO2P.InsertQuery(codPost, codOper, DateTime.Now);
reportUpdate();
}
doUpdate();
}
}
}