Ancora conf dichiarazioni
This commit is contained in:
@@ -4,213 +4,213 @@ using System;
|
||||
|
||||
namespace MoonProTablet.WebUserControls
|
||||
{
|
||||
public partial class mod_insComm : System.Web.UI.UserControl
|
||||
public partial class mod_insComm : System.Web.UI.UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// registrato nuovo valore
|
||||
/// </summary>
|
||||
public event EventHandler eh_inserting;
|
||||
/// <summary>
|
||||
/// registrato nuovo valore
|
||||
/// </summary>
|
||||
public event EventHandler eh_newVal;
|
||||
/// <summary>
|
||||
/// registrato nuovo valore
|
||||
/// </summary>
|
||||
public event EventHandler eh_reset;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
/// <summary>
|
||||
/// registrato nuovo valore
|
||||
/// </summary>
|
||||
public event EventHandler eh_inserting;
|
||||
/// <summary>
|
||||
/// registrato nuovo valore
|
||||
/// </summary>
|
||||
public event EventHandler eh_newVal;
|
||||
/// <summary>
|
||||
/// registrato nuovo valore
|
||||
/// </summary>
|
||||
public event EventHandler eh_reset;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void btnAddCommento_Click(object sender, EventArgs e)
|
||||
{
|
||||
dataOraEv = DateTime.Now;
|
||||
showInsert();
|
||||
}
|
||||
|
||||
protected void showInsert()
|
||||
{
|
||||
fixPanels(false, true, false);
|
||||
// imposto valori
|
||||
txtDate.Text = dataOraEv.ToString("yyyy-MM-dd");
|
||||
txtTime.Text = dataOraEv.ToString("HH:mm");
|
||||
txtCommento.Text = "";
|
||||
// sollevo evento!
|
||||
if (eh_inserting != null)
|
||||
{
|
||||
eh_inserting(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
private void fixPanels(bool showBtn, bool showComm, bool showEventi)
|
||||
{
|
||||
// mostro dati da compilare e nascondo button...
|
||||
pnlButtons.Visible = showBtn;
|
||||
pnlDate.Visible = !showBtn;
|
||||
}
|
||||
|
||||
protected void btnAnnulla_Click(object sender, EventArgs e)
|
||||
{
|
||||
// tolgo da sessione dataOra corrente...
|
||||
memLayer.ML.emptySessionVal("dataOraEv");
|
||||
fixPanels(true, false, false);
|
||||
// sollevo evento!
|
||||
if (eh_reset != null)
|
||||
{
|
||||
eh_reset(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnSalva_Click(object sender, EventArgs e)
|
||||
{
|
||||
salvaCommento();
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua salvataggio del commento indicato (data/ora e testo)
|
||||
/// </summary>
|
||||
public void salvaCommento()
|
||||
{
|
||||
// salvo!
|
||||
string idxMacchina = memLayer.ML.StringSessionObj("idxMacchina");
|
||||
int idxTipo = memLayer.ML.confReadInt("idxTipoCommento");
|
||||
string CodArticolo = "ND";
|
||||
try
|
||||
{
|
||||
// cerco di recuperare CodArticolo da evento
|
||||
CodArticolo = DataLayer.obj.taODL.getByMacchinaPeriodo(idxMacchina, dataOraEv, dataOraEv)[0].CodArticolo;
|
||||
}
|
||||
catch
|
||||
{
|
||||
CodArticolo = "ND";
|
||||
}
|
||||
string commento = txtCommento.Text.Trim();
|
||||
// elimino eventuale record precedente
|
||||
try
|
||||
{
|
||||
DataLayer.obj.taEventi.DeleteQuery(idxMacchina, dataOraEv);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// inserisco nuovo record
|
||||
DataLayer.obj.taEventi.Insert(idxMacchina, dataOraEv, idxTipo, CodArticolo, commento, DataLayer.MatrOpr, "-");
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
private void doUpdate()
|
||||
{
|
||||
// aggiorno vista...
|
||||
fixPanels(true, false, false);
|
||||
if (eh_newVal != null)
|
||||
{
|
||||
eh_newVal(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
protected void txtDate_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
salvaDataOra();
|
||||
}
|
||||
|
||||
private void salvaDataOra()
|
||||
{
|
||||
DateTime inizioStato = DateTime.Now;
|
||||
try
|
||||
{
|
||||
DateTime ora = Convert.ToDateTime(txtTime.Text);
|
||||
inizioStato = Convert.ToDateTime(txtDate.Text).AddHours(ora.Hour).AddMinutes(ora.Minute);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
dataOraEv = inizioStato;
|
||||
}
|
||||
|
||||
protected void txtTime_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
salvaDataOra();
|
||||
}
|
||||
|
||||
public void caricaCommento()
|
||||
{
|
||||
string idxMacchina = memLayer.ML.StringSessionObj("idxMacchina");
|
||||
DS_applicazione.EventListRow riga = null;
|
||||
DateTime inizioStato = DateTime.Now;
|
||||
try
|
||||
{
|
||||
inizioStato = Convert.ToDateTime(memLayer.ML.objSessionObj("inizioStato"));
|
||||
riga = DataLayer.obj.taEventi.GetByMacchinaPeriodo(idxMacchina, inizioStato, inizioStato)[0];
|
||||
txtDate.Text = riga.InizioStato.ToString("yyyy-MM-dd");
|
||||
txtTime.Text = riga.InizioStato.ToString("HH:mm");
|
||||
txtCommento.Text = riga.Value;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
fixPanels(false, true, false);
|
||||
}
|
||||
/// <summary>
|
||||
/// determian se mostrare pulsante salva (non serve x dichiarazioni fermata)
|
||||
/// </summary>
|
||||
public bool showSalva
|
||||
{
|
||||
set
|
||||
{
|
||||
btnSalva.Visible = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta la label x inserimento commento singolo / con dichiarazione fermata
|
||||
/// </summary>
|
||||
public string labelAddCommento
|
||||
{
|
||||
set
|
||||
{
|
||||
btnAddCom.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta data/ora del commento
|
||||
/// </summary>
|
||||
public DateTime dataEv
|
||||
{
|
||||
set
|
||||
{
|
||||
// salvo in sessione dataOra corrente...
|
||||
dataOraEv = value;
|
||||
// mostro insert!
|
||||
showInsert();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// commento inserito
|
||||
/// </summary>
|
||||
public string commento
|
||||
{
|
||||
get
|
||||
{
|
||||
return txtCommento.Text.Trim();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// data-ora selezionata
|
||||
/// </summary>
|
||||
protected DateTime dataOraEv
|
||||
{
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("dataOraEv", value);
|
||||
}
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Now;
|
||||
try
|
||||
{
|
||||
answ = Convert.ToDateTime(memLayer.ML.objSessionObj("dataOraEv"));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void lbtAddCommento_Click(object sender, EventArgs e)
|
||||
{
|
||||
dataOraEv = DateTime.Now;
|
||||
showInsert();
|
||||
}
|
||||
|
||||
protected void showInsert()
|
||||
{
|
||||
fixPanels(false, true, false);
|
||||
// imposto valori
|
||||
txtDate.Text = dataOraEv.ToString("yyyy-MM-dd");
|
||||
txtTime.Text = dataOraEv.ToString("HH:mm");
|
||||
txtCommento.Text = "";
|
||||
// sollevo evento!
|
||||
if (eh_inserting != null)
|
||||
{
|
||||
eh_inserting(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
private void fixPanels(bool showBtn, bool showComm, bool showEventi)
|
||||
{
|
||||
// mostro dati da compilare e nascondo button...
|
||||
pnlButtons.Visible = showBtn;
|
||||
pnlDate.Visible = !showBtn;
|
||||
}
|
||||
|
||||
protected void lbtAnnulla_Click(object sender, EventArgs e)
|
||||
{
|
||||
// tolgo da sessione dataOra corrente...
|
||||
memLayer.ML.emptySessionVal("dataOraEv");
|
||||
fixPanels(true, false, false);
|
||||
// sollevo evento!
|
||||
if (eh_reset != null)
|
||||
{
|
||||
eh_reset(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
protected void lbtSalva_Click(object sender, EventArgs e)
|
||||
{
|
||||
salvaCommento();
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua salvataggio del commento indicato (data/ora e testo)
|
||||
/// </summary>
|
||||
public void salvaCommento()
|
||||
{
|
||||
// salvo!
|
||||
string idxMacchina = memLayer.ML.StringSessionObj("idxMacchina");
|
||||
int idxTipo = memLayer.ML.confReadInt("idxTipoCommento");
|
||||
string CodArticolo = "ND";
|
||||
try
|
||||
{
|
||||
// cerco di recuperare CodArticolo da evento
|
||||
CodArticolo = DataLayer.obj.taODL.getByMacchinaPeriodo(idxMacchina, dataOraEv, dataOraEv)[0].CodArticolo;
|
||||
}
|
||||
catch
|
||||
{
|
||||
CodArticolo = "ND";
|
||||
}
|
||||
string commento = txtCommento.Text.Trim();
|
||||
// elimino eventuale record precedente
|
||||
try
|
||||
{
|
||||
DataLayer.obj.taEventi.DeleteQuery(idxMacchina, dataOraEv);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// inserisco nuovo record
|
||||
DataLayer.obj.taEventi.Insert(idxMacchina, dataOraEv, idxTipo, CodArticolo, commento, DataLayer.MatrOpr, "-");
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
private void doUpdate()
|
||||
{
|
||||
// aggiorno vista...
|
||||
fixPanels(true, false, false);
|
||||
if (eh_newVal != null)
|
||||
{
|
||||
eh_newVal(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
protected void txtDate_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
salvaDataOra();
|
||||
}
|
||||
|
||||
private void salvaDataOra()
|
||||
{
|
||||
DateTime inizioStato = DateTime.Now;
|
||||
try
|
||||
{
|
||||
DateTime ora = Convert.ToDateTime(txtTime.Text);
|
||||
inizioStato = Convert.ToDateTime(txtDate.Text).AddHours(ora.Hour).AddMinutes(ora.Minute);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
dataOraEv = inizioStato;
|
||||
}
|
||||
|
||||
protected void txtTime_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
salvaDataOra();
|
||||
}
|
||||
|
||||
public void caricaCommento()
|
||||
{
|
||||
string idxMacchina = memLayer.ML.StringSessionObj("idxMacchina");
|
||||
DS_applicazione.EventListRow riga = null;
|
||||
DateTime inizioStato = DateTime.Now;
|
||||
try
|
||||
{
|
||||
inizioStato = Convert.ToDateTime(memLayer.ML.objSessionObj("inizioStato"));
|
||||
riga = DataLayer.obj.taEventi.GetByMacchinaPeriodo(idxMacchina, inizioStato, inizioStato)[0];
|
||||
txtDate.Text = riga.InizioStato.ToString("yyyy-MM-dd");
|
||||
txtTime.Text = riga.InizioStato.ToString("HH:mm");
|
||||
txtCommento.Text = riga.Value;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
fixPanels(false, true, false);
|
||||
}
|
||||
/// <summary>
|
||||
/// determian se mostrare pulsante salva (non serve x dichiarazioni fermata)
|
||||
/// </summary>
|
||||
public bool showSalva
|
||||
{
|
||||
set
|
||||
{
|
||||
lbtSalva.Visible = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta la label x inserimento commento singolo / con dichiarazione fermata
|
||||
/// </summary>
|
||||
public string labelAddCommento
|
||||
{
|
||||
set
|
||||
{
|
||||
lblAddComm.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta data/ora del commento
|
||||
/// </summary>
|
||||
public DateTime dataEv
|
||||
{
|
||||
set
|
||||
{
|
||||
// salvo in sessione dataOra corrente...
|
||||
dataOraEv = value;
|
||||
// mostro insert!
|
||||
showInsert();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// commento inserito
|
||||
/// </summary>
|
||||
public string commento
|
||||
{
|
||||
get
|
||||
{
|
||||
return txtCommento.Text.Trim();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// data-ora selezionata
|
||||
/// </summary>
|
||||
protected DateTime dataOraEv
|
||||
{
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("dataOraEv", value);
|
||||
}
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Now;
|
||||
try
|
||||
{
|
||||
answ = Convert.ToDateTime(memLayer.ML.objSessionObj("dataOraEv"));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user