154 lines
4.0 KiB
C#
154 lines
4.0 KiB
C#
using AppData;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Text.RegularExpressions;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace C_TRACK.WebUserControls
|
|
{
|
|
public partial class mod_task2post : 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)
|
|
{
|
|
doUpdate();
|
|
}
|
|
}
|
|
}
|
|
public void doUpdate()
|
|
{
|
|
try
|
|
{
|
|
grView.DataBind();
|
|
}
|
|
catch
|
|
{
|
|
logger.lg.scriviLog($"Eccezione in render gridView: CodPost = {memLayer.ML.StringSessionObj("CodPost")}");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Stato TASK da mostrare
|
|
/// </summary>
|
|
public bool taskIsActive
|
|
{
|
|
get
|
|
{
|
|
bool answ = false;
|
|
bool.TryParse(hfIsActive.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfIsActive.Value = value.ToString();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Verifica se lo stato sia ATTIVO
|
|
/// </summary>
|
|
/// <param name="_IsActive"></param>
|
|
/// <returns></returns>
|
|
public bool checkActive(object _IsActive)
|
|
{
|
|
bool answ = false;
|
|
bool.TryParse(_IsActive.ToString(), out answ);
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// CodPost selezionato in sessione
|
|
/// </summary>
|
|
protected string codPost
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("CodPost");
|
|
}
|
|
}
|
|
|
|
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
string numTask = grView.SelectedValue.ToString();
|
|
// chiamo toggle status, segnalo update!
|
|
DLMan.taTL2Post.ToggleActive(codPost, numTask);
|
|
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 NumTask
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("currNumTaskMulti");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("currNumTaskMulti", 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 testNumTask = Regex.Match(value, mUtils.reNumTask);
|
|
|
|
if (testNumTask.Success)
|
|
{
|
|
NumTask = value;
|
|
string codTag = mUtils.optValueBC != "" ? mUtils.optValueBC : "";
|
|
DLMan.taTL2Post.InsertQuery(codPost, NumTask, codTag);
|
|
reportUpdate();
|
|
}
|
|
doUpdate();
|
|
}
|
|
|
|
protected void grView_RowUpdated(object sender, GridViewUpdatedEventArgs e)
|
|
{
|
|
reportUpdate();
|
|
}
|
|
|
|
public bool showTag
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.CRB("OptUseSelTag");
|
|
}
|
|
}
|
|
}
|
|
} |