Ancora conf dichiarazioni

This commit is contained in:
Samuele E. Locatelli
2018-02-28 12:38:17 +01:00
parent 26bd2b3cbc
commit 960f69d5e0
10 changed files with 392 additions and 400 deletions
+26 -23
View File
@@ -1,33 +1,36 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_insComm.ascx.cs" Inherits="MoonProTablet.WebUserControls.mod_insComm" %>
<asp:Panel runat="server" ID="pnlButtons">
<div class="ui-grid-a">
<div class="ui-block-b" data-role="content">
<asp:Button ID="btnAddCom" runat="server" data-icon="plus" Text="Commento" OnClick="btnAddCommento_Click" />
</div>
<div class="row">
<div class="col">
<asp:LinkButton ID="lbtAddCom" runat="server" OnClick="lbtAddCommento_Click" CssClass="btn btn-block btn-dark">
<i class="fa fa-star"></i>
<asp:Label runat="server" ID="lblAddComm">Commento</asp:Label>
</asp:LinkButton>
</div>
</div>
</asp:Panel>
<asp:Panel runat="server" ID="pnlDate" Visible="false">
<div class="ui-grid-a" data-role="content">
<div class="ui-block-a">
<asp:Label runat="server" ID="lblDate" AssociatedControlID="txtDate" Text="Data" />
<asp:TextBox runat="server" ID="txtDate" type="date" AutoPostBack="True" OnTextChanged="txtDate_TextChanged" />
</div>
<div class="ui-block-b">
<asp:Label runat="server" ID="lblTime" AssociatedControlID="txtTime" Text="Ora" />
<asp:TextBox runat="server" ID="txtTime" type="time" AutoPostBack="True" OnTextChanged="txtTime_TextChanged" />
</div>
<div class="row">
<div class="col-6">
<asp:Label runat="server" ID="lblDate" AssociatedControlID="txtDate" Text="Data" />
<asp:TextBox runat="server" ID="txtDate" type="date" AutoPostBack="True" OnTextChanged="txtDate_TextChanged" CssClass="form-control" />
</div>
<div class="ui-grid-solo" data-role="content">
<asp:Label runat="server" ID="lblCommento" AssociatedControlID="txtCommento" Text="Commento" />
<asp:TextBox runat="server" ID="txtCommento" TextMode="MultiLine" placeholder="Inserire commento" />
<div class="col-6">
<asp:Label runat="server" ID="lblTime" AssociatedControlID="txtTime" Text="Ora" />
<asp:TextBox runat="server" ID="txtTime" type="time" AutoPostBack="True" OnTextChanged="txtTime_TextChanged" CssClass="form-control" />
</div>
<div class="ui-grid-a" data-role="content">
<div class="ui-block-a">
<asp:Button runat="server" ID="btnSalva" Text="Salva" data-icon="plus" OnClick="btnSalva_Click" />
</div>
<div class="ui-block-b">
<asp:Button runat="server" ID="btnAnnulla" Text="Annulla" data-icon="delete" OnClick="btnAnnulla_Click" />
</div>
<div class="col-12">
<asp:Label runat="server" ID="lblCommento" AssociatedControlID="txtCommento" Text="Commento" />
<asp:TextBox runat="server" ID="txtCommento" TextMode="MultiLine" placeholder="Inserire commento" CssClass="form-control" />
</div>
<div class="col-6">
<asp:LinkButton runat="server" ID="lbtSalva" OnClick="lbtSalva_Click" CssClass="btn btn-block btn-success"><i class="fa fa-plus"></i> Salva</asp:LinkButton>
</div>
<div class="col-6">
<asp:LinkButton runat="server" ID="lbtAnnulla" OnClick="lbtAnnulla_Click" CssClass="btn btn-block btn-warning"><i class="fa fa-ban"></i> Annulla</asp:LinkButton>
</div>
</div>
</asp:Panel>
+206 -206
View File
@@ -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;
}
}
}
}
+53 -45
View File
@@ -1,115 +1,123 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace MoonProTablet.WebUserControls
{
namespace MoonProTablet.WebUserControls {
public partial class mod_insComm {
/// <summary>
/// pnlButtons control.
/// Controllo pnlButtons.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel pnlButtons;
/// <summary>
/// btnAddCom control.
/// Controllo lbtAddCom.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnAddCom;
protected global::System.Web.UI.WebControls.LinkButton lbtAddCom;
/// <summary>
/// pnlDate control.
/// Controllo lblAddComm.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblAddComm;
/// <summary>
/// Controllo pnlDate.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel pnlDate;
/// <summary>
/// lblDate control.
/// Controllo lblDate.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblDate;
/// <summary>
/// txtDate control.
/// Controllo txtDate.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtDate;
/// <summary>
/// lblTime control.
/// Controllo lblTime.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblTime;
/// <summary>
/// txtTime control.
/// Controllo txtTime.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtTime;
/// <summary>
/// lblCommento control.
/// Controllo lblCommento.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblCommento;
/// <summary>
/// txtCommento control.
/// Controllo txtCommento.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtCommento;
/// <summary>
/// btnSalva control.
/// Controllo lbtSalva.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSalva;
protected global::System.Web.UI.WebControls.LinkButton lbtSalva;
/// <summary>
/// btnAnnulla control.
/// Controllo lbtAnnulla.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnAnnulla;
protected global::System.Web.UI.WebControls.LinkButton lbtAnnulla;
}
}