214 lines
5.3 KiB
C#
214 lines
5.3 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_task2post : System.Web.UI.UserControl
|
|
{
|
|
/// <summary>
|
|
/// evento aggiunta record
|
|
/// </summary>
|
|
public event EventHandler eh_reqUpdate;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
checkValori();
|
|
}
|
|
private void checkValori()
|
|
{
|
|
#if false
|
|
// verifica quali valori siano disponibili e di conseguenza visualizza COLORE...
|
|
divArticolo.Attributes.Remove("class");
|
|
divCommessa.Attributes.Remove("class");
|
|
divQta.Attributes.Remove("class");
|
|
divArticolo.Attributes.Add("class", CodArticolo != "" ? "col-3 text-center table-success text-success" : "col-3 text-center text-secondary");
|
|
divCommessa.Attributes.Add("class", NumTask != "" ? "col-3 text-center table-success text-success" : "col-3 text-center text-secondary");
|
|
divQta.Attributes.Add("class", Quantita > 0 ? "col-3 text-center table-success text-success" : "col-3 text-center text-secondary");
|
|
#endif
|
|
//lblOut.Text = codOper != "" ? codOper : "";
|
|
}
|
|
public void doUpdate()
|
|
{
|
|
grView.DataBind();
|
|
}
|
|
/// <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!
|
|
dataLayer.man.taTL2Post.ToggleActive(codPost, numTask);
|
|
// invoco update...
|
|
if (eh_reqUpdate != null)
|
|
{
|
|
eh_reqUpdate(this, new EventArgs());
|
|
}
|
|
}
|
|
|
|
protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e)
|
|
{
|
|
// 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;
|
|
}
|
|
|
|
#if false
|
|
if (testReset.Success)
|
|
{
|
|
CodArticolo = "";
|
|
NumTask = "";
|
|
Quantita = 0;
|
|
}
|
|
else if (testDelete.Success)
|
|
{
|
|
// creo...
|
|
dataLayer.man.taTL.deleteQuery(NumTask);
|
|
// resetto!
|
|
CodArticolo = "";
|
|
NumTask = "";
|
|
Quantita = 0;
|
|
// invoco update...
|
|
if (eh_created != null)
|
|
{
|
|
eh_created(this, new EventArgs());
|
|
}
|
|
}
|
|
else if (testAddNew.Success)
|
|
{
|
|
// se qta > 0 ed ho articolo e commessa...
|
|
if (Quantita > 0 && CodArticolo != "" && NumTask != "")
|
|
{
|
|
// creo...
|
|
dataLayer.man.taTL.insertQuery(NumTask, CodArticolo, Quantita);
|
|
// resetto!
|
|
CodArticolo = "";
|
|
NumTask = "";
|
|
Quantita = 0;
|
|
// invoco update...
|
|
if (eh_created != null)
|
|
{
|
|
eh_created(this, new EventArgs());
|
|
}
|
|
}
|
|
}
|
|
else if (testCodArt.Success)
|
|
{
|
|
CodArticolo = value;
|
|
}
|
|
else if (testNumTask.Success)
|
|
{
|
|
NumTask = value;
|
|
}
|
|
else if (testQta.Success)
|
|
{
|
|
int qta = 0;
|
|
int.TryParse(value, out qta);
|
|
Quantita = qta;
|
|
}
|
|
|
|
// non match con RegExp --> ricerca ESPLICITA, se abilitato ricerca estesa
|
|
if (memLayer.ML.CRB("OptEnableMapoIn") && !(testCodArt.Success || testNumTask.Success))
|
|
{
|
|
var tabArt = dataLayer.man.taAnArt.getByKey(value);
|
|
if (tabArt.Rows.Count > 0)
|
|
{
|
|
CodArticolo = value;
|
|
}
|
|
else
|
|
{
|
|
var tabTask = dataLayer.man.taTL.getByKey(value);
|
|
if (tabTask.Rows.Count > 0)
|
|
{
|
|
NumTask = value;
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
checkValori();
|
|
}
|
|
}
|
|
} |