Impostato sel comandi da postazione...

This commit is contained in:
Samuele E. Locatelli
2018-09-04 11:32:38 +02:00
parent 886f5cbfe1
commit 5ff67bd3d7
6 changed files with 86 additions and 402 deletions
+24 -1
View File
@@ -5455,11 +5455,17 @@ SELECT CodFase, DescrFase, CloseTask, TimeRec FROM AnagFasi WHERE (CodFase = @Co
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
private void InitCommandCollection() {
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[2];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT CodFase, DescrFase, CloseTask, TimeRec FROM dbo.AnagFasi";
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[1].Connection = this.Connection;
this._commandCollection[1].CommandText = "dbo.stp_AF_GetByPost";
this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure;
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodPost", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5486,6 +5492,23 @@ SELECT CodFase, DescrFase, CloseTask, TimeRec FROM AnagFasi WHERE (CodFase = @Co
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
public virtual DS_App.AnagFasiDataTable getByPost(string CodPost) {
this.Adapter.SelectCommand = this.CommandCollection[1];
if ((CodPost == null)) {
this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
}
else {
this.Adapter.SelectCommand.Parameters[1].Value = ((string)(CodPost));
}
DS_App.AnagFasiDataTable dataTable = new DS_App.AnagFasiDataTable();
this.Adapter.Fill(dataTable);
return dataTable;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
+13 -1
View File
@@ -188,7 +188,19 @@ SELECT CodFase, DescrFase, CloseTask, TimeRec FROM AnagFasi WHERE (CodFase = @Co
<Mapping SourceColumn="CloseTask" DataSetColumn="CloseTask" />
<Mapping SourceColumn="TimeRec" DataSetColumn="TimeRec" />
</Mappings>
<Sources />
<Sources>
<DbSource ConnectionRef="C_TRACKConnectionString (Settings)" DbObjectName="C_TRACK.dbo.stp_AF_GetByPost" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getByPost" GetMethodModifier="Public" GetMethodName="getByPost" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getByPost" UserSourceName="getByPost">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_AF_GetByPost</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@CodPost" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</Sources>
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="AnagOprTableAdapter" GeneratorDataComponentClassName="AnagOprTableAdapter" Name="AnagOpr" UserDataComponentName="AnagOprTableAdapter">
<MainSource>
+23 -35
View File
@@ -1,38 +1,26 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_btnComandi.ascx.cs" Inherits="C_TRACK.WebUserControls.mod_btnComandi" %>
<div class="row my-2">
<div class="col-6">
<asp:LinkButton ID="lbt1" runat="server" CssClass="btn text-truncate btn-lg btn-block btn-success" OnClick="lbt1_Click">
<i class="fa fa-plus"></i> <%: comandiAmmessi["04"] %>
</asp:LinkButton>
</div>
<div class="col-6">
<asp:LinkButton ID="lbt2" runat="server" CssClass="btn text-truncate btn-lg btn-block btn-primary" OnClick="lbt2_Click">
<i class="fa fa-gear"></i> <%: comandiAmmessi["05"] %>
</asp:LinkButton>
</div>
</div>
<div class="row my-2">
<div class="col-6">
<asp:LinkButton ID="lbt3" runat="server" CssClass="btn text-truncate btn-lg btn-block btn-dark" OnClick="lbt3_Click">
<i class="fa fa-star"></i> <%: comandiAmmessi["06"] %>
</asp:LinkButton>
</div>
<div class="col-6">
<asp:LinkButton ID="lbt4" runat="server" CssClass="btn text-truncate btn-lg btn-block btn-warning" OnClick="lbt4_Click">
<i class="fa fa-info"></i> <%: comandiAmmessi["07"] %>
</asp:LinkButton>
</div>
</div>
<div class="row my-2">
<div class="col-6">
<asp:LinkButton ID="lbt5" runat="server" CssClass="btn text-truncate btn-lg btn-block btn-success" OnClick="lbt5_Click">
<i class="fa fa-check"></i> <%: comandiAmmessi["ok"] %>
</asp:LinkButton>
</div>
<div class="col-6">
<asp:LinkButton ID="lbt6" runat="server" CssClass="btn text-truncate btn-lg btn-block btn-dark" OnClick="lbt6_Click">
<i class="fa fa-ban"></i> <%: comandiAmmessi["ko"] %>
</asp:LinkButton>
</div>
<asp:Repeater runat="server" ID="repComandi" DataSourceID="odsCmd">
<ItemTemplate>
<div class="col-12 col-sm-6 py-1">
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="btn text-truncate btn-block btn-info" OnClick="lbtCmd_Click" CommandArgument='<%# Eval("CodFase") %>'>
<i class="fa fa-plus"></i> <%# Eval("DescrFase") %>
</asp:LinkButton>
</div>
</ItemTemplate>
<AlternatingItemTemplate>
<div class="col-12 col-sm-6 py-1">
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="btn text-truncate btn-block btn-dark" OnClick="lbtCmd_Click" CommandArgument='<%# Eval("CodFase") %>'>
<i class="fa fa-plus"></i> <%# Eval("DescrFase") %>
</asp:LinkButton>
</div>
</AlternatingItemTemplate>
</asp:Repeater>
</div>
<asp:ObjectDataSource runat="server" ID="odsCmd" OldValuesParameterFormatString="original_{0}" SelectMethod="getByPost" TypeName="AppData.DS_AppTableAdapters.AnagFasiTableAdapter">
<SelectParameters>
<asp:SessionParameter SessionField="CodPost" Name="CodPost" DefaultValue="" DbType="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:Label runat="server" ID="lblTest">...</asp:Label>
+10 -332
View File
@@ -1,7 +1,6 @@
using AppData;
using SteamWare;
using SteamWare;
using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
namespace C_TRACK.WebUserControls
{
@@ -14,221 +13,9 @@ namespace C_TRACK.WebUserControls
protected void Page_Load(object sender, EventArgs e)
{
setupComandiBarcode();
updateBtn();
}
/// <summary>
/// Restituisce email dest da codCliente + check conf da web.config con forzatura a email interna
/// </summary>
/// <param name="CodCliente"></param>
/// <returns></returns>
protected string getEmailDest(string CodCliente)
{
string answ = "";
#if false
if (memLayer.ML.CRS("_forcedDestEmail") != "")
{
answ = memLayer.ML.CRS("_forcedDestEmail");
}
else
{
answ = XPS_data.XPS.obj.taAnCli.getByKey(CodCliente)[0].email;
}
#endif
return answ;
}
/// <summary>
/// Aggiorna stato buttons
/// </summary>
public void updateBtn()
{
// determino visibilità lbt4: SOLO se ho un UDC valido ed è in stato 05...
int currState = 0;
bool emailReq = false;
string emailSent = "";
string emailDest = "";
string CodCliente = "";
#if false
DS_applicazione.IstObjRow rigaIstObj;
// calcolo lo stato dell'oggetto...
try
{
rigaIstObj = XPS_data.XPS.obj.taObj.getByIdxObj(comando.valore)[0];
currState = Convert.ToInt32(rigaIstObj.CodStato);
emailReq = rigaIstObj.emailReq;
CodCliente = rigaIstObj.CodCliente;
emailDest = getEmailDest(CodCliente);
}
catch
{ }
try
{
rigaIstObj = XPS_data.XPS.obj.taObj.getByIdxObj(comando.valore)[0];
emailSent = rigaIstObj.emailSent.ToString("dd/MM/yy HH:mm");
}
catch
{ }
#endif
switch (currState)
{
case 1:
case 2:
case 3:
lbt1.Enabled = true;
lbt2.Enabled = false;
lbt3.Enabled = false;
lbt4.Enabled = false;
break;
case 4:
lbt1.Enabled = false;
lbt2.Enabled = true;
lbt3.Enabled = false;
lbt4.Enabled = false;
break;
case 5:
lbt1.Enabled = false;
lbt2.Enabled = false;
lbt3.Enabled = true;
lbt4.Enabled = true;
break;
case 6:
case 7:
lbt1.Enabled = false;
lbt2.Enabled = false;
lbt3.Enabled = false;
lbt4.Enabled = true;
break;
default:
lbt1.Enabled = false;
lbt2.Enabled = false;
lbt3.Enabled = false;
lbt4.Enabled = false;
break;
}
// fix CSS... inizio togliendo disabled...
lbt1.CssClass = lbt1.CssClass.Replace("disabled", "").Trim();
lbt2.CssClass = lbt2.CssClass.Replace("disabled", "").Trim();
lbt3.CssClass = lbt3.CssClass.Replace("disabled", "").Trim();
lbt4.CssClass = lbt4.CssClass.Replace("disabled", "").Trim();
lbt5.CssClass = lbt5.CssClass.Replace("disabled", "").Trim();
lbt6.CssClass = lbt6.CssClass.Replace("disabled", "").Trim();
// rimetto dove serve disabled...
if (!lbt1.Enabled)
{
lbt1.CssClass += " disabled";
}
if (!lbt2.Enabled)
{
lbt2.CssClass += " disabled";
}
if (!lbt3.Enabled)
{
lbt3.CssClass += " disabled";
}
if (!lbt4.Enabled)
{
lbt4.CssClass += " disabled";
}
if (!lbt5.Enabled)
{
lbt5.CssClass += " disabled";
}
if (!lbt6.Enabled)
{
lbt6.CssClass += " disabled";
}
if (currState >= 5)
{
// controllo se c'è email del cliente...
if (emailDest != "")
{
lbt4.Enabled = true;
}
else
{
lbt4.Enabled = false;
}
// controllo se era indicato email richiesta!
if (emailReq)
{
lbt4.Text = string.Format("{0}{1}{2}", comandiAmmessi["07"], Environment.NewLine, user_std.UtSn.Traduci("emailReq"));
}
else
{
lbt4.Enabled = false;
}
// controllo se mai spedita email...
if (emailSent != "")
{
lbt4.Text += string.Format("{0}{1}: {2}", Environment.NewLine, user_std.UtSn.Traduci("emailSent"), emailSent);
}
}
// se autoconferma nascondo button conferma...
if (memLayer.ML.confReadBool("autoConfCmd"))
{
lbt5.Visible = false;
}
else
{
lbt5.Visible = true;
}
}
/// <summary>
/// carico da tab i comandi ammessi per il barcode...
/// </summary>
private void setupComandiBarcode()
{
// da rivedere, x ora metto BRUTALMENTE alcuni comandi...
Dictionary<string, string> comandi = new Dictionary<string, string>();
var tabCmd = dataLayer.man.taTE2S.getByMappa("E_BC");
foreach (var rigaCmd in tabCmd)
{
comandi.Add(rigaCmd.CodEvento, devicesAuthProxy.stObj.traduci(rigaCmd.text2show));
}
#if false
XPS_data.DS_applicazioneTableAdapters.TraEv2StatiTableAdapter taTrEv2St = new XPS_data.DS_applicazioneTableAdapters.TraEv2StatiTableAdapter();
DS_applicazione.TraEv2StatiDataTable _tabTran = taTrEv2St.getByCodMappa("E_BC");
Dictionary<string, string> comandi = new Dictionary<string, string>();
foreach (DS_applicazione.TraEv2StatiRow riga in _tabTran)
{
comandi.Add(riga.CodEvento, user_std.UtSn.Traduci(riga.text2show));
}
// impongo i comandi al barcode...
#endif
comandiAmmessi = comandi;
}
/// <summary>
/// dictionary comandi ammessi
/// </summary>
protected Dictionary<string, string> _comandi = new Dictionary<string, string>();
/// <summary>
/// elenco dei comandi riconosciuti
/// </summary>
public Dictionary<string, string> comandiAmmessi
{
get
{
return _comandi;
}
set
{
_comandi = value;
}
}
/// <summary>
/// segnala click su button comando
/// </summary>
public void segnalaClick()
@@ -240,128 +27,19 @@ namespace C_TRACK.WebUserControls
}
protected void lbt1_Click(object sender, EventArgs e)
protected void lbtCmd_Click(object sender, EventArgs e)
{
memLayer.ML.setSessionVal("btnCmdPress", "04", false);
segnalaClick();
}
protected void lbt2_Click(object sender, EventArgs e)
{
memLayer.ML.setSessionVal("btnCmdPress", "05", false);
segnalaClick();
}
protected void lbt3_Click(object sender, EventArgs e)
{
memLayer.ML.setSessionVal("btnCmdPress", "06", false);
segnalaClick();
}
protected void lbt4_Click(object sender, EventArgs e)
{
#if false
logger.lg.scriviLog("Richiesto invio email...");
// mi limito a mandare email e non segnalo altro... carico dati!
// determino visibilità lbt4: SOLO se ho un UDC valido ed è in stato 05...
int currState = 0;
bool emailReq = false;
string emailSent = "";
string emailDest = "";
string CodCliente = "";
string ddt = "";
string dataRif = "";
string descr = "";
string peso = "";
DS_applicazione.IstObjRow rigaIstObj = null;
// calcolo lo stato dell'oggetto...
try
{
rigaIstObj = XPS_data.XPS.obj.taObj.getByIdxObj(comando.valore)[0];
currState = Convert.ToInt32(rigaIstObj.CodStato);
emailReq = rigaIstObj.emailReq;
CodCliente = rigaIstObj.CodCliente;
emailDest = getEmailDest(CodCliente);
logger.lg.scriviLog(string.Format("Recuperati dati per invio email: {0} | {1} | {2}", comando.valore, CodCliente, emailDest));
}
catch (Exception exc)
{
logger.lg.scriviLog(String.Format("Eccezione in recupero dati commessa x email: {0}", exc), tipoLog.EXCEPTION);
}
try
{
rigaIstObj = XPS_data.XPS.obj.taObj.getByIdxObj(comando.valore)[0];
emailSent = rigaIstObj.emailSent.ToString("dd/MM/yy HH:mm");
}
catch (Exception exc)
{
logger.lg.scriviLog(String.Format("Eccezione in invio email: {0}", exc), tipoLog.EXCEPTION);
}
try
{
ddt = rigaIstObj.Nome;
dataRif = rigaIstObj.DataRif.ToString("dd/MM/yy HH:mm");
descr = rigaIstObj.Note;
peso = rigaIstObj.Peso.ToString();
}
catch (Exception exc)
{
ddt = "n.d.";
dataRif = "n.d.";
descr = "n.d.";
peso = "n.d.";
logger.lg.scriviLog(String.Format("Eccezione in recupero dati x email: {0}", exc), tipoLog.EXCEPTION);
}
if (currState >= 5 && emailDest != "")
{
// invio email
string subject = user_std.UtSn.Traduci("emailSubject"); // 'Notifica merce pronta'
string bodyMsg = string.Format(user_std.UtSn.Traduci("emailBody"), ddt, dataRif, descr, peso); //'Attenzione, la merce relativa al DDT {0} del {1}, ({2}, peso {3} kg) è pronta per il ritiro presso EQUA s.p.a di Pedrengo'
// se è forzato invio interno cambio subject e body...
if (memLayer.ML.CRS("_forcedDestEmail") != "")
{
DS_applicazione.v_commesseRow rigaComm = XPS_data.XPS.obj.taComm.getByCod(comando.valore)[0];
subject += string.Format(" | cliente: {0}", rigaComm.Cliente);
bodyMsg += string.Format("<br/><br/><a href=\"{0}detComm?CodDDT={1}\">Link diretto al DDT {2} - {3}</a>", memLayer.ML.CRS("mainSite"), rigaComm.Cod, rigaComm.DDT, rigaComm.descrizione);
}
// invio email!
bool fatto = gestEmail.geAuth.mandaEmail(memLayer.ML.confReadString("_emailUser"), emailDest, subject, bodyMsg);
if (fatto)
{
// aggiorno stato obj
XPS_data.XPS.obj.taObj.updateEmailSent(comando.valore);
}
}
#endif
updateBtn();
}
protected void lbt5_Click(object sender, EventArgs e)
{
memLayer.ML.setSessionVal("btnCmdPress", "ok", false);
segnalaClick();
}
protected void lbt6_Click(object sender, EventArgs e)
{
memLayer.ML.setSessionVal("btnCmdPress", "ko", false);
LinkButton lb = (LinkButton)sender;
memLayer.ML.setSessionVal("btnCmdPress", lb.CommandArgument, false);
segnalaClick();
}
/// <summary>
/// oggetto comando locale alla classe
/// </summary>
protected inputComando comando
public void updateBtn()
{
get
{
inputComando answ;
if (memLayer.ML.isInSessionObject("barcodeCmd"))
{
answ = (inputComando)memLayer.ML.objSessionObj("barcodeCmd");
}
else
{
answ = new inputComando();
}
return answ;
}
// verifico se ho comandi PREVALENTI (es: ho UNA FASE APERTA) !!!FARE!!!
// altrimenti imposto fasi da postazione...
repComandi.DataBind();
}
}
}
+6 -33
View File
@@ -13,57 +13,30 @@ namespace C_TRACK.WebUserControls {
public partial class mod_btnComandi {
/// <summary>
/// Controllo lbt1.
/// Controllo repComandi.
/// </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.LinkButton lbt1;
protected global::System.Web.UI.WebControls.Repeater repComandi;
/// <summary>
/// Controllo lbt2.
/// Controllo odsCmd.
/// </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.LinkButton lbt2;
protected global::System.Web.UI.WebControls.ObjectDataSource odsCmd;
/// <summary>
/// Controllo lbt3.
/// Controllo lblTest.
/// </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.LinkButton lbt3;
/// <summary>
/// Controllo lbt4.
/// </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.LinkButton lbt4;
/// <summary>
/// Controllo lbt5.
/// </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.LinkButton lbt5;
/// <summary>
/// Controllo lbt6.
/// </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.LinkButton lbt6;
protected global::System.Web.UI.WebControls.Label lblTest;
}
}
+10
View File
@@ -348,11 +348,20 @@ namespace C_TRACK
{
Dictionary<string, string> comandi = new Dictionary<string, string>();
// !!!FARE!!! togleire...
var tabCmd = dataLayer.man.taTE2S.getByMappa("E_BC");
foreach (var rigaCmd in tabCmd)
{
comandi.Add(rigaCmd.CodEvento.ToUpper(), devicesAuthProxy.stObj.traduci(rigaCmd.text2show));
}
var tabFasi = dataLayer.man.taAF.GetData();
foreach (var rigaFase in tabFasi)
{
comandi.Add(rigaFase.CodFase, rigaFase.DescrFase);
}
#if false
XPS_data.DS_applicazioneTableAdapters.TraEv2StatiTableAdapter taTrEv2St = new XPS_data.DS_applicazioneTableAdapters.TraEv2StatiTableAdapter();
DS_applicazione.TraEv2StatiDataTable _tabTran = taTrEv2St.getByCodMappa("E_BC");
@@ -473,6 +482,7 @@ namespace C_TRACK
{
CodPost = mod_barcode1.comandoRegistrato.valore;
dataLayer.man.taAP.setOpr(CodPost, CodOpr);
// svuoto vallori
}
}
}