From 300e27ee261bb3376073aa3397cfb70165268634 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 9 Sep 2020 11:39:45 +0200 Subject: [PATCH] Completamento porting a BaseUserControl x MP_ADM --- MP-ADM/BasePage.cs | 2 +- MP-ADM/BaseUserControl.cs | 99 ++ MP-ADM/Planner.aspx.cs | 144 +- MP-ADM/StoricoTC.aspx.cs | 2 +- MP-ADM/WebMasterPages/AjaxSimple.master.cs | 2 +- .../WebMasterPages/MoonPro.master.designer.cs | 2 +- MP-ADM/WebUserControls/cmp_HwSwInfo.ascx | 2 +- MP-ADM/WebUserControls/cmp_HwSwInfo.ascx.cs | 2 +- .../WebUserControls/mod_anagArticoli.ascx.cs | 6 +- MP-ADM/WebUserControls/mod_approvProd.ascx.cs | 289 ++-- .../mod_approvazioneODL.ascx.cs | 282 ++-- MP-ADM/WebUserControls/mod_barcode.ascx.cs | 1309 ++++++++-------- MP-ADM/WebUserControls/mod_fixCal.ascx.cs | 12 +- .../mod_fixCal.ascx.designer.cs | 44 +- MP-ADM/WebUserControls/mod_footer.ascx.cs | 12 +- MP-ADM/WebUserControls/mod_gestKIT.ascx.cs | 475 +++--- .../WebUserControls/mod_gestPromODL.ascx.cs | 1196 ++++++++------- .../mod_gestPromODL_OUT.ascx.cs | 1311 ++++++++--------- .../mod_gestioneDatiMacchine.ascx.cs | 48 +- .../mod_gestioneODL.ascx.designer.cs | 2 +- MP-ADM/WebUserControls/mod_login.ascx.cs | 10 +- MP-ADM/WebUserControls/mod_main_help.ascx | 88 +- MP-ADM/WebUserControls/mod_menuBottom.ascx.cs | 19 +- .../mod_menuBottom.ascx.designer.cs | 78 +- MP-ADM/WebUserControls/mod_menuTop.ascx | 4 +- MP-ADM/WebUserControls/mod_menuTop.ascx.cs | 305 ++-- .../mod_menuTop.ascx.designer.cs | 2 +- .../mod_menuTopCompact.ascx.cs | 192 +-- MP-ADM/WebUserControls/mod_newOdl.ascx | 2 +- MP-ADM/WebUserControls/mod_newOdl.ascx.cs | 302 ++-- .../mod_newOdl.ascx.designer.cs | 159 +- .../mod_newPromessaODL.ascx.cs | 524 ++++--- .../mod_ricercaGenerica.ascx.cs | 14 +- MP-ADM/WebUserControls/mod_storicoTC.ascx.cs | 2 +- MP-ADM/WebUserControls/mod_unauthorized.ascx | 29 +- .../WebUserControls/mod_unauthorized.ascx.cs | 9 +- .../mod_unauthorized.ascx.designer.cs | 40 +- MP-ADM/approvazioneODL.aspx.cs | 32 +- MP-ADM/approvazioneODL.aspx.designer.cs | 2 +- MP-ADM/calendChiusura.aspx | 2 +- MP-ADM/calendChiusura.aspx.designer.cs | 11 +- 41 files changed, 3476 insertions(+), 3591 deletions(-) diff --git a/MP-ADM/BasePage.cs b/MP-ADM/BasePage.cs index 59b6b9f9..769033c7 100644 --- a/MP-ADM/BasePage.cs +++ b/MP-ADM/BasePage.cs @@ -16,7 +16,7 @@ namespace MP_ADM { get { - string pagina = SteamWare.memLayer.ML.StringSessionObj("nextPage"); + string pagina = memLayer.ML.StringSessionObj("nextPage"); if (pagina == "") { pagina = "menu.aspx"; diff --git a/MP-ADM/BaseUserControl.cs b/MP-ADM/BaseUserControl.cs index 2cafedd1..a154ac97 100644 --- a/MP-ADM/BaseUserControl.cs +++ b/MP-ADM/BaseUserControl.cs @@ -9,10 +9,74 @@ namespace MP_ADM { public class BaseUserControl : System.Web.UI.UserControl { + #region gestione eventi + + public event EventHandler eh_nuovoValore; + public event EventHandler eh_resetSelezione; + public event EventHandler eh_selValore; + + + /// + /// Solleva evento nuovo valore + /// + public void raiseNewVal() + { + // evento come nuovo... + if (eh_nuovoValore != null) + { + eh_nuovoValore(this, new EventArgs()); + } + } + + public void raiseSelNew() + { + // sollevo evento nuovo valore... + if (eh_selValore != null) + { + eh_selValore(this, new EventArgs()); + } + } + /// + /// Solleva evento reset + /// + public void raiseReset() + { + if (eh_resetSelezione != null) + { + eh_resetSelezione(this, new EventArgs()); + } + } + + #endregion + /// /// Oggetto datalayer specifico NON singleton x scalare /// internal DataLayer DataLayerObj = new DataLayer(); + + /// + /// UID formattato con "_" + /// + public string uid + { + get + { + return this.UniqueID.Replace("$", "_").Replace("-", "_"); + } + } + /// + /// titolo pagina + /// + public string titolo + { + get + { + return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", ""); + } + } + + #region utils + /// /// effettua traduzione del lemma /// @@ -31,5 +95,40 @@ namespace MP_ADM { return user_std.UtSn.TraduciEn(lemma); } + + /// + /// formatta in minuti/sec partendo da min.cent + /// + /// + /// + public string minSec(object minCent) + { + string answ = ""; + try + { + answ = string.Format("{0:mm}:{0:ss}", minCent2Sec(Convert.ToDecimal(minCent.ToString().Replace(".", ",")))); + } + catch + { } + return answ; + } + /// + /// conversione da tempo minuti centesimali a minuti/secondi + /// + /// + /// + protected TimeSpan minCent2Sec(decimal valore) + { + TimeSpan answ = new TimeSpan(0, 0, 1); + try + { + answ = new TimeSpan(0, Convert.ToInt32(valore), Convert.ToInt32((valore - Convert.ToInt32(valore)) * 60)); + } + catch + { } + return answ; + } + + #endregion } } \ No newline at end of file diff --git a/MP-ADM/Planner.aspx.cs b/MP-ADM/Planner.aspx.cs index cdccd8ab..0ebad8ab 100644 --- a/MP-ADM/Planner.aspx.cs +++ b/MP-ADM/Planner.aspx.cs @@ -3,98 +3,98 @@ using System; namespace MP_ADM { - public partial class Planner : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class Planner : BasePage { - if(!Page.IsPostBack) - { - toggleVisibility(); - } - checkEnabled(); - string codPre = memLayer.ML.CRS("OptAdmKit_CodPre"); - mod_planStats.eh_reset += Mod_planStats_eh_reset; - mod_planStats.eh_selVal += Mod_planStats_eh_selVal; - mod_planCreate.eh_ucev += Mod_planCreate_eh_ucev; - } + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + toggleVisibility(); + } + checkEnabled(); + string codPre = memLayer.ML.CRS("OptAdmKit_CodPre"); + mod_planStats.eh_reset += Mod_planStats_eh_reset; + mod_planStats.eh_selVal += Mod_planStats_eh_selVal; + mod_planCreate.eh_ucev += Mod_planCreate_eh_ucev; + } - private void Mod_planCreate_eh_ucev(object sender, EventArgs e) - { - // se trovo evento select/reset mostro/nascondo dettagli... - ucEvent evento = (ucEvent)e; - switch (evento.tipoEvento) - { - case ucEvType.ReqUpdateParent: - mod_planStats.doReset(); - mod_gestPromODL_OUT.resetSelezione(); - break; - default: - break; - } - } + private void Mod_planCreate_eh_ucev(object sender, EventArgs e) + { + // se trovo evento select/reset mostro/nascondo dettagli... + ucEvent evento = (ucEvent)e; + switch (evento.tipoEvento) + { + case ucEvType.ReqUpdateParent: + mod_planStats.doReset(); + mod_gestPromODL_OUT.resetSelezione(); + break; + default: + break; + } + } - protected void lbtToggle_Click(object sender, EventArgs e) - { - toggleVisibility(); - } + protected void lbtToggle_Click(object sender, EventArgs e) + { + toggleVisibility(); + } - private void toggleVisibility() - { - divPromOUT.Visible = !divPromOUT.Visible; - tgIcon.Attributes["class"] = divPromOUT.Visible ? "fa fa-chevron-up" : "fa fa-chevron-down"; - } - private void Mod_planStats_eh_selVal(object sender, EventArgs e) - { - fixSelStat(); - } + private void toggleVisibility() + { + divPromOUT.Visible = !divPromOUT.Visible; + tgIcon.Attributes["class"] = divPromOUT.Visible ? "fa fa-chevron-up" : "fa fa-chevron-down"; + } + private void Mod_planStats_eh_selVal(object sender, EventArgs e) + { + fixSelStat(); + } - private void Mod_planStats_eh_reset(object sender, EventArgs e) - { - fixSelStat(); - } + private void Mod_planStats_eh_reset(object sender, EventArgs e) + { + fixSelStat(); + } - protected void fixSelStat() - { - mod_planCreate.CodGruppo = mod_planStats.CodGruppo; - mod_planCreate.IdxMacchina = mod_planStats.IdxMacchina; - mod_planCreate.CodArticolo = mod_planStats.CodArticolo; - mod_planCreate.doUpdate(); - } + protected void fixSelStat() + { + mod_planCreate.CodGruppo = mod_planStats.CodGruppo; + mod_planCreate.IdxMacchina = mod_planStats.IdxMacchina; + mod_planCreate.CodArticolo = mod_planStats.CodArticolo; + mod_planCreate.doUpdate(); + } - private void checkEnabled() - { - bool optPar = memLayer.ML.CRB("OptAdmKitEnabled"); - divContent.Visible = optPar; - lblDataImportOut.Visible = !optPar; - string messaggio = ""; - if (!optPar) - { - messaggio = "Attenzione: Gestione KIT disabilitata"; - lblDataImportOut.Text = messaggio; - } - } + private void checkEnabled() + { + bool optPar = memLayer.ML.CRB("OptAdmKitEnabled"); + divContent.Visible = optPar; + lblDataImportOut.Visible = !optPar; + string messaggio = ""; + if (!optPar) + { + messaggio = "Attenzione: Gestione KIT disabilitata"; + lblDataImportOut.Text = messaggio; + } + } - private void Mod_gestKIT_eh_selKit(object sender, EventArgs e) - { + private void Mod_gestKIT_eh_selKit(object sender, EventArgs e) + { #if false // invio ultimo kit creato a barcode... mod_barcode.BCodeVal = mod_gestKIT.lastKitMade; mod_barcode.processInput(); #endif - } + } - private void Mod_barcode_eh_dataRead(object sender, EventArgs e) - { + private void Mod_barcode_eh_dataRead(object sender, EventArgs e) + { #if false // verifico input su KIT x lettura "grezza" string rawInput = mod_barcode.rawInput; mod_gestKIT.lastInput = rawInput; mod_gestKIT.doUpdate(); #endif - } + } - private void Mod_barcode_eh_comandoRegistrato(object sender, EventArgs e) - { + private void Mod_barcode_eh_comandoRegistrato(object sender, EventArgs e) + { #if false // verifico input su KIT x comando completo string BCodeVal = mod_barcode.BCodeVal; @@ -111,6 +111,6 @@ namespace MP_ADM } mod_gestKIT.doUpdate(); #endif + } } - } } \ No newline at end of file diff --git a/MP-ADM/StoricoTC.aspx.cs b/MP-ADM/StoricoTC.aspx.cs index c4d2c5dd..0b6b21f1 100644 --- a/MP-ADM/StoricoTC.aspx.cs +++ b/MP-ADM/StoricoTC.aspx.cs @@ -2,7 +2,7 @@ namespace MP_ADM { - public partial class StoricoTC : System.Web.UI.Page + public partial class StoricoTC : BasePage { protected void Page_Load(object sender, EventArgs e) { diff --git a/MP-ADM/WebMasterPages/AjaxSimple.master.cs b/MP-ADM/WebMasterPages/AjaxSimple.master.cs index 29c4c87c..bc961687 100644 --- a/MP-ADM/WebMasterPages/AjaxSimple.master.cs +++ b/MP-ADM/WebMasterPages/AjaxSimple.master.cs @@ -6,6 +6,6 @@ public partial class AjaxSimple : System.Web.UI.MasterPage protected override void OnLoad(EventArgs e) { base.OnLoad(e); - Page.Title = SteamWare.memLayer.ML.CRS("_titoloPagina"); + Page.Title = memLayer.ML.CRS("_titoloPagina"); } } diff --git a/MP-ADM/WebMasterPages/MoonPro.master.designer.cs b/MP-ADM/WebMasterPages/MoonPro.master.designer.cs index 794bc26c..e9d3c276 100644 --- a/MP-ADM/WebMasterPages/MoonPro.master.designer.cs +++ b/MP-ADM/WebMasterPages/MoonPro.master.designer.cs @@ -63,7 +63,7 @@ public partial class MoonPro { /// Campo generato automaticamente. /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. /// - protected global::MoonPro_site.WebUserControls.mod_menuTop Mod_menuTop1; + protected global::MP_ADM.WebUserControls.mod_menuTop Mod_menuTop1; /// /// Controllo UpdatePanel1. diff --git a/MP-ADM/WebUserControls/cmp_HwSwInfo.ascx b/MP-ADM/WebUserControls/cmp_HwSwInfo.ascx index cd59fce9..ac810dac 100644 --- a/MP-ADM/WebUserControls/cmp_HwSwInfo.ascx +++ b/MP-ADM/WebUserControls/cmp_HwSwInfo.ascx @@ -19,7 +19,7 @@
Module
-

<%: SteamWare.memLayer.ML.confReadString("CodModulo") %>

+

<%: memLayer.ML.confReadString("CodModulo") %>

diff --git a/MP-ADM/WebUserControls/cmp_HwSwInfo.ascx.cs b/MP-ADM/WebUserControls/cmp_HwSwInfo.ascx.cs index ed314d83..c87dae36 100644 --- a/MP-ADM/WebUserControls/cmp_HwSwInfo.ascx.cs +++ b/MP-ADM/WebUserControls/cmp_HwSwInfo.ascx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace MP_ADM.WebUserControls { - public partial class cmp_HwSwInfo : System.Web.UI.UserControl + public partial class cmp_HwSwInfo : BaseUserControl { protected void Page_Load(object sender, EventArgs e) { diff --git a/MP-ADM/WebUserControls/mod_anagArticoli.ascx.cs b/MP-ADM/WebUserControls/mod_anagArticoli.ascx.cs index 4d160e49..ce08ac7b 100644 --- a/MP-ADM/WebUserControls/mod_anagArticoli.ascx.cs +++ b/MP-ADM/WebUserControls/mod_anagArticoli.ascx.cs @@ -6,7 +6,7 @@ using System.Web.UI.WebControls; namespace MP_ADM.WebUserControls { - public partial class mod_anagArticoli : System.Web.UI.UserControl + public partial class mod_anagArticoli : BaseUserControl { /// @@ -37,7 +37,7 @@ namespace MP_ADM.WebUserControls protected void grView_SelectedIndexChanged(object sender, EventArgs e) { // salvo in session il valore selezionato... - SteamWare.memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false); + memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false); // sollevo evento nuovo valore... if (eh_selValore != null) { @@ -167,7 +167,7 @@ namespace MP_ADM.WebUserControls /// public void resetSelezione() { - SteamWare.memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView)); + memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView)); grView.SelectedIndex = -1; grView.DataBind(); lblWarning.Visible = false; diff --git a/MP-ADM/WebUserControls/mod_approvProd.ascx.cs b/MP-ADM/WebUserControls/mod_approvProd.ascx.cs index fa76d94f..59907a25 100644 --- a/MP-ADM/WebUserControls/mod_approvProd.ascx.cs +++ b/MP-ADM/WebUserControls/mod_approvProd.ascx.cs @@ -6,161 +6,148 @@ using System.Web.UI.WebControls; namespace MP_ADM.WebUserControls { - public partial class mod_approvProd : System.Web.UI.UserControl - { - /// - /// Oggetto datalayer specifico - /// - DataLayer DataLayerObj = new DataLayer(); - protected void Page_Load(object sender, EventArgs e) + public partial class mod_approvProd : BaseUserControl { - if (!Page.IsPostBack) - { - grView.PageSize = pageSize; - } - } - /// - /// dimensione pagina - /// - public int pageSize - { - get - { - int answ = 10; - try + protected void Page_Load(object sender, EventArgs e) { - answ = Convert.ToInt32(txtPageSize.Text); + if (!Page.IsPostBack) + { + grView.PageSize = pageSize; + } } - catch - { } - return answ; - } - set - { - txtPageSize.Text = value.ToString(); - } - } - /// - /// wrapper traduzione - /// - /// - /// - public string traduci(object lemma) - { - return user_std.UtSn.Traduci(lemma.ToString()); - } - /// - /// seleziona/deseleziona le righe indicate... - /// - /// - /// - protected void btnSelAll_Click(object sender, EventArgs e) - { - // seleziono tutti i valori visibili nel datagrid - CheckBox chkbox = ((CheckBox)sender); - bool isChecked = chkbox.Checked; - if (!isChecked) - { - chkbox.ToolTip = traduci("btnSelAll"); - } - else - { - chkbox.ToolTip = traduci("btnDeselAll"); - } - foreach (GridViewRow riga in grView.Rows) - { - ((CheckBox)riga.FindControl("chkSelect")).Checked = isChecked; - } - } - /// - /// conferma dati produzione verso As400 - /// - /// - /// - protected void lbtApprovaProd_Click(object sender, EventArgs e) - { - foreach (GridViewRow riga in grView.Rows) - { - int IdxODL = 0; - DateTime DataRif = DateTime.Now.Date; - if (((CheckBox)riga.FindControl("chkSelect")).Checked && ((CheckBox)riga.FindControl("chkSelect")).Visible) + /// + /// dimensione pagina + /// + public int pageSize { - try - { - IdxODL = Convert.ToInt32(((Label)riga.FindControl("lblIdxODL")).Text); - DataRif = Convert.ToDateTime(((Label)riga.FindControl("lblDataRif")).Text); - } - catch - { } - DataLayerObj.taAs400.insProdAs400(IdxODL, DataRif); + get + { + int answ = 10; + try + { + answ = Convert.ToInt32(txtPageSize.Text); + } + catch + { } + return answ; + } + set + { + txtPageSize.Text = value.ToString(); + } + } + /// + /// seleziona/deseleziona le righe indicate... + /// + /// + /// + protected void btnSelAll_Click(object sender, EventArgs e) + { + // seleziono tutti i valori visibili nel datagrid + CheckBox chkbox = ((CheckBox)sender); + bool isChecked = chkbox.Checked; + if (!isChecked) + { + chkbox.ToolTip = traduci("btnSelAll"); + } + else + { + chkbox.ToolTip = traduci("btnDeselAll"); + } + foreach (GridViewRow riga in grView.Rows) + { + ((CheckBox)riga.FindControl("chkSelect")).Checked = isChecked; + } + } + /// + /// conferma dati produzione verso As400 + /// + /// + /// + protected void lbtApprovaProd_Click(object sender, EventArgs e) + { + foreach (GridViewRow riga in grView.Rows) + { + int IdxODL = 0; + DateTime DataRif = DateTime.Now.Date; + if (((CheckBox)riga.FindControl("chkSelect")).Checked && ((CheckBox)riga.FindControl("chkSelect")).Visible) + { + try + { + IdxODL = Convert.ToInt32(((Label)riga.FindControl("lblIdxODL")).Text); + DataRif = Convert.ToDateTime(((Label)riga.FindControl("lblDataRif")).Text); + } + catch + { } + DataLayerObj.taAs400.insProdAs400(IdxODL, DataRif); + } + } + grView.DataBind(); + } + /// + /// salvo comando + /// + /// + /// + protected void lbt_Command(object sender, CommandEventArgs e) + { + memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument); + } + /// + /// evento selezione riga: salvo tempo e qta nei campi input... + /// + /// + /// + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + // ricavo i dati selezionati + int IdxODL = 0; + DateTime DataRif = DateTime.Now.Date; + try + { + IdxODL = Convert.ToInt32(grView.SelectedDataKey[0]); + DataRif = Convert.ToDateTime(grView.SelectedDataKey[1]); + } + catch + { } + // gestione buttons approvazione + string _comando = ""; + if (memLayer.ML.isInSessionObject("nextObjCommand")) + { + _comando = memLayer.ML.StringSessionObj("nextObjCommand"); + memLayer.ML.emptySessionVal("nextObjCommand"); + } + switch (_comando) + { + case "Approva": + DataLayerObj.taAs400.insProdAs400(IdxODL, DataRif); + break; + default: + break; + } + grView.SelectedIndex = -1; + grView.DataBind(); + } + /// + /// cambio dim pagina + /// + /// + /// + protected void txtPageSize_TextChanged(object sender, EventArgs e) + { + grView.PageSize = pageSize; + } + /// + /// effettua caricamento interventi pending + /// + /// + /// + protected void lbtImportPending_Click(object sender, EventArgs e) + { + // forzo rilettura dati da approvare... + DataLayerObj.taAs400.ImportDati_ElencoConfermeProd(); + // update tab... + grView.DataBind(); } - } - grView.DataBind(); } - /// - /// salvo comando - /// - /// - /// - protected void lbt_Command(object sender, CommandEventArgs e) - { - SteamWare.memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument); - } - /// - /// evento selezione riga: salvo tempo e qta nei campi input... - /// - /// - /// - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - // ricavo i dati selezionati - int IdxODL = 0; - DateTime DataRif = DateTime.Now.Date; - try - { - IdxODL = Convert.ToInt32(grView.SelectedDataKey[0]); - DataRif = Convert.ToDateTime(grView.SelectedDataKey[1]); - } - catch - { } - // gestione buttons approvazione - string _comando = ""; - if (SteamWare.memLayer.ML.isInSessionObject("nextObjCommand")) - { - _comando = SteamWare.memLayer.ML.StringSessionObj("nextObjCommand"); - SteamWare.memLayer.ML.emptySessionVal("nextObjCommand"); - } - switch (_comando) - { - case "Approva": - DataLayerObj.taAs400.insProdAs400(IdxODL, DataRif); - break; - default: - break; - } - grView.SelectedIndex = -1; - grView.DataBind(); - } - /// - /// cambio dim pagina - /// - /// - /// - protected void txtPageSize_TextChanged(object sender, EventArgs e) - { - grView.PageSize = pageSize; - } - /// - /// effettua caricamento interventi pending - /// - /// - /// - protected void lbtImportPending_Click(object sender, EventArgs e) - { - // forzo rilettura dati da approvare... - DataLayerObj.taAs400.ImportDati_ElencoConfermeProd(); - // update tab... - grView.DataBind(); - } - } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_approvazioneODL.ascx.cs b/MP-ADM/WebUserControls/mod_approvazioneODL.ascx.cs index ecee21bb..f343e6d9 100644 --- a/MP-ADM/WebUserControls/mod_approvazioneODL.ascx.cs +++ b/MP-ADM/WebUserControls/mod_approvazioneODL.ascx.cs @@ -6,167 +6,131 @@ using System.Web.UI.WebControls; namespace MP_ADM.WebUserControls { - public partial class mod_approvazioneODL : System.Web.UI.UserControl - { - /// - /// Oggetto datalayer specifico - /// - DataLayer DataLayerObj = new DataLayer(); - protected void Page_Load(object sender, EventArgs e) + public partial class mod_approvazioneODL : BaseUserControl { - if (!Page.IsPostBack) - { - grView.PageSize = pageSize; - } - } - /// - /// dimensione pagina - /// - public int pageSize - { - get - { - int answ = 10; - try + protected void Page_Load(object sender, EventArgs e) { - answ = Convert.ToInt32(txtPageSize.Text); + if (!Page.IsPostBack) + { + grView.PageSize = pageSize; + } + } + /// + /// dimensione pagina + /// + public int pageSize + { + get + { + int answ = 10; + try + { + answ = Convert.ToInt32(txtPageSize.Text); + } + catch + { } + return answ; + } + set + { + txtPageSize.Text = value.ToString(); + } + } + /// + /// reset della selezione + /// + /// + /// + protected void btnReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + /// + /// resetta la selezione dei valori in caso di modifiche su altri controlli + /// + public void resetSelezione() + { + grView.SelectedIndex = -1; + grView.DataBind(); + } + /// + /// salvo comando + /// + /// + /// + protected void lbt_Command(object sender, CommandEventArgs e) + { + memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument); + } + /// + /// evento selezione riga: salvo tempo e qta nei campi input... + /// + /// + /// + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + // ricavo i dati selezionati + int idxOdl = 0; + try + { + idxOdl = Convert.ToInt32(grView.SelectedValue); + } + catch + { } + MapoDb.DS_ProdTempi.ODLRow rigaOdl = DataLayerObj.taODL.getByIdx(idxOdl, false)[0]; + // gestione buttons approvazione + string _comando = ""; + if (memLayer.ML.isInSessionObject("nextObjCommand")) + { + _comando = memLayer.ML.StringSessionObj("nextObjCommand"); + memLayer.ML.emptySessionVal("nextObjCommand"); + } + switch (_comando) + { + case "Approva": + DataLayerObj.taODL.approvaTC(idxOdl, string.Format("{0}{1}Approvato da: {2}", rigaOdl.Note, Environment.NewLine, user_std.UtSn.CognomeNome), user_std.UtSn.CognomeNome, true); + break; + case "Rifiuta": + DataLayerObj.taODL.approvaTC(idxOdl, string.Format("{0}{1}Rifiutato da: {2}", rigaOdl.Note, Environment.NewLine, user_std.UtSn.CognomeNome), user_std.UtSn.CognomeNome, false); + break; + default: + break; + } + grView.SelectedIndex = -1; + grView.DataBind(); + } + /// + /// cambio dim pagina + /// + /// + /// + protected void txtPageSize_TextChanged(object sender, EventArgs e) + { + grView.PageSize = pageSize; + } + /// + /// Classe css colore testo calcolato in abse ai TC + /// + /// + /// + /// + public string cssFromTempi(object _tcAssegnato, object _tcAttrezzato) + { + string answ = "text-dark"; + double tcAssegnato = 0; + double tcAttrezzato = 0; + double.TryParse(_tcAssegnato.ToString(), out tcAssegnato); + double.TryParse(_tcAttrezzato.ToString(), out tcAttrezzato); + if (tcAttrezzato > tcAssegnato) + { + answ = "text-danger"; + } + else + if (tcAttrezzato < tcAssegnato) + { + answ = "text-success"; + } + return answ; } - catch - { } - return answ; - } - set - { - txtPageSize.Text = value.ToString(); - } } - /// - /// reset della selezione - /// - /// - /// - protected void btnReset_Click(object sender, EventArgs e) - { - resetSelezione(); - } - /// - /// resetta la selezione dei valori in caso di modifiche su altri controlli - /// - public void resetSelezione() - { - grView.SelectedIndex = -1; - grView.DataBind(); - } - /// - /// salvo comando - /// - /// - /// - protected void lbt_Command(object sender, CommandEventArgs e) - { - SteamWare.memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument); - } - /// - /// evento selezione riga: salvo tempo e qta nei campi input... - /// - /// - /// - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - // ricavo i dati selezionati - int idxOdl = 0; - try - { - idxOdl = Convert.ToInt32(grView.SelectedValue); - } - catch - { } - MapoDb.DS_ProdTempi.ODLRow rigaOdl = DataLayerObj.taODL.getByIdx(idxOdl, false)[0]; - // gestione buttons approvazione - string _comando = ""; - if (SteamWare.memLayer.ML.isInSessionObject("nextObjCommand")) - { - _comando = SteamWare.memLayer.ML.StringSessionObj("nextObjCommand"); - SteamWare.memLayer.ML.emptySessionVal("nextObjCommand"); - } - switch (_comando) - { - case "Approva": - DataLayerObj.taODL.approvaTC(idxOdl, string.Format("{0}{1}Approvato da: {2}", rigaOdl.Note, Environment.NewLine, user_std.UtSn.CognomeNome), user_std.UtSn.CognomeNome, true); - break; - case "Rifiuta": - DataLayerObj.taODL.approvaTC(idxOdl, string.Format("{0}{1}Rifiutato da: {2}", rigaOdl.Note, Environment.NewLine, user_std.UtSn.CognomeNome), user_std.UtSn.CognomeNome, false); - break; - default: - break; - } - grView.SelectedIndex = -1; - grView.DataBind(); - } - /// - /// cambio dim pagina - /// - /// - /// - protected void txtPageSize_TextChanged(object sender, EventArgs e) - { - grView.PageSize = pageSize; - } - /// - /// formatta in minuti/sec partendo da min.cent - /// - /// - /// - public string minSec(object minCent) - { - string answ = ""; - try - { - answ = string.Format("{0:mm}:{0:ss}", minCent2Sec(Convert.ToDecimal(minCent.ToString().Replace(".", ",")))); - } - catch - { } - return answ; - } - /// - /// conversione da tempo minuti centesimali a minuti/secondi - /// - /// - /// - protected TimeSpan minCent2Sec(decimal valore) - { - TimeSpan answ = new TimeSpan(0, 0, 1); - try - { - answ = new TimeSpan(0, Convert.ToInt32(valore), Convert.ToInt32((valore - Convert.ToInt32(valore)) * 60)); - } - catch - { } - return answ; - } - /// - /// Classe css colore testo calcolato in abse ai TC - /// - /// - /// - /// - public string cssFromTempi(object _tcAssegnato, object _tcAttrezzato) - { - string answ = "text-dark"; - double tcAssegnato = 0; - double tcAttrezzato = 0; - double.TryParse(_tcAssegnato.ToString(), out tcAssegnato); - double.TryParse(_tcAttrezzato.ToString(), out tcAttrezzato); - if (tcAttrezzato > tcAssegnato) - { - answ = "text-danger"; - } - else - if (tcAttrezzato < tcAssegnato) - { - answ = "text-success"; - } - return answ; - } - } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_barcode.ascx.cs b/MP-ADM/WebUserControls/mod_barcode.ascx.cs index 1f467abb..f608d7a4 100644 --- a/MP-ADM/WebUserControls/mod_barcode.ascx.cs +++ b/MP-ADM/WebUserControls/mod_barcode.ascx.cs @@ -7,703 +7,672 @@ using System.Web.UI; namespace MP_ADM.WebUserControls { - public partial class mod_barcode : System.Web.UI.UserControl - { - /// - /// Oggetto datalayer specifico - /// - DataLayer DataLayerObj = new DataLayer(); + public partial class mod_barcode : BaseUserControl + { - #region setup VARS + #region setup VARS - /// - /// RegExp x RESET / CANCEL - /// - protected string regExp_KO = memLayer.ML.cdv("regExp_KO"); - /// - /// RegExp x CONFERMA - /// - protected string regExp_OK = memLayer.ML.cdv("regExp_OK"); - /// - /// RegExp x START KIT - /// - protected string regExp_KitStart = memLayer.ML.cdv("regExp_KitStart"); - /// - /// RegExp x SAVE KIT - /// - protected string regExp_KitSave = memLayer.ML.cdv("regExp_KitSave"); - /// - /// RegExp x Find --> replace (se vettore è | delimited) - /// - protected string regExp_Find = memLayer.ML.cdv("regExp_Find"); - /// - /// RegExp x Replace da Find (se vettore è | delimited) - /// - protected string regExp_Replace = memLayer.ML.cdv("regExp_Replace"); + /// + /// RegExp x RESET / CANCEL + /// + protected string regExp_KO = memLayer.ML.cdv("regExp_KO"); + /// + /// RegExp x CONFERMA + /// + protected string regExp_OK = memLayer.ML.cdv("regExp_OK"); + /// + /// RegExp x START KIT + /// + protected string regExp_KitStart = memLayer.ML.cdv("regExp_KitStart"); + /// + /// RegExp x SAVE KIT + /// + protected string regExp_KitSave = memLayer.ML.cdv("regExp_KitSave"); + /// + /// RegExp x Find --> replace (se vettore è | delimited) + /// + protected string regExp_Find = memLayer.ML.cdv("regExp_Find"); + /// + /// RegExp x Replace da Find (se vettore è | delimited) + /// + protected string regExp_Replace = memLayer.ML.cdv("regExp_Replace"); - #endregion + #endregion - #region variabili in sessione + #region variabili in sessione - /// - /// UID formattato con "_" - /// - public string uid - { - get - { - return this.UniqueID.Replace("$", "_").Replace("-", "_"); - } - } - /// - /// Valore validazione codici ORDINE come STARTING (es: OPR,KIT) - /// - public string codOrdPre - { - get - { - return memLayer.ML.StringSessionObj(string.Format("codOrdPre_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("codOrdPre_{0}", uid), value); - } - } - public string codArt - { - get - { - return memLayer.ML.StringSessionObj(string.Format("codArt_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("codArt_{0}", uid), value); - } - } - public string descArt - { - get - { - return memLayer.ML.StringSessionObj(string.Format("descArt_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("descArt_{0}", uid), value); - } - } - public string kitCode - { - get - { - return memLayer.ML.StringSessionObj(string.Format("kitCode_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("kitCode_{0}", uid), value); - } - } - public string codOrd - { - get - { - return memLayer.ML.StringSessionObj(string.Format("codOrd_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("codOrd_{0}", uid), value); - } - } - public int qta - { - get - { - return memLayer.ML.IntSessionObj(string.Format("qta_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("qta_{0}", uid), value); - } - } - public string idxMacc - { - get - { - return memLayer.ML.StringSessionObj(string.Format("idxMacc_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("idxMacc_{0}", uid), value); - } - } - public string nomeMacc - { - get - { - return memLayer.ML.StringSessionObj(string.Format("nomeMacc_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("nomeMacc_{0}", uid), value); - } - } - public string codGruppo - { - get - { - return memLayer.ML.StringSessionObj(string.Format("codGruppo_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("codGruppo_{0}", uid), value); - } - } - /// - /// Verifica se il cod ordine è OK: - /// coerenza tra ordine e iniziale ordine (OPR/KIT) - /// - public bool checkOrdOk - { - get - { - return codOrd.StartsWith(codOrdPre); - } - } - /// - /// titolo pagina - /// - public string titolo - { - get - { - return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", ""); - } - } - #endregion - #region area protected - - /// - /// dictionary comandi ammessi - /// - protected Dictionary _comandi = new Dictionary(); - /// - /// dictionary dei valori ammessi - /// - protected Dictionary _tabValori = new Dictionary(); - /// - /// oggetto comando locale alla classe - /// - protected SteamWare.inputComando comando - { - get - { - SteamWare.inputComando answ; - if (memLayer.ML.isInSessionObject("barcodeCmd")) + /// + /// Valore validazione codici ORDINE come STARTING (es: OPR,KIT) + /// + public string codOrdPre { - answ = (SteamWare.inputComando)memLayer.ML.objSessionObj("barcodeCmd"); - } - else - { - answ = new SteamWare.inputComando(); - } - return answ; - } - set - { - memLayer.ML.setSessionVal("barcodeCmd", value, false); - } - } - /// - /// oggetto comando locale alla classe - /// - public string rawInput - { - get - { - string answ; - if (memLayer.ML.isInSessionObject("barcodeRaw")) - { - answ = memLayer.ML.StringSessionObj("barcodeRaw"); - } - else - { - answ = ""; - } - return answ; - } - set - { - memLayer.ML.setSessionVal("barcodeRaw", value, false); - } - } - /// - /// al caricamento della pagina... - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - resetData(); - } - - DetectAgent(); - myInitialize(); - } - /// - /// inizializzazione specifica barcode - /// - private void myInitialize() - { - if (!Page.IsPostBack) - { - lblInput.Text = traduci("PregoInserireBarcode"); - comando = new SteamWare.inputComando(); - } - } - - public string BCodeVal - { - get - { - return txtInput.Text.Trim().ToUpper(); - } - set - { - txtInput.Text = value; - } - } - - /// - /// barcode completato con invio... - /// - /// - /// - protected void txtInput_TextChanged(object sender, EventArgs e) - { - processInput(); - } - - public void processInput() - { - comando.isValid = false; - bool gotIt = false; - gotIt = checkComandi(); - if (!gotIt) - { - gotIt = checkMacc(); - } - if (!gotIt) - { - gotIt = checkIntServ(); - } - // ora check globale... - checkParam(); - // verifico se c'è stato input evento - if (comando.isValid) - { - if (comando.currCmdIn != "" || comando.descrComando != "") - { - txtInput2show = comando.descrComando; - } - else - { - txtInput2show = "---"; - } - if (comando.valore != "") - { - txtVal2show = comando.valoreTrad; - } - else - { - txtVal2show = "---"; - } - if (eh_comandoRegistrato != null) - { - eh_comandoRegistrato(this, new EventArgs()); - } - } - else - { - lblInput.Text = traduci("ComandoSconosciuto"); - lblValore.Text = BCodeVal; - comando = new SteamWare.inputComando(); - rawInput = BCodeVal; - if (eh_dataRead != null) - { - eh_dataRead(this, new EventArgs()); - } - } - BCodeVal = ""; - } - - private bool checkComandi() - { - bool answ = false; - // controllo eventuali comandi CUSTOM - if (BCodeVal == regExp_KO) - { - comando.isValid = true; - answ = true; - resetData(); - } - else if (BCodeVal == regExp_KitStart) - { - comando.isValid = true; - answ = true; - resetData(); - } - else if (BCodeVal == regExp_KitSave) - { - comando.isValid = true; - answ = true; - resetData(); - } - else if (BCodeVal == regExp_OK) - { - // comando valido SE ho ordine coerente... - if (checkOrdOk) - { - comando.isValid = true; - // recupero il codGruppo da macchina... (primo) - if (codGruppo == "") - { - var tabAG = DataLayerObj.taAG.getFaseByIdxMacc(idxMacc); - if (tabAG.Rows.Count > 0) + get { - codGruppo = tabAG[0].CodGruppo; + return memLayer.ML.StringSessionObj(string.Format("codOrdPre_{0}", uid)); } - } - // controllo se ho tutti i dati necessari... - if (codOrd != "" && codArt != "" && codGruppo != "" && idxMacc != "" && qta > 0) - { - // recupero TC promessa da ultimo per articolo/macchina - decimal TCiclo = 0; - int pzPallet = 1; - DS_ProdTempi.ODLDataTable tabODL = DataLayerObj.taODL.getByMacchinaArticolo(codArt, idxMacc); - // se non lo trovo prendo da SOLO ARTICOLO - if (tabODL.Rows.Count == 0) + set { - tabODL = DataLayerObj.taODL.getByMacchinaArticolo(codArt, ""); + memLayer.ML.setSessionVal(string.Format("codOrdPre_{0}", uid), value); } - // recupero TCiclo - if (tabODL.Rows.Count > 0) + } + public string codArt + { + get { - TCiclo = tabODL[0].TCAssegnato; - pzPallet = tabODL[0].PzPallet; + return memLayer.ML.StringSessionObj(string.Format("codArt_{0}", uid)); + } + set + { + memLayer.ML.setSessionVal(string.Format("codArt_{0}", uid), value); + } + } + public string descArt + { + get + { + return memLayer.ML.StringSessionObj(string.Format("descArt_{0}", uid)); + } + set + { + memLayer.ML.setSessionVal(string.Format("descArt_{0}", uid), value); + } + } + public string kitCode + { + get + { + return memLayer.ML.StringSessionObj(string.Format("kitCode_{0}", uid)); + } + set + { + memLayer.ML.setSessionVal(string.Format("kitCode_{0}", uid), value); + } + } + public string codOrd + { + get + { + return memLayer.ML.StringSessionObj(string.Format("codOrd_{0}", uid)); + } + set + { + memLayer.ML.setSessionVal(string.Format("codOrd_{0}", uid), value); + } + } + public int qta + { + get + { + return memLayer.ML.IntSessionObj(string.Format("qta_{0}", uid)); + } + set + { + memLayer.ML.setSessionVal(string.Format("qta_{0}", uid), value); + } + } + public string idxMacc + { + get + { + return memLayer.ML.StringSessionObj(string.Format("idxMacc_{0}", uid)); + } + set + { + memLayer.ML.setSessionVal(string.Format("idxMacc_{0}", uid), value); + } + } + public string nomeMacc + { + get + { + return memLayer.ML.StringSessionObj(string.Format("nomeMacc_{0}", uid)); + } + set + { + memLayer.ML.setSessionVal(string.Format("nomeMacc_{0}", uid), value); + } + } + public string codGruppo + { + get + { + return memLayer.ML.StringSessionObj(string.Format("codGruppo_{0}", uid)); + } + set + { + memLayer.ML.setSessionVal(string.Format("codGruppo_{0}", uid), value); + } + } + /// + /// Verifica se il cod ordine è OK: + /// coerenza tra ordine e iniziale ordine (OPR/KIT) + /// + public bool checkOrdOk + { + get + { + return codOrd.StartsWith(codOrdPre); + } + } + + #endregion + + #region area protected + + /// + /// dictionary comandi ammessi + /// + protected Dictionary _comandi = new Dictionary(); + /// + /// dictionary dei valori ammessi + /// + protected Dictionary _tabValori = new Dictionary(); + /// + /// oggetto comando locale alla classe + /// + protected inputComando comando + { + get + { + inputComando answ; + if (memLayer.ML.isInSessionObject("barcodeCmd")) + { + answ = (inputComando)memLayer.ML.objSessionObj("barcodeCmd"); + } + else + { + answ = new inputComando(); + } + return answ; + } + set + { + memLayer.ML.setSessionVal("barcodeCmd", value, false); + } + } + /// + /// oggetto comando locale alla classe + /// + public string rawInput + { + get + { + string answ; + if (memLayer.ML.isInSessionObject("barcodeRaw")) + { + answ = memLayer.ML.StringSessionObj("barcodeRaw"); + } + else + { + answ = ""; + } + return answ; + } + set + { + memLayer.ML.setSessionVal("barcodeRaw", value, false); + } + } + /// + /// al caricamento della pagina... + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + resetData(); + } + + DetectAgent(); + myInitialize(); + } + /// + /// inizializzazione specifica barcode + /// + private void myInitialize() + { + if (!Page.IsPostBack) + { + lblInput.Text = traduci("PregoInserireBarcode"); + comando = new inputComando(); + } + } + + public string BCodeVal + { + get + { + return txtInput.Text.Trim().ToUpper(); + } + set + { + txtInput.Text = value; + } + } + + /// + /// barcode completato con invio... + /// + /// + /// + protected void txtInput_TextChanged(object sender, EventArgs e) + { + processInput(); + } + + public void processInput() + { + comando.isValid = false; + bool gotIt = false; + gotIt = checkComandi(); + if (!gotIt) + { + gotIt = checkMacc(); + } + if (!gotIt) + { + gotIt = checkIntServ(); + } + // ora check globale... + checkParam(); + // verifico se c'è stato input evento + if (comando.isValid) + { + if (comando.currCmdIn != "" || comando.descrComando != "") + { + txtInput2show = comando.descrComando; + } + else + { + txtInput2show = "---"; + } + if (comando.valore != "") + { + txtVal2show = comando.valoreTrad; + } + else + { + txtVal2show = "---"; + } + if (eh_comandoRegistrato != null) + { + eh_comandoRegistrato(this, new EventArgs()); + } } - // se non lo trovo è valore default da config DB (oppure 59...) else { - TCiclo = memLayer.ML.CRI("TCicloStd"); + lblInput.Text = traduci("ComandoSconosciuto"); + lblValore.Text = BCodeVal; + comando = new inputComando(); + rawInput = BCodeVal; + if (eh_dataRead != null) + { + eh_dataRead(this, new EventArgs()); + } } - if (TCiclo == 0) + BCodeVal = ""; + } + + private bool checkComandi() + { + bool answ = false; + // controllo eventuali comandi CUSTOM + if (BCodeVal == regExp_KO) { - TCiclo = 59; + comando.isValid = true; + answ = true; + resetData(); } - // creo nuova PROMESSA ODL... - DataLayerObj.taPODL.insertQuery(codOrd, codOrd, true, codArt, codGruppo, idxMacc, qta, TCiclo, DateTime.Now, 1, pzPallet, descArt); - } - } - // resetto ricaricando - Response.Redirect(titolo); - } - return answ; - } - - private void resetData() - { - // resetto - idxMacc = ""; - nomeMacc = ""; - codArt = ""; - descArt = ""; - codGruppo = ""; - codOrd = ""; - qta = 0; - } - - private bool checkMacc() - { - bool answ = false; - // verifico se il barcode è di una macchina... - var risultato = DataLayerObj.taMacchine.GetByIdx(BCodeVal); - if (risultato.Rows.Count > 0) - { - idxMacc = BCodeVal; - comando.valore = BCodeVal; - comando.isValid = true; - answ = true; - // recupero altri dati - var rRes = risultato[0]; - nomeMacc = rRes.Descrizione; - // imposto il gruppo cercandolo... - var gruppi = DataLayerObj.taAG.getByIdxMacc(BCodeVal); - if (gruppi.Rows.Count > 0) - { - // salvo primo... - codGruppo = gruppi[0].CodGruppo; - } - } - return answ; - } - - /// - /// verifica parametri in sessione x i valori eventualmente da mettere al comando... - /// - private void checkParam() - { - // ho macchina ed articolo? - bool hasAllData = (idxMacc != "" && codArt != ""); - string valOut = ""; - if (codArt != "") - { - valOut += string.Format("{0}
Art: {1} | qta: {2:N0} | kit: {3}
{4}", codOrd, codArt, qta, kitCode, descArt); - } - if (idxMacc != "") - { - valOut += string.Format("
{0} | {1}", idxMacc, nomeMacc); - } - // imposto... - comando.valoreTrad = valOut; - // controllo se ho tutto... - comando.descrComando = ""; - if (idxMacc == "") - { - comando.descrComando += " - Manca Impianto - "; - } - if (codArt == "" || codOrd == "") - { - comando.descrComando += " - Manca Ordine Produzione - "; - } - if (!checkOrdOk) - { - comando.descrComando += " - Tipo Ordine errato - "; - } - if (hasAllData && checkOrdOk) - { - comando.descrComando = "Confermare caricamento"; - } - } - - private bool checkIntServ() - { - bool answ = false; - // IN PRIMIS se c'è in config preprocesso BCode x Find-Replace - string BCodeFilt = BCodeVal; - if (regExp_Find != "") - { - // splitto i vettori - var vettFind = regExp_Find.Split('|'); - var vettRepl = regExp_Replace.Split('|'); - // se ho tanti find quanti replace procedo... - if (vettFind.Length == vettRepl.Length) - { - for (int i = 0; i < vettFind.Length; i++) - { - BCodeFilt = BCodeFilt.Replace(vettFind[i], vettRepl[i]); - } - } - else - { - logger.lg.scriviLog(string.Format("Attenzione: problema in decodifica barcode find/replace, i parametri non corrispondono una volta esplosi i vettori:{0}find: {1}{0}replace: {2}", Environment.NewLine, regExp_Find, regExp_Replace)); - } - } - // cerco esplicitamente sul DB IntegrationServices... - var risultato = DataLayerObj.taIS_TrDati.getOrdini(BCodeFilt); - if (risultato.Rows.Count > 0) - { - var rRes = risultato[0]; - // verifico da config COME decodificare IS... - string BCodeIS_DType = memLayer.ML.cdv("BCodeIS_DType"); - // verifico corrispondano i formati... - if (rRes.DataType == BCodeIS_DType) - { - // cerco i dati e decodifico... togliendo eventuale VETTORE "[..]" - var jsonData = risultato[0].ValueOUT.Replace("[", "").Replace("]", ""); - try - { - if (BCodeIS_DType == "Colcom_Order") + else if (BCodeVal == regExp_KitStart) { - // a seconda del tipo decodifico... - ISTD_OrderColcom currVal = JsonConvert.DeserializeObject(jsonData); - comando.isValid = true; - answ = true; - // salvo ordine / articolo / qta - codOrd = currVal.CodOrdine; - codArt = currVal.CodArticolo; - descArt = currVal.DescrArticolo; - kitCode = currVal.KitCode; - qta = (int)currVal.Qta; - comando.valore = jsonData;// string.Format("{0}#{1}#{2:N0}", codOrd, codArt, qta); - comando.currCmdIn = "OrdArtQta"; + comando.isValid = true; + answ = true; + resetData(); } - } - catch (Exception exc) - { - logger.lg.scriviLog(string.Format("Errore in decodifica obj JSON:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION); - } + else if (BCodeVal == regExp_KitSave) + { + comando.isValid = true; + answ = true; + resetData(); + } + else if (BCodeVal == regExp_OK) + { + // comando valido SE ho ordine coerente... + if (checkOrdOk) + { + comando.isValid = true; + // recupero il codGruppo da macchina... (primo) + if (codGruppo == "") + { + var tabAG = DataLayerObj.taAG.getFaseByIdxMacc(idxMacc); + if (tabAG.Rows.Count > 0) + { + codGruppo = tabAG[0].CodGruppo; + } + } + // controllo se ho tutti i dati necessari... + if (codOrd != "" && codArt != "" && codGruppo != "" && idxMacc != "" && qta > 0) + { + // recupero TC promessa da ultimo per articolo/macchina + decimal TCiclo = 0; + int pzPallet = 1; + DS_ProdTempi.ODLDataTable tabODL = DataLayerObj.taODL.getByMacchinaArticolo(codArt, idxMacc); + // se non lo trovo prendo da SOLO ARTICOLO + if (tabODL.Rows.Count == 0) + { + tabODL = DataLayerObj.taODL.getByMacchinaArticolo(codArt, ""); + } + // recupero TCiclo + if (tabODL.Rows.Count > 0) + { + TCiclo = tabODL[0].TCAssegnato; + pzPallet = tabODL[0].PzPallet; + } + // se non lo trovo è valore default da config DB (oppure 59...) + else + { + TCiclo = memLayer.ML.CRI("TCicloStd"); + } + if (TCiclo == 0) + { + TCiclo = 59; + } + // creo nuova PROMESSA ODL... + DataLayerObj.taPODL.insertQuery(codOrd, codOrd, true, codArt, codGruppo, idxMacc, qta, TCiclo, DateTime.Now, 1, pzPallet, descArt); + } + } + // resetto ricaricando + Response.Redirect(titolo); + } + return answ; } - } - return answ; - } - /// - /// verifico se sia un valore compreso nell'elenco fornito - /// - private void isValore() - { - if (_tabValori.ContainsKey(BCodeVal)) // verifico se il comando digitato esista... - { - comando.isValid = true; - comando.valore = BCodeVal; - _tabValori.TryGetValue(BCodeVal, out comando.valoreTrad); - } - } - /// - /// verifica se il comando inserito sia valido - /// - private void isInputEvent() - { - if (_comandi.ContainsKey(BCodeVal)) // verifico se il comando digitato esista... - { - comando.isValid = true; - // salvo comando precedente (se c'è...) - comando.prevCmdIn = comando.currCmdIn; - comando.descrComandoPrev = comando.descrComando; - comando.currCmdIn = BCodeVal; - _comandi.TryGetValue(BCodeVal, out comando.descrComando); - } - } - /// - /// verifica quale browser usato e applica css corretto al div attorno al box - /// - private void DetectAgent() - { - System.Web.HttpBrowserCapabilities browser = Request.Browser; - if (browser.Browser == "IE") - { - pnlBarcodeBox.CssClass = "barcodeBoxIE"; - } - else - { - pnlBarcodeBox.CssClass = "barcodeBoxOther"; - } - } + private void resetData() + { + // resetto + idxMacc = ""; + nomeMacc = ""; + codArt = ""; + descArt = ""; + codGruppo = ""; + codOrd = ""; + qta = 0; + } + + private bool checkMacc() + { + bool answ = false; + // verifico se il barcode è di una macchina... + var risultato = DataLayerObj.taMacchine.GetByIdx(BCodeVal); + if (risultato.Rows.Count > 0) + { + idxMacc = BCodeVal; + comando.valore = BCodeVal; + comando.isValid = true; + answ = true; + // recupero altri dati + var rRes = risultato[0]; + nomeMacc = rRes.Descrizione; + // imposto il gruppo cercandolo... + var gruppi = DataLayerObj.taAG.getByIdxMacc(BCodeVal); + if (gruppi.Rows.Count > 0) + { + // salvo primo... + codGruppo = gruppi[0].CodGruppo; + } + } + return answ; + } + + /// + /// verifica parametri in sessione x i valori eventualmente da mettere al comando... + /// + private void checkParam() + { + // ho macchina ed articolo? + bool hasAllData = (idxMacc != "" && codArt != ""); + string valOut = ""; + if (codArt != "") + { + valOut += string.Format("{0}
Art: {1} | qta: {2:N0} | kit: {3}
{4}", codOrd, codArt, qta, kitCode, descArt); + } + if (idxMacc != "") + { + valOut += string.Format("
{0} | {1}", idxMacc, nomeMacc); + } + // imposto... + comando.valoreTrad = valOut; + // controllo se ho tutto... + comando.descrComando = ""; + if (idxMacc == "") + { + comando.descrComando += " - Manca Impianto - "; + } + if (codArt == "" || codOrd == "") + { + comando.descrComando += " - Manca Ordine Produzione - "; + } + if (!checkOrdOk) + { + comando.descrComando += " - Tipo Ordine errato - "; + } + if (hasAllData && checkOrdOk) + { + comando.descrComando = "Confermare caricamento"; + } + } + + private bool checkIntServ() + { + bool answ = false; + // IN PRIMIS se c'è in config preprocesso BCode x Find-Replace + string BCodeFilt = BCodeVal; + if (regExp_Find != "") + { + // splitto i vettori + var vettFind = regExp_Find.Split('|'); + var vettRepl = regExp_Replace.Split('|'); + // se ho tanti find quanti replace procedo... + if (vettFind.Length == vettRepl.Length) + { + for (int i = 0; i < vettFind.Length; i++) + { + BCodeFilt = BCodeFilt.Replace(vettFind[i], vettRepl[i]); + } + } + else + { + logger.lg.scriviLog(string.Format("Attenzione: problema in decodifica barcode find/replace, i parametri non corrispondono una volta esplosi i vettori:{0}find: {1}{0}replace: {2}", Environment.NewLine, regExp_Find, regExp_Replace)); + } + } + // cerco esplicitamente sul DB IntegrationServices... + var risultato = DataLayerObj.taIS_TrDati.getOrdini(BCodeFilt); + if (risultato.Rows.Count > 0) + { + var rRes = risultato[0]; + // verifico da config COME decodificare IS... + string BCodeIS_DType = memLayer.ML.cdv("BCodeIS_DType"); + // verifico corrispondano i formati... + if (rRes.DataType == BCodeIS_DType) + { + // cerco i dati e decodifico... togliendo eventuale VETTORE "[..]" + var jsonData = risultato[0].ValueOUT.Replace("[", "").Replace("]", ""); + try + { + if (BCodeIS_DType == "Colcom_Order") + { + // a seconda del tipo decodifico... + ISTD_OrderColcom currVal = JsonConvert.DeserializeObject(jsonData); + comando.isValid = true; + answ = true; + // salvo ordine / articolo / qta + codOrd = currVal.CodOrdine; + codArt = currVal.CodArticolo; + descArt = currVal.DescrArticolo; + kitCode = currVal.KitCode; + qta = (int)currVal.Qta; + comando.valore = jsonData;// string.Format("{0}#{1}#{2:N0}", codOrd, codArt, qta); + comando.currCmdIn = "OrdArtQta"; + } + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Errore in decodifica obj JSON:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION); + } + } + } + return answ; + } + + /// + /// verifico se sia un valore compreso nell'elenco fornito + /// + private void isValore() + { + if (_tabValori.ContainsKey(BCodeVal)) // verifico se il comando digitato esista... + { + comando.isValid = true; + comando.valore = BCodeVal; + _tabValori.TryGetValue(BCodeVal, out comando.valoreTrad); + } + } + /// + /// verifica se il comando inserito sia valido + /// + private void isInputEvent() + { + if (_comandi.ContainsKey(BCodeVal)) // verifico se il comando digitato esista... + { + comando.isValid = true; + // salvo comando precedente (se c'è...) + comando.prevCmdIn = comando.currCmdIn; + comando.descrComandoPrev = comando.descrComando; + comando.currCmdIn = BCodeVal; + _comandi.TryGetValue(BCodeVal, out comando.descrComando); + } + } + /// + /// verifica quale browser usato e applica css corretto al div attorno al box + /// + private void DetectAgent() + { + System.Web.HttpBrowserCapabilities browser = Request.Browser; + if (browser.Browser == "IE") + { + pnlBarcodeBox.CssClass = "barcodeBoxIE"; + } + else + { + pnlBarcodeBox.CssClass = "barcodeBoxOther"; + } + } - #endregion + #endregion - #region area public + #region area public - /// - /// effettua al ettura da sessione del comando cliccato e lo inserisce come fosse barcode - /// - public void loadBtnClickComando() - { - BCodeVal = memLayer.ML.StringSessionObj("btnCmdPress"); - memLayer.ML.emptySessionVal("btnCmdPress"); - processInput(); - } + /// + /// effettua al ettura da sessione del comando cliccato e lo inserisce come fosse barcode + /// + public void loadBtnClickComando() + { + BCodeVal = memLayer.ML.StringSessionObj("btnCmdPress"); + memLayer.ML.emptySessionVal("btnCmdPress"); + processInput(); + } - /// - /// elenco dei comandi riconosciuti - /// - public Dictionary comandiAmmessi - { - get - { - return _comandi; - } - set - { - _comandi = value; - } - } - /// - /// tabella di valori ammissibili - /// - public Dictionary tabValori - { - get - { - return _tabValori; - } - set - { - _tabValori = value; - } - } - /// - /// evento comando registrato - /// - public event EventHandler eh_comandoRegistrato; - /// - /// evento lettura dati (grezza) effettuata - /// - public event EventHandler eh_dataRead; - /// - /// comando registrato dal barcode - /// - public SteamWare.inputComando comandoRegistrato - { - get - { - return comando; - } - } - /// - /// scrive nella label input - /// - public string txtInput2show - { - set - { - lblInput.Text = value; - } - } - /// - /// scrive nella label valore - /// - public string txtVal2show - { - set - { - lblValore.Text = value; - } - } - /// - /// scrive nella label richiesta - /// - public string txtRich2show - { - set - { - lblRichiesta.Text = value; - } - } - /// - /// reset del controllo - /// - public void resetMe() - { - comando = new SteamWare.inputComando(); - txtInput2show = "Prego inserire barcode"; - txtVal2show = ""; - txtRich2show = ""; - } - /// - /// wrapper traduzione termini - /// - /// - /// - public string traduci(string lemma) - { - return user_std.UtSn.Traduci(lemma); - } + /// + /// elenco dei comandi riconosciuti + /// + public Dictionary comandiAmmessi + { + get + { + return _comandi; + } + set + { + _comandi = value; + } + } + /// + /// tabella di valori ammissibili + /// + public Dictionary tabValori + { + get + { + return _tabValori; + } + set + { + _tabValori = value; + } + } + /// + /// evento comando registrato + /// + public event EventHandler eh_comandoRegistrato; + /// + /// evento lettura dati (grezza) effettuata + /// + public event EventHandler eh_dataRead; + /// + /// comando registrato dal barcode + /// + public inputComando comandoRegistrato + { + get + { + return comando; + } + } + /// + /// scrive nella label input + /// + public string txtInput2show + { + set + { + lblInput.Text = value; + } + } + /// + /// scrive nella label valore + /// + public string txtVal2show + { + set + { + lblValore.Text = value; + } + } + /// + /// scrive nella label richiesta + /// + public string txtRich2show + { + set + { + lblRichiesta.Text = value; + } + } + /// + /// reset del controllo + /// + public void resetMe() + { + comando = new inputComando(); + txtInput2show = "Prego inserire barcode"; + txtVal2show = ""; + txtRich2show = ""; + } - #endregion - } + #endregion + } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_fixCal.ascx.cs b/MP-ADM/WebUserControls/mod_fixCal.ascx.cs index d50ca791..57fa0692 100644 --- a/MP-ADM/WebUserControls/mod_fixCal.ascx.cs +++ b/MP-ADM/WebUserControls/mod_fixCal.ascx.cs @@ -1,9 +1,13 @@ using System; -public partial class mod_fixCal : System.Web.UI.UserControl -{ - protected void Page_Load(object sender, EventArgs e) - { +namespace MP_ADM.WebUserControls +{ + public partial class mod_fixCal : BaseUserControl + { + protected void Page_Load(object sender, EventArgs e) + { + + } } } diff --git a/MP-ADM/WebUserControls/mod_fixCal.ascx.designer.cs b/MP-ADM/WebUserControls/mod_fixCal.ascx.designer.cs index cecce86d..2f963c8c 100644 --- a/MP-ADM/WebUserControls/mod_fixCal.ascx.designer.cs +++ b/MP-ADM/WebUserControls/mod_fixCal.ascx.designer.cs @@ -10,23 +10,27 @@ -public partial class mod_fixCal { - - /// - /// TextBox1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox TextBox1; - - /// - /// CalendarExtender1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::AjaxControlToolkit.CalendarExtender CalendarExtender1; -} +namespace MP_ADM.WebUserControls +{ + public partial class mod_fixCal + { + + /// + /// TextBox1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox TextBox1; + + /// + /// CalendarExtender1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::AjaxControlToolkit.CalendarExtender CalendarExtender1; + } +} \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_footer.ascx.cs b/MP-ADM/WebUserControls/mod_footer.ascx.cs index 3ec6be7f..4437812e 100644 --- a/MP-ADM/WebUserControls/mod_footer.ascx.cs +++ b/MP-ADM/WebUserControls/mod_footer.ascx.cs @@ -2,12 +2,12 @@ namespace MP_ADM.WebUserControls { - public partial class mod_footer : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class mod_footer : BaseUserControl { - lblLastUpdt.Text = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); - lblVers.Text = string.Format("v.{0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); + protected void Page_Load(object sender, EventArgs e) + { + lblLastUpdt.Text = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); + lblVers.Text = string.Format("v.{0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); + } } - } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_gestKIT.ascx.cs b/MP-ADM/WebUserControls/mod_gestKIT.ascx.cs index 6dfd25a1..b5bd5759 100644 --- a/MP-ADM/WebUserControls/mod_gestKIT.ascx.cs +++ b/MP-ADM/WebUserControls/mod_gestKIT.ascx.cs @@ -4,266 +4,243 @@ using System; namespace MP_ADM.WebUserControls { - public partial class mod_gestKIT : System.Web.UI.UserControl - { - /// - /// Oggetto datalayer specifico - /// - DataLayer DataLayerObj = new DataLayer(); - - public event EventHandler eh_selKit; - - #region setup VARS - - /// - /// RegExp x RESET / CANCEL - /// - protected string regExp_KO = memLayer.ML.cdv("regExp_KO"); - /// - /// RegExp x CONFERMA - /// - protected string regExp_OK = memLayer.ML.cdv("regExp_OK"); - /// - /// RegExp x START KIT - /// - protected string regExp_KitStart = memLayer.ML.cdv("regExp_KitStart"); - /// - /// RegExp x SAVE KIT - /// - protected string regExp_KitSave = memLayer.ML.cdv("regExp_KitSave"); - - #endregion - - #region variabili in sessione - - /// - /// UID formattato con "_" - /// - public string uid + public partial class mod_gestKIT : BaseUserControl { - get - { - return this.UniqueID.Replace("$", "_").Replace("-", "_"); - } - } - /// - /// titolo pagina - /// - public string titolo - { - get - { - return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", ""); - } - } - public string codKitTemp - { - get - { - return memLayer.ML.StringSessionObj(string.Format("codKitTemp_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("codKitTemp_{0}", uid), value); - hlCodKitTemp.Value = value; - grViewWSK.DataBind(); - } - } - /// - /// Ultimo Codice KIT creato - /// - public string lastKitMade - { - get - { - return memLayer.ML.StringSessionObj("lastKitMade"); - } - set - { - memLayer.ML.setSessionVal("lastKitMade", value); - } - } - /// - /// Aggiunge (in obj OrdineKit) l'ordine coi parametri indicati - /// - /// - /// - /// - /// - /// - public bool addOrdArt(string codOrd, string codArt, string descArt, int qta) - { - bool answ = false; - // verifico di avere un codiceKIT - checkCodKit(); - // salvo info x il cod temporaneo... - DataLayerObj.taWKS.insertQuery(codKitTemp, codOrd, codArt, descArt, qta); - // verifico SE HO un KIT riconosciuto e quindi un CodArt di KIT valido... - string currCodArtKit = "###"; - var TksTab = DataLayerObj.taTKS.GetData(codKitTemp, 1); - bool showPODL = false; - if (TksTab.Rows.Count > 0) - { - // verifico se ho aderenza 100%... - if (TksTab[0].TotalScore == 1) + public event EventHandler eh_selKit; + + #region setup VARS + + /// + /// RegExp x RESET / CANCEL + /// + protected string regExp_KO = memLayer.ML.cdv("regExp_KO"); + /// + /// RegExp x CONFERMA + /// + protected string regExp_OK = memLayer.ML.cdv("regExp_OK"); + /// + /// RegExp x START KIT + /// + protected string regExp_KitStart = memLayer.ML.cdv("regExp_KitStart"); + /// + /// RegExp x SAVE KIT + /// + protected string regExp_KitSave = memLayer.ML.cdv("regExp_KitSave"); + + #endregion + + #region variabili in sessione + + + + public string codKitTemp { - currCodArtKit = TksTab[0].CodArtParent; - showPODL = true; + get + { + return memLayer.ML.StringSessionObj(string.Format("codKitTemp_{0}", uid)); + } + set + { + memLayer.ML.setSessionVal(string.Format("codKitTemp_{0}", uid), value); + hlCodKitTemp.Value = value; + grViewWSK.DataBind(); + } } - } - hfCodArtKit.Value = currCodArtKit; - divPODL.Visible = showPODL; - answ = true; - grViewWSK.DataBind(); - grViewKitSel.DataBind(); - grViewPODL.DataBind(); - grViewIstanzeKIT.DataBind(); - return answ; - } - - #endregion - - /// - /// Caricamento pagina - /// - /// - /// - protected void Page_Load(object sender, EventArgs e) - { - bool OptAdmKitEnabled = memLayer.ML.CRB("OptAdmKitEnabled"); - if (!Page.IsPostBack && OptAdmKitEnabled) - { - doReset(); - } - } - /// - /// Ultimo input registrato - /// - public string lastInput - { - get - { - return hlLastInput.Value; - } - set - { - hlLastInput.Value = value; - } - } - /// - /// Aggiorno controllo secondo ULTIMO input - /// - public void doUpdate() - { - // aggiorno label... - messOut = ""; - // controllo input (reset/inizio o salva...) - if (lastInput == regExp_KO) - { - // resetto dati - doReset(); - messOut = "Effettuato reset!"; - } - else if (lastInput == regExp_KitStart) - { - // resetto dati - doReset(); - messOut = "Inizio configurazione KIT"; - } - else if (lastInput == regExp_KitSave) - { - // controllo SE HO un kit selezionato... - string currCodArtKit = "###"; - var TksTab = DataLayerObj.taTKS.GetData(codKitTemp, 1); - bool showPODL = false; - if (TksTab.Rows.Count > 0) + /// + /// Ultimo Codice KIT creato + /// + public string lastKitMade { - // verifico se ho aderenza 100%... - if (TksTab[0].TotalScore == 1) - { - currCodArtKit = TksTab[0].CodArtParent; - showPODL = true; - } + get + { + return memLayer.ML.StringSessionObj("lastKitMade"); + } + set + { + memLayer.ML.setSessionVal("lastKitMade", value); + } } - if (showPODL) + /// + /// Aggiunge (in obj OrdineKit) l'ordine coi parametri indicati + /// + /// + /// + /// + /// + /// + public bool addOrdArt(string codOrd, string codArt, string descArt, int qta) { - // in questo caso creo istanza! - creazioneIstanzaKit(currCodArtKit); + bool answ = false; + // verifico di avere un codiceKIT + checkCodKit(); + // salvo info x il cod temporaneo... + DataLayerObj.taWKS.insertQuery(codKitTemp, codOrd, codArt, descArt, qta); + // verifico SE HO un KIT riconosciuto e quindi un CodArt di KIT valido... + string currCodArtKit = "###"; + var TksTab = DataLayerObj.taTKS.GetData(codKitTemp, 1); + bool showPODL = false; + if (TksTab.Rows.Count > 0) + { + // verifico se ho aderenza 100%... + if (TksTab[0].TotalScore == 1) + { + currCodArtKit = TksTab[0].CodArtParent; + showPODL = true; + } + } + hfCodArtKit.Value = currCodArtKit; + divPODL.Visible = showPODL; + answ = true; + grViewWSK.DataBind(); + grViewKitSel.DataBind(); + grViewPODL.DataBind(); + grViewIstanzeKIT.DataBind(); + return answ; } - } - else if (lastInput == regExp_OK) - { - } - // ennesimo check cod TEMP - checkCodKit(); - } + #endregion - private void doReset() - { - // elimino eventuali record ODL - DataLayerObj.taWKS.deleteQuery(codKitTemp); - codKitTemp = ""; - divPODL.Visible = false; - checkCodKit(); - } - /// - /// Verifico SE HO un codKit Temporaneo sennò lo creo... - /// - private void checkCodKit() - { - if (codKitTemp == "") - { - // genero un NUOVO cod temp kit... - codKitTemp = string.Format("KIT_{0:yyMMdd_HHmmss}", DateTime.Now); - } - } - - public string messOut - { - set - { - lblOut.Text = value; - } - get - { - return lblOut.Text; - } - } - - protected void grViewKitSel_SelectedIndexChanged(object sender, EventArgs e) - { - // se ho selezionato recupero CHIAVE = CodArticolo del KIT - string CodArtParent = grViewKitSel.SelectedValue.ToString(); - // crea KIT x quel CodArtParent... - creazioneIstanzaKit(CodArtParent); - } - /// - /// Crea una NUOVA istanza KIT - /// - /// CodArt dell'Assieme/KIT - private void creazioneIstanzaKit(string CodArtParent) - { - // calcolo NUOVO codice kit... - var tabKey = DataLayerObj.taIstK.getNewKey(); - if (tabKey.Rows.Count == 1) - { - // stacco un NUOVO codice KIT - lastKitMade = tabKey[0].KeyKit; - // inserisco ISTANZA KIT! - DataLayerObj.taIstK.insertByWKS(lastKitMade, CodArtParent, codKitTemp); - // faccio reset valori WKS... - doReset(); - // ora resetto ordine caricato... - messOut = string.Format("Creato NUOVA P.ODL cod {0} per il KIT {1}", lastKitMade, CodArtParent); - // sollevo evento x impostare lettura KIT a BARCODE (x conferma successiva...) - // sollevo evento nuovo valore... - if (eh_selKit != null) + /// + /// Caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) { - eh_selKit(this, new EventArgs()); + bool OptAdmKitEnabled = memLayer.ML.CRB("OptAdmKitEnabled"); + if (!Page.IsPostBack && OptAdmKitEnabled) + { + doReset(); + } + } + /// + /// Ultimo input registrato + /// + public string lastInput + { + get + { + return hlLastInput.Value; + } + set + { + hlLastInput.Value = value; + } + } + /// + /// Aggiorno controllo secondo ULTIMO input + /// + public void doUpdate() + { + // aggiorno label... + messOut = ""; + // controllo input (reset/inizio o salva...) + if (lastInput == regExp_KO) + { + // resetto dati + doReset(); + messOut = "Effettuato reset!"; + } + else if (lastInput == regExp_KitStart) + { + // resetto dati + doReset(); + messOut = "Inizio configurazione KIT"; + } + else if (lastInput == regExp_KitSave) + { + // controllo SE HO un kit selezionato... + string currCodArtKit = "###"; + var TksTab = DataLayerObj.taTKS.GetData(codKitTemp, 1); + bool showPODL = false; + if (TksTab.Rows.Count > 0) + { + // verifico se ho aderenza 100%... + if (TksTab[0].TotalScore == 1) + { + currCodArtKit = TksTab[0].CodArtParent; + showPODL = true; + } + } + if (showPODL) + { + // in questo caso creo istanza! + creazioneIstanzaKit(currCodArtKit); + } + } + else if (lastInput == regExp_OK) + { + + } + // ennesimo check cod TEMP + checkCodKit(); + } + + private void doReset() + { + // elimino eventuali record ODL + DataLayerObj.taWKS.deleteQuery(codKitTemp); + codKitTemp = ""; + divPODL.Visible = false; + checkCodKit(); + } + /// + /// Verifico SE HO un codKit Temporaneo sennò lo creo... + /// + private void checkCodKit() + { + if (codKitTemp == "") + { + // genero un NUOVO cod temp kit... + codKitTemp = string.Format("KIT_{0:yyMMdd_HHmmss}", DateTime.Now); + } + } + + public string messOut + { + set + { + lblOut.Text = value; + } + get + { + return lblOut.Text; + } + } + + protected void grViewKitSel_SelectedIndexChanged(object sender, EventArgs e) + { + // se ho selezionato recupero CHIAVE = CodArticolo del KIT + string CodArtParent = grViewKitSel.SelectedValue.ToString(); + // crea KIT x quel CodArtParent... + creazioneIstanzaKit(CodArtParent); + } + /// + /// Crea una NUOVA istanza KIT + /// + /// CodArt dell'Assieme/KIT + private void creazioneIstanzaKit(string CodArtParent) + { + // calcolo NUOVO codice kit... + var tabKey = DataLayerObj.taIstK.getNewKey(); + if (tabKey.Rows.Count == 1) + { + // stacco un NUOVO codice KIT + lastKitMade = tabKey[0].KeyKit; + // inserisco ISTANZA KIT! + DataLayerObj.taIstK.insertByWKS(lastKitMade, CodArtParent, codKitTemp); + // faccio reset valori WKS... + doReset(); + // ora resetto ordine caricato... + messOut = string.Format("Creato NUOVA P.ODL cod {0} per il KIT {1}", lastKitMade, CodArtParent); + // sollevo evento x impostare lettura KIT a BARCODE (x conferma successiva...) + // sollevo evento nuovo valore... + if (eh_selKit != null) + { + eh_selKit(this, new EventArgs()); + } + } } - } } - } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_gestPromODL.ascx.cs b/MP-ADM/WebUserControls/mod_gestPromODL.ascx.cs index cafad97d..ff3d2e0a 100644 --- a/MP-ADM/WebUserControls/mod_gestPromODL.ascx.cs +++ b/MP-ADM/WebUserControls/mod_gestPromODL.ascx.cs @@ -7,633 +7,597 @@ using System.Web.UI.WebControls; namespace MP_ADM.WebUserControls { - public partial class mod_gestPromODL : System.Web.UI.UserControl - { - /// - /// Oggetto datalayer specifico - /// - DataLayer DataLayerObj = new DataLayer(); - /// - /// Determina se sia solo readonly il controllo... - /// - public bool readOnly; - /// - /// Chiave PRE selezione tipo richiesta ordine - /// - public string codOrdPre + public partial class mod_gestPromODL : BaseUserControl { - get - { - return hfCodPre.Value.Trim(); - } - set - { - hfCodPre.Value = value; - } - } - /// - /// dimensione pagina - /// - public int pageSize - { - get - { - int answ = 10; - try + /// + /// Determina se sia solo readonly il controllo... + /// + public bool readOnly; + /// + /// Chiave PRE selezione tipo richiesta ordine + /// + public string codOrdPre { - answ = Convert.ToInt32(txtPageSize.Text); + get + { + return hfCodPre.Value.Trim(); + } + set + { + hfCodPre.Value = value; + } } - catch - { } - return answ; - } - set - { - txtPageSize.Text = value.ToString(); - } - } - - /// - /// Abilitazione modifica selettore fase - /// - public bool enableSelFase - { - get - { - return ddlCodGruppo.Enabled; - } - set - { - ddlCodGruppo.Enabled = value; - } - } - /// - /// Gruppo selezionato - /// - public string CodGruppo - { - get - { - return ddlCodGruppo.SelectedValue; - } - set - { - ddlCodGruppo.SelectedValue = value; - } - } - - #region area da NON modificare - - #region area protected - - protected string _idxGridView; - - /// - /// reset della selezione - /// - /// - /// - protected void btnReset_Click(object sender, EventArgs e) - { - resetSelezione(); - } - - /// - /// salvo comando - /// - /// - /// - protected void lbt_Command(object sender, CommandEventArgs e) - { - SteamWare.memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument); - } - /// - /// gestione cambio selezione valore - /// - /// - /// - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - // salvo in session il valore selezionato... - memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false); - bool doClone = false; - bool doEdit = false; - // gestione buttons richieste - string _comando = ""; - if (memLayer.ML.isInSessionObject("nextObjCommand")) - { - _comando = memLayer.ML.StringSessionObj("nextObjCommand"); - memLayer.ML.emptySessionVal("nextObjCommand"); - } - switch (_comando) - { - case "Clona": - doClone = true; - break; - case "Edit": - doEdit = true; - break; - default: - break; - } - if (doClone) - { - memLayer.ML.setSessionVal("idxProm2Clone", grView.SelectedValue, false); - showAddNewPODL(); - mod_newPromessaODL.doSelPODL(); - } - else if (doEdit) - { - memLayer.ML.setSessionVal("idxProm2Edit", grView.SelectedValue, false); - showAddNewPODL(); - mod_newPromessaODL.doSelPODL(); - } - else - { - // mostro edit quantità... - divEditQta.Visible = true; - lbtNewPODL.Visible = true; - mod_newPromessaODL.Visible = false; - var riga = DataLayerObj.taPODL.getByKey(idxPOdlSel)[0]; - numPz = riga.NumPezzi; - pzPallet = riga.PzPallet; - } - } - /// - /// traduce gli header delle colonne - /// - /// - /// - protected void grView_DataBound(object sender, EventArgs e) - { - if (grView.Rows.Count > 0) - { - LinkButton lb; - // aggiorno gli headers - foreach (TableCell cella in grView.HeaderRow.Cells) + /// + /// dimensione pagina + /// + public int pageSize { - try - { - lb = (LinkButton)cella.Controls[0]; - lb.Text = traduci(lb.Text); - } - catch - { } - } - int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); - lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); - } - else - { - lblNumRec.Text = ""; - } - } - /// - /// recupera i dati di un nuovo record contenuti nel footer di un gridView; - /// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...) - /// - /// - /// - protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e) - { - //recupero la riga footer... - DataColumnCollection colonne = colonneObj(); - string nomeCol; - string tipoColonna = ""; - foreach (DataColumn colonna in colonne) - { - nomeCol = colonna.ColumnName; - // cerco un textbox o quello che sia... - if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null) - { - tipoColonna = "textBox"; - } - else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null) - { - tipoColonna = "dropDownList"; - } - else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null) - { - tipoColonna = "checkBox"; - } - else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null) - { - tipoColonna = "selAjax"; - } - // in base al tipo salvo negli inputparameters dell'ODS - switch (tipoColonna) - { - case "textBox": - e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text; - break; - case "dropDownList": - e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue; - break; - case "checkBox": - e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked; - break; - //case "selAjax": - // e.InputParameters[nomeCol] = ((mod_selettore_ajax)grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol))).valore; - // break; - default: - break; - } - tipoColonna = ""; - } - } - /// - /// svuoto da cache post update - /// - /// - /// - protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e) - { - // evento come nuovo... - if (eh_nuovoValore != null) - { - eh_nuovoValore(this, new EventArgs()); - } - } - - #endregion - - #region are public - - /// - /// effettua traduzione del lemma - /// - /// - /// - public string traduci(string lemma) - { - return user_std.UtSn.Traduci(lemma); - } - /// - /// effettua traduzione in inglese del lemma - /// - /// - /// - public string traduciEn(string lemma) - { - return user_std.UtSn.TraduciEn(lemma); - } - /// - /// resetta la selezione dei valori in caso di modifiche su altri controlli - /// - public void resetSelezione() - { - SteamWare.memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView)); - grView.SelectedIndex = -1; - grView.DataBind(); - divEditQta.Visible = false; - mod_newPromessaODL.Visible = false; - lbtNewPODL.Visible = true; - lblWarning.Visible = false; - if (eh_resetSelezione != null) - { - eh_resetSelezione(this, new EventArgs()); - } - - } - #endregion - - #endregion - - #region gestione eventi - - public event EventHandler eh_resetSelezione; - public event EventHandler eh_nuovoValore; - - #endregion - - #region area da modificare - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - if (!Page.IsPostBack) - { - mod_newPromessaODL.Visible = false; - grView.PageSize = pageSize; - // se ho in sessione selezione la recupero... - if (memLayer.ML.isInSessionObject("selFaseBCode") && enableSelFase) - { - ddlCodGruppo.SelectedValue = memLayer.ML.StringSessionObj("selFaseBCode"); - } - } - mod_newPromessaODL.eh_nuovoValore += new EventHandler(mod_newOdl1_eh_nuovoValore); - } - - /// inizializzazione valori di default - ///
- /// - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - _idxGridView = "IdxODL"; - } - /// - /// nuovo valore creato... - /// - /// - /// - void mod_newOdl1_eh_nuovoValore(object sender, EventArgs e) - { - // nascondo controllo e mostro button - mod_newPromessaODL.Visible = false; - lbtNewPODL.Visible = true; - // aggiorno! - resetSelezione(); - } - - /// - /// elenco colonne del datagrid - /// - /// - protected DataColumnCollection colonneObj() - { - DS_ProdTempi.ODLDataTable tabella = new DS_ProdTempi.ODLDataTable(); - DataColumnCollection colonne = tabella.Columns; - return colonne; - } - public bool delEnabled(object _idxOdl) - { - bool answ = false; - int idxOdl = 0; - // controllo non sia già stata iniziata la produzione sennò non posso cancellare... - try - { - idxOdl = Convert.ToInt32(_idxOdl); - answ = (DataLayerObj.taODL.getByIdx(idxOdl, true).Count > 0); - } - catch - { } - return answ; - } - /// - /// mostra creazione nuovo ODL - /// - /// - /// - protected void lbtNewPODL_Click(object sender, EventArgs e) - { - showAddNewPODL(); - } - - private void showAddNewPODL() - { - // mostro controllo creazione ODL - mod_newPromessaODL.Visible = true; - divEditQta.Visible = false; - lbtNewPODL.Visible = false; - grView.SelectedIndex = -1; - grView.DataBind(); - } - - /// - /// formatot url x stampa ODL - /// - /// - /// - public string formattaUrlOdl(object idx) - { - string answ = String.Format(memLayer.ML.CRS("exportFormat1"), Convert.ToInt32(reportRichiesto.SchedaODL), idx); - return answ; - } - - /// - /// cambio dim pagina - /// - /// - /// - protected void txtPageSize_TextChanged(object sender, EventArgs e) - { - grView.PageSize = pageSize; - } - - - /// - /// elimina commento - /// - /// - /// - protected void lbtDel_Click(object sender, EventArgs e) - { - LinkButton imgBtn = (LinkButton)sender; - int IdxProm = 0; - int.TryParse(imgBtn.CommandArgument, out IdxProm); - DataLayerObj.taPODL.deleteQuery(IdxProm); - doUpdate(); - } - - private void doUpdate() - { - grView.DataBind(); - } - - #endregion - - protected void btnOk_Click(object sender, EventArgs e) - { - if (idxPOdlSel > 0) - { - DataLayerObj.taPODL.updateQta(numPz, pzPallet, idxPOdlSel); - } - updateCtrl(); - } - - private void updateCtrl() - { - divEditQta.Visible = false; - grView.SelectedIndex = -1; - grView.DataBind(); - } - /// - /// idxOdl selezionato - /// - protected int idxPOdlSel - { - get - { - int answ = 0; - try - { - answ = Convert.ToInt32(grView.SelectedValue); - } - catch - { } - return answ; - } - } - /// - /// Nuovo num pz - /// - protected int numPz - { - get - { - int answ = 0; - try - { - answ = Convert.ToInt32(txtNewQta.Text.Trim()); - } - catch - { } - return answ; - } - set - { - txtNewQta.Text = value.ToString(); - } - } - /// - /// Nuovo num pz per pallet - /// - protected int pzPallet - { - get - { - int answ = 1; - try - { - answ = Convert.ToInt32(txtNewPzPallet.Text.Trim()); - } - catch - { } - // controllo sia > 0... - if (answ < 1) - { - answ = 1; + get + { + int answ = 10; + try + { + answ = Convert.ToInt32(txtPageSize.Text); + } + catch + { } + return answ; + } + set + { + txtPageSize.Text = value.ToString(); + } } - return answ; - } - set - { - txtNewPzPallet.Text = value.ToString(); - } - } - protected void btnCancel_Click(object sender, EventArgs e) - { - updateCtrl(); - } + /// + /// Abilitazione modifica selettore fase + /// + public bool enableSelFase + { + get + { + return ddlCodGruppo.Enabled; + } + set + { + ddlCodGruppo.Enabled = value; + } + } + /// + /// Gruppo selezionato + /// + public string CodGruppo + { + get + { + return ddlCodGruppo.SelectedValue; + } + set + { + ddlCodGruppo.SelectedValue = value; + } + } - protected void chkUnassigned_CheckedChanged(object sender, EventArgs e) - { - updateGrView(); - } - /// - /// Aggiorno Gridview - /// - private void updateGrView() - { - grView.DataBind(); - } + #region area da NON modificare - /// - /// IdxMacchina filtrata - /// - protected string idxMacc - { - get - { - return lblIdxMacc.Text; - } - set - { - lblIdxMacc.Text = value; - } - } - /// - /// Nome filtrata - /// - protected string NomeMacc - { - get - { - return lblNomeMacc.Text; - } - set - { - lblNomeMacc.Text = value; - } - } - /// - /// CodArt filtrato - /// - protected string CodArt - { - get - { - return lblCodArt.Text; - } - set - { - lblCodArt.Text = value; - } - } - /// - /// CodArt filtrato - /// - protected string DescArt - { - get - { - return lblDescArt.Text; - } - set - { - lblDescArt.Text = value; - } - } + #region area protected - /// - /// Selezionato un condominio --> riporto selezione - /// - /// - /// - protected void lbtSelArt_Click(object sender, EventArgs e) - { - LinkButton lb = (LinkButton)sender; - // imposto articolo, splittando - string[] artData = lb.CommandArgument.Split('|'); - CodArt = artData[0]; - DescArt = artData[1]; - updateGrView(); - } - /// - /// Selezionato un condominio --> riporto selezione - /// - /// - /// - protected void lbtSelMacc_Click(object sender, EventArgs e) - { - LinkButton lb = (LinkButton)sender; - // imposto articolo, splittando - string[] maccData = lb.CommandArgument.Split('|'); - idxMacc = maccData[0]; - NomeMacc = maccData[1]; - updateGrView(); - } + protected string _idxGridView; - protected void lbtResArt_Click(object sender, EventArgs e) - { - CodArt = ""; - DescArt = ""; - updateGrView(); - } + /// + /// reset della selezione + /// + /// + /// + protected void btnReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } - protected void lbtResMacc_Click(object sender, EventArgs e) - { - idxMacc = ""; - NomeMacc = ""; - updateGrView(); - } + /// + /// salvo comando + /// + /// + /// + protected void lbt_Command(object sender, CommandEventArgs e) + { + memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument); + } + /// + /// gestione cambio selezione valore + /// + /// + /// + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + // salvo in session il valore selezionato... + memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false); + bool doClone = false; + bool doEdit = false; + // gestione buttons richieste + string _comando = ""; + if (memLayer.ML.isInSessionObject("nextObjCommand")) + { + _comando = memLayer.ML.StringSessionObj("nextObjCommand"); + memLayer.ML.emptySessionVal("nextObjCommand"); + } + switch (_comando) + { + case "Clona": + doClone = true; + break; + case "Edit": + doEdit = true; + break; + default: + break; + } + if (doClone) + { + memLayer.ML.setSessionVal("idxProm2Clone", grView.SelectedValue, false); + showAddNewPODL(); + mod_newPromessaODL.doSelPODL(); + } + else if (doEdit) + { + memLayer.ML.setSessionVal("idxProm2Edit", grView.SelectedValue, false); + showAddNewPODL(); + mod_newPromessaODL.doSelPODL(); + } + else + { + // mostro edit quantità... + divEditQta.Visible = true; + lbtNewPODL.Visible = true; + mod_newPromessaODL.Visible = false; + var riga = DataLayerObj.taPODL.getByKey(idxPOdlSel)[0]; + numPz = riga.NumPezzi; + pzPallet = riga.PzPallet; + } + } + /// + /// traduce gli header delle colonne + /// + /// + /// + protected void grView_DataBound(object sender, EventArgs e) + { + if (grView.Rows.Count > 0) + { + LinkButton lb; + // aggiorno gli headers + foreach (TableCell cella in grView.HeaderRow.Cells) + { + try + { + lb = (LinkButton)cella.Controls[0]; + lb.Text = traduci(lb.Text); + } + catch + { } + } + int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); + lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); + } + else + { + lblNumRec.Text = ""; + } + } + /// + /// recupera i dati di un nuovo record contenuti nel footer di un gridView; + /// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...) + /// + /// + /// + protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e) + { + //recupero la riga footer... + DataColumnCollection colonne = colonneObj(); + string nomeCol; + string tipoColonna = ""; + foreach (DataColumn colonna in colonne) + { + nomeCol = colonna.ColumnName; + // cerco un textbox o quello che sia... + if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null) + { + tipoColonna = "textBox"; + } + else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null) + { + tipoColonna = "dropDownList"; + } + else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null) + { + tipoColonna = "checkBox"; + } + else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null) + { + tipoColonna = "selAjax"; + } + // in base al tipo salvo negli inputparameters dell'ODS + switch (tipoColonna) + { + case "textBox": + e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text; + break; + case "dropDownList": + e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue; + break; + case "checkBox": + e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked; + break; + //case "selAjax": + // e.InputParameters[nomeCol] = ((mod_selettore_ajax)grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol))).valore; + // break; + default: + break; + } + tipoColonna = ""; + } + } + /// + /// svuoto da cache post update + /// + /// + /// + protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e) + { + raiseNewVal(); + } - protected void ddlCodGruppo_SelectedIndexChanged(object sender, EventArgs e) - { - // salvo in sessione selezione... - memLayer.ML.setSessionVal("selFaseBCode", ddlCodGruppo.SelectedValue); + #endregion + + #region are public + + + /// + /// resetta la selezione dei valori in caso di modifiche su altri controlli + /// + public void resetSelezione() + { + memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView)); + grView.SelectedIndex = -1; + grView.DataBind(); + divEditQta.Visible = false; + mod_newPromessaODL.Visible = false; + lbtNewPODL.Visible = true; + lblWarning.Visible = false; + raiseReset(); + } + #endregion + + #endregion + + #region area da modificare + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + if (!Page.IsPostBack) + { + mod_newPromessaODL.Visible = false; + grView.PageSize = pageSize; + // se ho in sessione selezione la recupero... + if (memLayer.ML.isInSessionObject("selFaseBCode") && enableSelFase) + { + ddlCodGruppo.SelectedValue = memLayer.ML.StringSessionObj("selFaseBCode"); + } + } + mod_newPromessaODL.eh_nuovoValore += new EventHandler(mod_newOdl1_eh_nuovoValore); + } + + /// inizializzazione valori di default + /// + /// + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + _idxGridView = "IdxODL"; + } + /// + /// nuovo valore creato... + /// + /// + /// + void mod_newOdl1_eh_nuovoValore(object sender, EventArgs e) + { + // nascondo controllo e mostro button + mod_newPromessaODL.Visible = false; + lbtNewPODL.Visible = true; + // aggiorno! + resetSelezione(); + } + + /// + /// elenco colonne del datagrid + /// + /// + protected DataColumnCollection colonneObj() + { + DS_ProdTempi.ODLDataTable tabella = new DS_ProdTempi.ODLDataTable(); + DataColumnCollection colonne = tabella.Columns; + return colonne; + } + public bool delEnabled(object _idxOdl) + { + bool answ = false; + int idxOdl = 0; + // controllo non sia già stata iniziata la produzione sennò non posso cancellare... + try + { + idxOdl = Convert.ToInt32(_idxOdl); + answ = (DataLayerObj.taODL.getByIdx(idxOdl, true).Count > 0); + } + catch + { } + return answ; + } + /// + /// mostra creazione nuovo ODL + /// + /// + /// + protected void lbtNewPODL_Click(object sender, EventArgs e) + { + showAddNewPODL(); + } + + private void showAddNewPODL() + { + // mostro controllo creazione ODL + mod_newPromessaODL.Visible = true; + divEditQta.Visible = false; + lbtNewPODL.Visible = false; + grView.SelectedIndex = -1; + grView.DataBind(); + } + + /// + /// formatot url x stampa ODL + /// + /// + /// + public string formattaUrlOdl(object idx) + { + string answ = String.Format(memLayer.ML.CRS("exportFormat1"), Convert.ToInt32(reportRichiesto.SchedaODL), idx); + return answ; + } + + /// + /// cambio dim pagina + /// + /// + /// + protected void txtPageSize_TextChanged(object sender, EventArgs e) + { + grView.PageSize = pageSize; + } + + + /// + /// elimina commento + /// + /// + /// + protected void lbtDel_Click(object sender, EventArgs e) + { + LinkButton imgBtn = (LinkButton)sender; + int IdxProm = 0; + int.TryParse(imgBtn.CommandArgument, out IdxProm); + DataLayerObj.taPODL.deleteQuery(IdxProm); + doUpdate(); + } + + private void doUpdate() + { + grView.DataBind(); + } + + #endregion + + protected void btnOk_Click(object sender, EventArgs e) + { + if (idxPOdlSel > 0) + { + DataLayerObj.taPODL.updateQta(numPz, pzPallet, idxPOdlSel); + } + updateCtrl(); + } + + private void updateCtrl() + { + divEditQta.Visible = false; + grView.SelectedIndex = -1; + grView.DataBind(); + } + /// + /// idxOdl selezionato + /// + protected int idxPOdlSel + { + get + { + int answ = 0; + try + { + answ = Convert.ToInt32(grView.SelectedValue); + } + catch + { } + return answ; + } + } + /// + /// Nuovo num pz + /// + protected int numPz + { + get + { + int answ = 0; + try + { + answ = Convert.ToInt32(txtNewQta.Text.Trim()); + } + catch + { } + return answ; + } + set + { + txtNewQta.Text = value.ToString(); + } + } + /// + /// Nuovo num pz per pallet + /// + protected int pzPallet + { + get + { + int answ = 1; + try + { + answ = Convert.ToInt32(txtNewPzPallet.Text.Trim()); + } + catch + { } + // controllo sia > 0... + if (answ < 1) + { + answ = 1; + } + + return answ; + } + set + { + txtNewPzPallet.Text = value.ToString(); + } + } + protected void btnCancel_Click(object sender, EventArgs e) + { + updateCtrl(); + } + + protected void chkUnassigned_CheckedChanged(object sender, EventArgs e) + { + updateGrView(); + } + /// + /// Aggiorno Gridview + /// + private void updateGrView() + { + grView.DataBind(); + } + + /// + /// IdxMacchina filtrata + /// + protected string idxMacc + { + get + { + return lblIdxMacc.Text; + } + set + { + lblIdxMacc.Text = value; + } + } + /// + /// Nome filtrata + /// + protected string NomeMacc + { + get + { + return lblNomeMacc.Text; + } + set + { + lblNomeMacc.Text = value; + } + } + /// + /// CodArt filtrato + /// + protected string CodArt + { + get + { + return lblCodArt.Text; + } + set + { + lblCodArt.Text = value; + } + } + /// + /// CodArt filtrato + /// + protected string DescArt + { + get + { + return lblDescArt.Text; + } + set + { + lblDescArt.Text = value; + } + } + + /// + /// Selezionato un condominio --> riporto selezione + /// + /// + /// + protected void lbtSelArt_Click(object sender, EventArgs e) + { + LinkButton lb = (LinkButton)sender; + // imposto articolo, splittando + string[] artData = lb.CommandArgument.Split('|'); + CodArt = artData[0]; + DescArt = artData[1]; + updateGrView(); + } + /// + /// Selezionato un condominio --> riporto selezione + /// + /// + /// + protected void lbtSelMacc_Click(object sender, EventArgs e) + { + LinkButton lb = (LinkButton)sender; + // imposto articolo, splittando + string[] maccData = lb.CommandArgument.Split('|'); + idxMacc = maccData[0]; + NomeMacc = maccData[1]; + updateGrView(); + } + + protected void lbtResArt_Click(object sender, EventArgs e) + { + CodArt = ""; + DescArt = ""; + updateGrView(); + } + + protected void lbtResMacc_Click(object sender, EventArgs e) + { + idxMacc = ""; + NomeMacc = ""; + updateGrView(); + } + + protected void ddlCodGruppo_SelectedIndexChanged(object sender, EventArgs e) + { + // salvo in sessione selezione... + memLayer.ML.setSessionVal("selFaseBCode", ddlCodGruppo.SelectedValue); + } } - } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_gestPromODL_OUT.ascx.cs b/MP-ADM/WebUserControls/mod_gestPromODL_OUT.ascx.cs index 84b6e48a..7a9ada12 100644 --- a/MP-ADM/WebUserControls/mod_gestPromODL_OUT.ascx.cs +++ b/MP-ADM/WebUserControls/mod_gestPromODL_OUT.ascx.cs @@ -7,691 +7,656 @@ using System.Web.UI.WebControls; namespace MP_ADM.WebUserControls { - public partial class mod_gestPromODL_OUT : System.Web.UI.UserControl - { - /// - /// Oggetto datalayer specifico - /// - DataLayer DataLayerObj = new DataLayer(); - /// - /// Determina se sia solo readonly il controllo... - /// - public bool readOnly; - /// - /// Chiave PRE selezione tipo richiesta ordine - /// - public string codOrdPre + public partial class mod_gestPromODL_OUT : BaseUserControl { - get - { - return hfCodPre.Value.Trim(); - } - set - { - hfCodPre.Value = value; - } - } - /// - /// dimensione pagina - /// - public int pageSize - { - get - { - int answ = 10; - try + /// + /// Determina se sia solo readonly il controllo... + /// + public bool readOnly; + /// + /// Chiave PRE selezione tipo richiesta ordine + /// + public string codOrdPre { - answ = Convert.ToInt32(txtPageSize.Text); + get + { + return hfCodPre.Value.Trim(); + } + set + { + hfCodPre.Value = value; + } } - catch - { } - return answ; - } - set - { - txtPageSize.Text = value.ToString(); - } - } - - /// - /// Abilitazione modifica selettore fase - /// - public bool enableSelFase - { - get - { - return ddlCodGruppo.Enabled; - } - set - { - ddlCodGruppo.Enabled = value; - } - } - /// - /// Gruppo selezionato - /// - public string CodGruppo - { - get - { - return ddlCodGruppo.SelectedValue; - } - set - { - ddlCodGruppo.SelectedValue = value; - } - } - - #region area da NON modificare - - #region area protected - - protected string _idxGridView; - - /// - /// reset della selezione - /// - /// - /// - protected void btnReset_Click(object sender, EventArgs e) - { - resetSelezione(); - } - - /// - /// salvo comando - /// - /// - /// - protected void lbt_Command(object sender, CommandEventArgs e) - { - SteamWare.memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument); - } - /// - /// gestione cambio selezione valore - /// - /// - /// - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - // salvo in session il valore selezionato... - memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false); - bool doClone = false; - bool doEdit = false; - // gestione buttons richieste - string _comando = ""; - if (memLayer.ML.isInSessionObject("nextObjCommand")) - { - _comando = memLayer.ML.StringSessionObj("nextObjCommand"); - memLayer.ML.emptySessionVal("nextObjCommand"); - } - switch (_comando) - { - case "Clona": - doClone = true; - break; - case "Edit": - doEdit = true; - break; - default: - break; - } - if (doClone) - { - memLayer.ML.setSessionVal("idxProm2Clone", grView.SelectedValue, false); - showAddNewPODL(); - mod_newPromessaODL.doSelPODL(); - } - else if (doEdit) - { - memLayer.ML.setSessionVal("idxProm2Edit", grView.SelectedValue, false); - showAddNewPODL(); - mod_newPromessaODL.doSelPODL(); - } - else - { - // mostro edit quantità... - divEditQta.Visible = true; - lbtNewPODL.Visible = true; - mod_newPromessaODL.Visible = false; - var riga = DataLayerObj.taPODL.getByKey(idxPOdlSel)[0]; - numPz = riga.NumPezzi; - pzPallet = riga.PzPallet; - } - } - /// - /// traduce gli header delle colonne - /// - /// - /// - protected void grView_DataBound(object sender, EventArgs e) - { - if (grView.Rows.Count > 0) - { - LinkButton lb; - // aggiorno gli headers - foreach (TableCell cella in grView.HeaderRow.Cells) + /// + /// dimensione pagina + /// + public int pageSize { - try - { - lb = (LinkButton)cella.Controls[0]; - lb.Text = traduci(lb.Text); - } - catch - { } - } - int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); - lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); - } - else - { - lblNumRec.Text = ""; - } - } - /// - /// recupera i dati di un nuovo record contenuti nel footer di un gridView; - /// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...) - /// - /// - /// - protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e) - { - //recupero la riga footer... - DataColumnCollection colonne = colonneObj(); - string nomeCol; - string tipoColonna = ""; - foreach (DataColumn colonna in colonne) - { - nomeCol = colonna.ColumnName; - // cerco un textbox o quello che sia... - if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null) - { - tipoColonna = "textBox"; - } - else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null) - { - tipoColonna = "dropDownList"; - } - else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null) - { - tipoColonna = "checkBox"; - } - else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null) - { - tipoColonna = "selAjax"; - } - // in base al tipo salvo negli inputparameters dell'ODS - switch (tipoColonna) - { - case "textBox": - e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text; - break; - case "dropDownList": - e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue; - break; - case "checkBox": - e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked; - break; - //case "selAjax": - // e.InputParameters[nomeCol] = ((mod_selettore_ajax)grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol))).valore; - // break; - default: - break; - } - tipoColonna = ""; - } - } - /// - /// svuoto da cache post update - /// - /// - /// - protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e) - { - // evento come nuovo... - if (eh_nuovoValore != null) - { - eh_nuovoValore(this, new EventArgs()); - } - } - - #endregion - - #region are public - - /// - /// effettua traduzione del lemma - /// - /// - /// - public string traduci(string lemma) - { - return user_std.UtSn.Traduci(lemma); - } - /// - /// effettua traduzione in inglese del lemma - /// - /// - /// - public string traduciEn(string lemma) - { - return user_std.UtSn.TraduciEn(lemma); - } - /// - /// resetta la selezione dei valori in caso di modifiche su altri controlli - /// - public void resetSelezione() - { - memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView)); - grView.SelectedIndex = -1; - grView.DataBind(); - divEditQta.Visible = false; - mod_newPromessaODL.Visible = false; - lbtNewPODL.Visible = true; - lblWarning.Visible = false; - if (eh_resetSelezione != null) - { - eh_resetSelezione(this, new EventArgs()); - } - - } - #endregion - - #endregion - - #region gestione eventi - - public event EventHandler eh_resetSelezione; - public event EventHandler eh_nuovoValore; - - #endregion - - #region area da modificare - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - if (!Page.IsPostBack) - { - mod_newPromessaODL.Visible = false; - grView.PageSize = pageSize; - // se ho in sessione selezione la recupero... - if (memLayer.ML.isInSessionObject("selFaseBCode") && enableSelFase) - { - ddlCodGruppo.SelectedValue = memLayer.ML.StringSessionObj("selFaseBCode"); - } - } - mod_newPromessaODL.eh_nuovoValore += new EventHandler(mod_newOdl1_eh_nuovoValore); - } - - /// inizializzazione valori di default - /// - /// - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - _idxGridView = "IdxODL"; - } - /// - /// nuovo valore creato... - /// - /// - /// - void mod_newOdl1_eh_nuovoValore(object sender, EventArgs e) - { - // nascondo controllo e mostro button - mod_newPromessaODL.Visible = false; - lbtNewPODL.Visible = true; - // aggiorno! - resetSelezione(); - } - - /// - /// elenco colonne del datagrid - /// - /// - protected DataColumnCollection colonneObj() - { - MapoDb.DS_ProdTempi.ODLDataTable tabella = new MapoDb.DS_ProdTempi.ODLDataTable(); - DataColumnCollection colonne = tabella.Columns; - return colonne; - } - public bool delEnabled(object _idxOdl) - { - bool answ = false; - int idxOdl = 0; - // controllo non sia già stata iniziata la produzione sennò non posso cancellare... - try - { - idxOdl = Convert.ToInt32(_idxOdl); - answ = (DataLayerObj.taODL.getByIdx(idxOdl, true).Count > 0); - } - catch - { } - return answ; - } - /// - /// mostra creazione nuovo ODL - /// - /// - /// - protected void lbtNewPODL_Click(object sender, EventArgs e) - { - showAddNewPODL(); - } - - private void showAddNewPODL() - { - // mostro controllo creazione ODL - mod_newPromessaODL.Visible = true; - divEditQta.Visible = false; - lbtNewPODL.Visible = false; - grView.SelectedIndex = -1; - grView.DataBind(); - } - - /// - /// formatot url x stampa ODL - /// - /// - /// - public string formattaUrlOdl(object idx) - { - string answ = String.Format(memLayer.ML.CRS("exportFormat1"), Convert.ToInt32(reportRichiesto.SchedaODL), idx); - return answ; - } - - /// - /// cambio dim pagina - /// - /// - /// - protected void txtPageSize_TextChanged(object sender, EventArgs e) - { - grView.PageSize = pageSize; - } - - - /// - /// elimina commento - /// - /// - /// - protected void lbtDel_Click(object sender, EventArgs e) - { - LinkButton imgBtn = (LinkButton)sender; - int IdxProm = 0; - int.TryParse(imgBtn.CommandArgument, out IdxProm); - DataLayerObj.taPODL.deleteQuery(IdxProm); - doUpdate(); - } - - protected void doUpdate() - { - updateGrView(); - } - - #endregion - - protected void btnOk_Click(object sender, EventArgs e) - { - if (idxPOdlSel > 0) - { - DataLayerObj.taPODL.updateQta(numPz, pzPallet, idxPOdlSel); - } - updateCtrl(); - } - - private void updateCtrl() - { - divEditQta.Visible = false; - grView.SelectedIndex = -1; - grView.DataBind(); - } - /// - /// idxOdl selezionato - /// - protected int idxPOdlSel - { - get - { - int answ = 0; - try - { - answ = Convert.ToInt32(grView.SelectedValue); - } - catch - { } - return answ; - } - } - /// - /// Nuovo num pz - /// - protected int numPz - { - get - { - int answ = 0; - try - { - answ = Convert.ToInt32(txtNewQta.Text.Trim()); - } - catch - { } - return answ; - } - set - { - txtNewQta.Text = value.ToString(); - } - } - /// - /// Nuovo num pz per pallet - /// - protected int pzPallet - { - get - { - int answ = 1; - try - { - answ = Convert.ToInt32(txtNewPzPallet.Text.Trim()); - } - catch - { } - // controllo sia > 0... - if (answ < 1) - { - answ = 1; + get + { + int answ = 10; + try + { + answ = Convert.ToInt32(txtPageSize.Text); + } + catch + { } + return answ; + } + set + { + txtPageSize.Text = value.ToString(); + } } - return answ; - } - set - { - txtNewPzPallet.Text = value.ToString(); - } - } - protected void btnCancel_Click(object sender, EventArgs e) - { - updateCtrl(); - } + /// + /// Abilitazione modifica selettore fase + /// + public bool enableSelFase + { + get + { + return ddlCodGruppo.Enabled; + } + set + { + ddlCodGruppo.Enabled = value; + } + } + /// + /// Gruppo selezionato + /// + public string CodGruppo + { + get + { + return ddlCodGruppo.SelectedValue; + } + set + { + ddlCodGruppo.SelectedValue = value; + } + } - protected void chkUnassigned_CheckedChanged(object sender, EventArgs e) - { - updateGrView(); - } - /// - /// Aggiorno Gridview - /// - private void updateGrView() - { - grView.DataBind(); - } - /// - /// IdxMacchina filtrata - /// - protected string idxMacc - { - get - { - return lblIdxMacc.Text; - } - set - { - lblIdxMacc.Text = value; - } - } - /// - /// Nome filtrata - /// - protected string NomeMacc - { - get - { - return lblNomeMacc.Text; - } - set - { - lblNomeMacc.Text = value; - } - } - /// - /// CodArt filtrato - /// - protected string CodArt - { - get - { - return lblCodArt.Text; - } - set - { - lblCodArt.Text = value; - } - } - /// - /// CodArt filtrato - /// - protected string DescArt - { - get - { - return lblDescArt.Text; - } - set - { - lblDescArt.Text = value; - } - } + #region area da NON modificare - /// - /// Selezionato un condominio --> riporto selezione - /// - /// - /// - protected void lbtSelArt_Click(object sender, EventArgs e) - { - LinkButton lb = (LinkButton)sender; - // imposto articolo, splittando - string[] artData = lb.CommandArgument.Split('|'); - CodArt = artData[0]; - DescArt = artData[1]; - updateGrView(); - } - /// - /// Selezionato un condominio --> riporto selezione - /// - /// - /// - protected void lbtSelMacc_Click(object sender, EventArgs e) - { - LinkButton lb = (LinkButton)sender; - // imposto articolo, splittando - string[] maccData = lb.CommandArgument.Split('|'); - idxMacc = maccData[0]; - NomeMacc = maccData[1]; - updateGrView(); - } + #region area protected - /// - /// Richiesto abbassamento priorità = ANTICIPA - /// - /// - /// - protected void lnkMoveDown_Click(object sender, EventArgs e) - { - LinkButton lb = (LinkButton)sender; - // imposto articolo, splittando - int IdxPromessa = 0; - int.TryParse(lb.CommandArgument, out IdxPromessa); - // chiamo stored - DataLayerObj.taPromOut.movePrio(IdxPromessa, -1); - //update! - updateGrView(); - } - /// - /// Richiesto aumento priorità = RITARDA - /// - /// - /// - protected void lnkMoveUp_Click(object sender, EventArgs e) - { - LinkButton lb = (LinkButton)sender; - // imposto articolo, splittando - int IdxPromessa = 0; - int.TryParse(lb.CommandArgument, out IdxPromessa); - // chiamo stored - DataLayerObj.taPromOut.movePrio(IdxPromessa, 1); - //update! - updateGrView(); - } + protected string _idxGridView; + + /// + /// reset della selezione + /// + /// + /// + protected void btnReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + + /// + /// salvo comando + /// + /// + /// + protected void lbt_Command(object sender, CommandEventArgs e) + { + memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument); + } + /// + /// gestione cambio selezione valore + /// + /// + /// + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + // salvo in session il valore selezionato... + memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false); + bool doClone = false; + bool doEdit = false; + // gestione buttons richieste + string _comando = ""; + if (memLayer.ML.isInSessionObject("nextObjCommand")) + { + _comando = memLayer.ML.StringSessionObj("nextObjCommand"); + memLayer.ML.emptySessionVal("nextObjCommand"); + } + switch (_comando) + { + case "Clona": + doClone = true; + break; + case "Edit": + doEdit = true; + break; + default: + break; + } + if (doClone) + { + memLayer.ML.setSessionVal("idxProm2Clone", grView.SelectedValue, false); + showAddNewPODL(); + mod_newPromessaODL.doSelPODL(); + } + else if (doEdit) + { + memLayer.ML.setSessionVal("idxProm2Edit", grView.SelectedValue, false); + showAddNewPODL(); + mod_newPromessaODL.doSelPODL(); + } + else + { + // mostro edit quantità... + divEditQta.Visible = true; + lbtNewPODL.Visible = true; + mod_newPromessaODL.Visible = false; + var riga = DataLayerObj.taPODL.getByKey(idxPOdlSel)[0]; + numPz = riga.NumPezzi; + pzPallet = riga.PzPallet; + } + } + /// + /// traduce gli header delle colonne + /// + /// + /// + protected void grView_DataBound(object sender, EventArgs e) + { + if (grView.Rows.Count > 0) + { + LinkButton lb; + // aggiorno gli headers + foreach (TableCell cella in grView.HeaderRow.Cells) + { + try + { + lb = (LinkButton)cella.Controls[0]; + lb.Text = traduci(lb.Text); + } + catch + { } + } + int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1); + lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord); + } + else + { + lblNumRec.Text = ""; + } + } + /// + /// recupera i dati di un nuovo record contenuti nel footer di un gridView; + /// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...) + /// + /// + /// + protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e) + { + //recupero la riga footer... + DataColumnCollection colonne = colonneObj(); + string nomeCol; + string tipoColonna = ""; + foreach (DataColumn colonna in colonne) + { + nomeCol = colonna.ColumnName; + // cerco un textbox o quello che sia... + if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null) + { + tipoColonna = "textBox"; + } + else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null) + { + tipoColonna = "dropDownList"; + } + else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null) + { + tipoColonna = "checkBox"; + } + else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null) + { + tipoColonna = "selAjax"; + } + // in base al tipo salvo negli inputparameters dell'ODS + switch (tipoColonna) + { + case "textBox": + e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text; + break; + case "dropDownList": + e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue; + break; + case "checkBox": + e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked; + break; + //case "selAjax": + // e.InputParameters[nomeCol] = ((mod_selettore_ajax)grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol))).valore; + // break; + default: + break; + } + tipoColonna = ""; + } + } + /// + /// svuoto da cache post update + /// + /// + /// + protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e) + { + raiseNewVal(); + } + + #endregion + + #region are public + + /// + /// resetta la selezione dei valori in caso di modifiche su altri controlli + /// + public void resetSelezione() + { + memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView)); + grView.SelectedIndex = -1; + grView.DataBind(); + divEditQta.Visible = false; + mod_newPromessaODL.Visible = false; + lbtNewPODL.Visible = true; + lblWarning.Visible = false; + raiseReset(); + } + #endregion + + #endregion - protected void lbtResArt_Click(object sender, EventArgs e) - { - CodArt = ""; - DescArt = ""; - updateGrView(); - } - protected void lbtResMacc_Click(object sender, EventArgs e) - { - idxMacc = ""; - NomeMacc = ""; - updateGrView(); - } + #region area da modificare - protected void ddlCodGruppo_SelectedIndexChanged(object sender, EventArgs e) - { - // salvo in sessione selezione... - memLayer.ML.setSessionVal("selFaseBCode", ddlCodGruppo.SelectedValue); + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + if (!Page.IsPostBack) + { + mod_newPromessaODL.Visible = false; + grView.PageSize = pageSize; + // se ho in sessione selezione la recupero... + if (memLayer.ML.isInSessionObject("selFaseBCode") && enableSelFase) + { + ddlCodGruppo.SelectedValue = memLayer.ML.StringSessionObj("selFaseBCode"); + } + } + mod_newPromessaODL.eh_nuovoValore += new EventHandler(mod_newOdl1_eh_nuovoValore); + } + + /// inizializzazione valori di default + /// + /// + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + _idxGridView = "IdxODL"; + } + /// + /// nuovo valore creato... + /// + /// + /// + void mod_newOdl1_eh_nuovoValore(object sender, EventArgs e) + { + // nascondo controllo e mostro button + mod_newPromessaODL.Visible = false; + lbtNewPODL.Visible = true; + // aggiorno! + resetSelezione(); + } + + /// + /// elenco colonne del datagrid + /// + /// + protected DataColumnCollection colonneObj() + { + MapoDb.DS_ProdTempi.ODLDataTable tabella = new MapoDb.DS_ProdTempi.ODLDataTable(); + DataColumnCollection colonne = tabella.Columns; + return colonne; + } + public bool delEnabled(object _idxOdl) + { + bool answ = false; + int idxOdl = 0; + // controllo non sia già stata iniziata la produzione sennò non posso cancellare... + try + { + idxOdl = Convert.ToInt32(_idxOdl); + answ = (DataLayerObj.taODL.getByIdx(idxOdl, true).Count > 0); + } + catch + { } + return answ; + } + /// + /// mostra creazione nuovo ODL + /// + /// + /// + protected void lbtNewPODL_Click(object sender, EventArgs e) + { + showAddNewPODL(); + } + + private void showAddNewPODL() + { + // mostro controllo creazione ODL + mod_newPromessaODL.Visible = true; + divEditQta.Visible = false; + lbtNewPODL.Visible = false; + grView.SelectedIndex = -1; + grView.DataBind(); + } + + /// + /// formatot url x stampa ODL + /// + /// + /// + public string formattaUrlOdl(object idx) + { + string answ = String.Format(memLayer.ML.CRS("exportFormat1"), Convert.ToInt32(reportRichiesto.SchedaODL), idx); + return answ; + } + + /// + /// cambio dim pagina + /// + /// + /// + protected void txtPageSize_TextChanged(object sender, EventArgs e) + { + grView.PageSize = pageSize; + } + + + /// + /// elimina commento + /// + /// + /// + protected void lbtDel_Click(object sender, EventArgs e) + { + LinkButton imgBtn = (LinkButton)sender; + int IdxProm = 0; + int.TryParse(imgBtn.CommandArgument, out IdxProm); + DataLayerObj.taPODL.deleteQuery(IdxProm); + doUpdate(); + } + + protected void doUpdate() + { + updateGrView(); + } + + #endregion + + protected void btnOk_Click(object sender, EventArgs e) + { + if (idxPOdlSel > 0) + { + DataLayerObj.taPODL.updateQta(numPz, pzPallet, idxPOdlSel); + } + updateCtrl(); + } + + private void updateCtrl() + { + divEditQta.Visible = false; + grView.SelectedIndex = -1; + grView.DataBind(); + } + /// + /// idxOdl selezionato + /// + protected int idxPOdlSel + { + get + { + int answ = 0; + try + { + answ = Convert.ToInt32(grView.SelectedValue); + } + catch + { } + return answ; + } + } + /// + /// Nuovo num pz + /// + protected int numPz + { + get + { + int answ = 0; + try + { + answ = Convert.ToInt32(txtNewQta.Text.Trim()); + } + catch + { } + return answ; + } + set + { + txtNewQta.Text = value.ToString(); + } + } + /// + /// Nuovo num pz per pallet + /// + protected int pzPallet + { + get + { + int answ = 1; + try + { + answ = Convert.ToInt32(txtNewPzPallet.Text.Trim()); + } + catch + { } + // controllo sia > 0... + if (answ < 1) + { + answ = 1; + } + + return answ; + } + set + { + txtNewPzPallet.Text = value.ToString(); + } + } + protected void btnCancel_Click(object sender, EventArgs e) + { + updateCtrl(); + } + + protected void chkUnassigned_CheckedChanged(object sender, EventArgs e) + { + updateGrView(); + } + /// + /// Aggiorno Gridview + /// + private void updateGrView() + { + grView.DataBind(); + } + /// + /// IdxMacchina filtrata + /// + protected string idxMacc + { + get + { + return lblIdxMacc.Text; + } + set + { + lblIdxMacc.Text = value; + } + } + /// + /// Nome filtrata + /// + protected string NomeMacc + { + get + { + return lblNomeMacc.Text; + } + set + { + lblNomeMacc.Text = value; + } + } + /// + /// CodArt filtrato + /// + protected string CodArt + { + get + { + return lblCodArt.Text; + } + set + { + lblCodArt.Text = value; + } + } + /// + /// CodArt filtrato + /// + protected string DescArt + { + get + { + return lblDescArt.Text; + } + set + { + lblDescArt.Text = value; + } + } + + /// + /// Selezionato un condominio --> riporto selezione + /// + /// + /// + protected void lbtSelArt_Click(object sender, EventArgs e) + { + LinkButton lb = (LinkButton)sender; + // imposto articolo, splittando + string[] artData = lb.CommandArgument.Split('|'); + CodArt = artData[0]; + DescArt = artData[1]; + updateGrView(); + } + /// + /// Selezionato un condominio --> riporto selezione + /// + /// + /// + protected void lbtSelMacc_Click(object sender, EventArgs e) + { + LinkButton lb = (LinkButton)sender; + // imposto articolo, splittando + string[] maccData = lb.CommandArgument.Split('|'); + idxMacc = maccData[0]; + NomeMacc = maccData[1]; + updateGrView(); + } + + /// + /// Richiesto abbassamento priorità = ANTICIPA + /// + /// + /// + protected void lnkMoveDown_Click(object sender, EventArgs e) + { + LinkButton lb = (LinkButton)sender; + // imposto articolo, splittando + int IdxPromessa = 0; + int.TryParse(lb.CommandArgument, out IdxPromessa); + // chiamo stored + DataLayerObj.taPromOut.movePrio(IdxPromessa, -1); + //update! + updateGrView(); + } + /// + /// Richiesto aumento priorità = RITARDA + /// + /// + /// + protected void lnkMoveUp_Click(object sender, EventArgs e) + { + LinkButton lb = (LinkButton)sender; + // imposto articolo, splittando + int IdxPromessa = 0; + int.TryParse(lb.CommandArgument, out IdxPromessa); + // chiamo stored + DataLayerObj.taPromOut.movePrio(IdxPromessa, 1); + //update! + updateGrView(); + } + + + protected void lbtResArt_Click(object sender, EventArgs e) + { + CodArt = ""; + DescArt = ""; + updateGrView(); + } + + protected void lbtResMacc_Click(object sender, EventArgs e) + { + idxMacc = ""; + NomeMacc = ""; + updateGrView(); + } + + protected void ddlCodGruppo_SelectedIndexChanged(object sender, EventArgs e) + { + // salvo in sessione selezione... + memLayer.ML.setSessionVal("selFaseBCode", ddlCodGruppo.SelectedValue); + } + /// + /// Verifica se sia permesso cambio priorità (NON può andare a 0 ne oltre il max x macchina) + /// + /// + /// + /// + /// + public bool checkChgPrio(string IdxMacchina, string priorStr, int delta) + { + bool answ = false; + int priorita = 0; + int.TryParse(priorStr, out priorita); + // calcolo i limiti priorità x macchina (0 --> max x macchina)... LPI/LPS liminte priorità inferiore / superiore + int LPI = 1; + int LPS = 1; + var tabella = DataLayerObj.taPromOut.getMaxPrioByMacc(IdxMacchina, true); + if (tabella.Rows.Count > 0) + { + LPS = tabella[0].Priorita; + } + // è ok SE sono ENTRO i 2 limiti + answ = ((priorita + delta) >= LPI && (priorita + delta) <= LPS); + //return + return answ; + } } - /// - /// Verifica se sia permesso cambio priorità (NON può andare a 0 ne oltre il max x macchina) - /// - /// - /// - /// - /// - public bool checkChgPrio(string IdxMacchina, string priorStr, int delta) - { - bool answ = false; - int priorita = 0; - int.TryParse(priorStr, out priorita); - // calcolo i limiti priorità x macchina (0 --> max x macchina)... LPI/LPS liminte priorità inferiore / superiore - int LPI = 1; - int LPS = 1; - var tabella = DataLayerObj.taPromOut.getMaxPrioByMacc(IdxMacchina, true); - if (tabella.Rows.Count > 0) - { - LPS = tabella[0].Priorita; - } - // è ok SE sono ENTRO i 2 limiti - answ = ((priorita + delta) >= LPI && (priorita + delta) <= LPS); - //return - return answ; - } - } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_gestioneDatiMacchine.ascx.cs b/MP-ADM/WebUserControls/mod_gestioneDatiMacchine.ascx.cs index 7e40fd57..0c0e7da8 100644 --- a/MP-ADM/WebUserControls/mod_gestioneDatiMacchine.ascx.cs +++ b/MP-ADM/WebUserControls/mod_gestioneDatiMacchine.ascx.cs @@ -5,7 +5,7 @@ using System.Web.UI.WebControls; namespace MP_ADM.WebUserControls { - public partial class mod_gestioneDatiMacchine : System.Web.UI.UserControl + public partial class mod_gestioneDatiMacchine : BaseUserControl { #region area da NON modificare @@ -31,12 +31,8 @@ namespace MP_ADM.WebUserControls protected void grView_SelectedIndexChanged(object sender, EventArgs e) { // salvo in session il valore selezionato... - SteamWare.memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false); - // sollevo evento nuovo valore... - if (eh_selValore != null) - { - eh_selValore(this, new EventArgs()); - } + memLayer.ML.setSessionVal(string.Format("{0}_sel", _idxGridView), grView.SelectedValue, false); + raiseSelNew(); } /// /// traduce gli header delle colonne @@ -127,61 +123,29 @@ namespace MP_ADM.WebUserControls /// protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e) { - // evento come nuovo... - if (eh_nuovoValore != null) - { - eh_nuovoValore(this, new EventArgs()); - } + raiseNewVal(); } #endregion #region are public - /// - /// effettua traduzione del lemma - /// - /// - /// - public string traduci(string lemma) - { - return user_std.UtSn.Traduci(lemma); - } - /// - /// effettua traduzione in inglese del lemma - /// - /// - /// - public string traduciEn(string lemma) - { - return user_std.UtSn.TraduciEn(lemma); - } /// /// resetta la selezione dei valori in caso di modifiche su altri controlli /// public void resetSelezione() { - SteamWare.memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView)); + memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView)); grView.SelectedIndex = -1; grView.DataBind(); lblWarning.Visible = false; - if (eh_resetSelezione != null) - { - eh_resetSelezione(this, new EventArgs()); - } + raiseReset(); } #endregion #endregion - #region gestione eventi - - public event EventHandler eh_resetSelezione; - public event EventHandler eh_nuovoValore; - public event EventHandler eh_selValore; - - #endregion #region area da modificare diff --git a/MP-ADM/WebUserControls/mod_gestioneODL.ascx.designer.cs b/MP-ADM/WebUserControls/mod_gestioneODL.ascx.designer.cs index b849dfd2..ebdcc1d7 100644 --- a/MP-ADM/WebUserControls/mod_gestioneODL.ascx.designer.cs +++ b/MP-ADM/WebUserControls/mod_gestioneODL.ascx.designer.cs @@ -84,7 +84,7 @@ namespace MP_ADM.WebUserControls /// Campo generato automaticamente. /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. /// - protected global::MoonPro_site.WebUserControls.mod_newOdl mod_newOdl1; + protected global::MP_ADM.WebUserControls.mod_newOdl mod_newOdl1; /// /// Controllo divEditQta. diff --git a/MP-ADM/WebUserControls/mod_login.ascx.cs b/MP-ADM/WebUserControls/mod_login.ascx.cs index 15a60cca..7f021b71 100644 --- a/MP-ADM/WebUserControls/mod_login.ascx.cs +++ b/MP-ADM/WebUserControls/mod_login.ascx.cs @@ -120,7 +120,7 @@ namespace MP_ADM.WebUserControls bool _allowForceUser = false; try { - _allowForceUser = SteamWare.memLayer.ML.CRB("_allowForceUser"); + _allowForceUser = memLayer.ML.CRB("_allowForceUser"); } catch { @@ -146,7 +146,7 @@ namespace MP_ADM.WebUserControls else { lblMessage.Text = String.Format("{0}
key not allowed for operation!! operation logged!!", user_std.UtSn.Traduci("AccessFail")); - mandaEmail(_fromEmail, _adminEmail, "Attenzione: tentativo di accesso non autorizzato!", String.Format("Tentativo di forcing user non autorizzato!
L'utente {0} ha tentato di accedere a {1} forzando l'utente ma la sua key autorizzativa e' sbagliata...", Page.User.Identity.Name, user_std.UtSn.Traduci(SteamWare.memLayer.ML.CRS("defaultApp")))); + mandaEmail(_fromEmail, _adminEmail, "Attenzione: tentativo di accesso non autorizzato!", String.Format("Tentativo di forcing user non autorizzato!
L'utente {0} ha tentato di accedere a {1} forzando l'utente ma la sua key autorizzativa e' sbagliata...", Page.User.Identity.Name, user_std.UtSn.Traduci(memLayer.ML.CRS("defaultApp")))); string _rigaLog = String.Format("User {0}\t tried to force user - wrong password - he tried to log as \t {1}\\{2}", Page.User.Identity.Name, dominio.Text, user.Text); SteamWare.logger.lg.scriviLog(_rigaLog, SteamWare.tipoLog.WARNING); if (Login_Error != null) @@ -157,7 +157,7 @@ namespace MP_ADM.WebUserControls } else { - mandaEmail(_fromEmail, _adminEmail, "Attenzione: tentativo di accesso non autorizzato!", String.Format("Tentativo di forcing user non autorizzato!
L'utente {0} ha tentato di accedere a {1} forzando l'utente ma la funzione e' disabilitata...", Page.User.Identity.Name, user_std.UtSn.Traduci(SteamWare.memLayer.ML.CRS("defaultApp")))); + mandaEmail(_fromEmail, _adminEmail, "Attenzione: tentativo di accesso non autorizzato!", String.Format("Tentativo di forcing user non autorizzato!
L'utente {0} ha tentato di accedere a {1} forzando l'utente ma la funzione e' disabilitata...", Page.User.Identity.Name, user_std.UtSn.Traduci(memLayer.ML.CRS("defaultApp")))); string _rigaLog = String.Format("User {0}\t tried to force user - access disabled - he tried to log as \t {1}\\{2}", Page.User.Identity.Name, dominio.Text, user.Text); SteamWare.logger.lg.scriviLog(_rigaLog, SteamWare.tipoLog.WARNING); if (Login_Error != null) @@ -187,7 +187,7 @@ namespace MP_ADM.WebUserControls bool _allowForceUser = false; try { - _allowForceUser = SteamWare.memLayer.ML.CRB("_allowForceUser"); + _allowForceUser = memLayer.ML.CRB("_allowForceUser"); } catch { @@ -216,7 +216,7 @@ namespace MP_ADM.WebUserControls } else { - mandaEmail(_fromEmail, _adminEmail, "Attenzione: tentativo di accesso non autorizzato!", String.Format("Tentativo di forcing user non autorizzato!
L'utente {0} ha tentato di accedere a {1} forzando l'utente ma la funzione e' disabilitata...", Page.User.Identity.Name, user_std.UtSn.Traduci(SteamWare.memLayer.ML.CRS("defaultApp")))); + mandaEmail(_fromEmail, _adminEmail, "Attenzione: tentativo di accesso non autorizzato!", String.Format("Tentativo di forcing user non autorizzato!
L'utente {0} ha tentato di accedere a {1} forzando l'utente ma la funzione e' disabilitata...", Page.User.Identity.Name, user_std.UtSn.Traduci(memLayer.ML.CRS("defaultApp")))); string _rigaLog = String.Format("User {0}\t tried to force user - access disabled - he tried to log as \t {1}", Page.User.Identity.Name, ddlStdUser.SelectedValue); SteamWare.logger.lg.scriviLog(_rigaLog, SteamWare.tipoLog.WARNING); if (Login_Error != null) diff --git a/MP-ADM/WebUserControls/mod_main_help.ascx b/MP-ADM/WebUserControls/mod_main_help.ascx index 9bf29586..2b7b86ec 100644 --- a/MP-ADM/WebUserControls/mod_main_help.ascx +++ b/MP-ADM/WebUserControls/mod_main_help.ascx @@ -1,91 +1,91 @@ <%@ Control Language="C#" AutoEventWireup="true" Inherits="mod_main_help" CodeBehind="mod_main_help.ascx.cs" %>
-
- +
+
<%: traduci("btnAnagArticoli") %>
-
-
-
- + +
+
+
<%: traduci("btnGestPromesseOdl") %>
-
-
-
- + +
+
+
<%: traduci("btnGestOdl") %>
-
-
-
- + +
+
+
<%: traduci("btnGestDatiMacchina") %>
-
-
-
-
+
+
+
+
<%: traduci("btnApprovaTC") %>
-
-
-
- + +
+
+
<%: traduci("btnApprovaProd") %>
-
-
-
- + +
+
+
<%: traduci("btnBCode") %>
-
-
-
- + +
+
+
<%: traduci("btnGestKIT") %>
-
-
-
- + +
+
+
<%: traduci("btnPlanner") %>
-
-
-
- + +
+
+
<%: traduci("btnDataImport") %>
-
-
-
- + +
+
+
<%: traduci("btnBCodeCTrack") %>
-
-
+
+
diff --git a/MP-ADM/WebUserControls/mod_menuBottom.ascx.cs b/MP-ADM/WebUserControls/mod_menuBottom.ascx.cs index ce6f9f0b..c7648a10 100644 --- a/MP-ADM/WebUserControls/mod_menuBottom.ascx.cs +++ b/MP-ADM/WebUserControls/mod_menuBottom.ascx.cs @@ -3,19 +3,22 @@ using System.Configuration; using System.Diagnostics; using System.Web.UI; -public partial class mod_menuBottom : System.Web.UI.UserControl + +namespace MP_ADM.WebUserControls { - protected void Page_Load(object sender, EventArgs e) + public partial class mod_menuBottom : BaseUserControl { - if (!Page.IsPostBack) + protected void Page_Load(object sender, EventArgs e) { - // sistemo le stringhe... - //lblApp.Text = string.Format("{0} v.{1}.{2}", ConfigurationManager.AppSettings.Get("appName"), ConfigurationManager.AppSettings.Get("mainRev"), ConfigurationManager.AppSettings.Get("minRev")); - var versionInfo = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location); - lblCopyRight.Text = string.Format("{0}", versionInfo.LegalCopyright); - lblApp.Text = string.Format("{0} v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); + if (!Page.IsPostBack) + { + // sistemo le stringhe... + var versionInfo = FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location); + lblCopyRight.Text = string.Format("{0}", versionInfo.LegalCopyright); + lblApp.Text = string.Format("{0} v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); + } } } } diff --git a/MP-ADM/WebUserControls/mod_menuBottom.ascx.designer.cs b/MP-ADM/WebUserControls/mod_menuBottom.ascx.designer.cs index d3b8a8b0..e50f0b9b 100644 --- a/MP-ADM/WebUserControls/mod_menuBottom.ascx.designer.cs +++ b/MP-ADM/WebUserControls/mod_menuBottom.ascx.designer.cs @@ -9,41 +9,45 @@ -public partial class mod_menuBottom { - - /// - /// Controllo lblrev. - /// - /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. - /// - protected global::System.Web.UI.WebControls.Label lblrev; - - /// - /// Controllo lblApp. - /// - /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. - /// - protected global::System.Web.UI.WebControls.Label lblApp; - - /// - /// Controllo lblCopyRight. - /// - /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. - /// - protected global::System.Web.UI.WebControls.Label lblCopyRight; - - /// - /// Controllo updtRicerca. - /// - /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. - /// - protected global::System.Web.UI.UpdateProgress updtRicerca; +namespace MP_ADM.WebUserControls +{ + public partial class mod_menuBottom + { + + /// + /// Controllo lblrev. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblrev; + + /// + /// Controllo lblApp. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblApp; + + /// + /// Controllo lblCopyRight. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.Label lblCopyRight; + + /// + /// Controllo updtRicerca. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.UpdateProgress updtRicerca; + } } diff --git a/MP-ADM/WebUserControls/mod_menuTop.ascx b/MP-ADM/WebUserControls/mod_menuTop.ascx index 165b6c21..4bc67a28 100644 --- a/MP-ADM/WebUserControls/mod_menuTop.ascx +++ b/MP-ADM/WebUserControls/mod_menuTop.ascx @@ -1,4 +1,4 @@ -<%@ Control Language="C#" AutoEventWireup="true" Inherits="MoonPro_site.WebUserControls.mod_menuTop" +<%@ Control Language="C#" AutoEventWireup="true" Inherits="MP_ADM.WebUserControls.mod_menuTop" CodeBehind="mod_menuTop.ascx.cs" %> <%-- Gestione resize --%> @@ -19,7 +19,7 @@ <%: DateTime.Now.ToString("HH.mm.ss") %> - +
diff --git a/MP-ADM/WebUserControls/mod_menuTop.ascx.cs b/MP-ADM/WebUserControls/mod_menuTop.ascx.cs index b83f8773..8bd770ff 100644 --- a/MP-ADM/WebUserControls/mod_menuTop.ascx.cs +++ b/MP-ADM/WebUserControls/mod_menuTop.ascx.cs @@ -3,179 +3,168 @@ using System; using System.Collections.Generic; using System.Web.UI; -namespace MoonPro_site.WebUserControls +namespace MP_ADM.WebUserControls { - public partial class mod_menuTop : System.Web.UI.UserControl - { - private string _titleString; - - #region gestione eventi - - public event EventHandler eh_toggleMenuSx; - public event EventHandler eh_reqUpdateMenu; - - #endregion - - protected void Page_Load(object sender, EventArgs e) + public partial class mod_menuTop : BaseUserControl { - btnLogOut.Visible = user_std.UtSn.isForcedUser; - if (memLayer.ML.isInSessionObject("doUpdateNow")) - { - doFullDataUpdate(); - memLayer.ML.emptySessionVal("doUpdateNow"); - } - } - protected void btnLogOut_Click(object sender, EventArgs e) - { - Session.Abandon(); - Response.Redirect("forceUser.aspx"); - } - protected void btnUpdate_Click(object sender, EventArgs e) - { - doFullDataUpdate(); - updateWindowSize(); - } + private string _titleString; - private void doFullDataUpdate() - { - // salvo i dati attuali... - string cod_cdc = SteamWare.memLayer.ML.StringSessionObj("valRicercaCdC"); - string lingua = user_std.UtSn.lingua; - string USER_NAME = SteamWare.memLayer.ML.StringSessionObj("USER_NAME"); - string DOMINIO = SteamWare.memLayer.ML.StringSessionObj("DOMINIO"); - bool isForceUser = user_std.UtSn.isForcedUser; - // salvo i valori delle tab in session... - Dictionary sessionParam = SteamWare.memLayer.ML.valSess2SurvUpd; + #region gestione eventi - // svuoto session e cache per rileggere i dati da Db - Session.RemoveAll(); + public event EventHandler eh_toggleMenuSx; + public event EventHandler eh_reqUpdateMenu; - SteamWare.memLayer.ML.flushRegisteredCache(); + #endregion - // rimemorizzo - SteamWare.memLayer.ML.setSessionVal("valRicercaCdC", cod_cdc); - user_std.UtSn.startUpUtente(DOMINIO, USER_NAME); - user_std.UtSn.lingua = lingua; - user_std.UtSn.isForcedUser = isForceUser; - DataWrap.DW.resetVocabolario(); - - // risalvo in session i valori... - foreach (KeyValuePair kvp in sessionParam) - { - SteamWare.memLayer.ML.setSessionVal(kvp.Key, kvp.Value, true); - } - - // cambio visibilità del menù laterale... - if (eh_reqUpdateMenu != null) - { - eh_reqUpdateMenu(this, new EventArgs()); - } - - Response.Redirect(Page.Request.Url.ToString()); - } - - protected void bindControlli() - { - if (!Page.IsPostBack) - { - //lnkHelp.ToolTip = traduci("ApriManualeHelp"); - // solo se user è auth... - if (user_std.UtSn.isAuth) + protected void Page_Load(object sender, EventArgs e) { - //lnkShowHide.Text = user_std.UtSn.Traduci("lnkShowHide"); - //lblTitle.Text = user_std.UtSn.Traduci(SteamWare.memLayer.ML.CRS("titleApp")); - if (_titleString != "") - { - //// traduzione di tutti i termini - //lblMessUtente.Text = user_std.UtSn.Traduci(_titleString); - ////doppio in english! - //lblMessUtenteEn.Text = "(" + user_std.UtSn.TraduciEn(_titleString) + ")"; - _titleString = ""; - Session["_titleString"] = _titleString; - Session["SessionUpdateMenu"] = true; - } - else - { - //string titolo = user_std.UtSn.Traduci(SteamWare.memLayer.ML.CRS("welcomeApp")); - //lblMessUtente.Text = string.Format("{0} - {1}", titolo, memLayer.ML.CRS("SiteName")); - //lblMessUtenteEn.Text = ""; - Session["SessionUpdateMenu"] = false; - } - btnLogOut.Text = user_std.UtSn.Traduci("LogOut"); - btnUpdate.Text = user_std.UtSn.Traduci("Update"); - //lblUser.Text = String.Format("{0}: {1}", user_std.UtSn.Traduci("User"), user_std.UtSn.CognomeNome); - setTimer(); - setClock(); + btnLogOut.Visible = user_std.UtSn.isForcedUser; + if (memLayer.ML.isInSessionObject("doUpdateNow")) + { + doFullDataUpdate(); + memLayer.ML.emptySessionVal("doUpdateNow"); + } + } + protected void btnLogOut_Click(object sender, EventArgs e) + { + Session.Abandon(); + Response.Redirect("forceUser.aspx"); + } + protected void btnUpdate_Click(object sender, EventArgs e) + { + doFullDataUpdate(); + updateWindowSize(); } - } - } - /// - /// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada - /// - private void setTimer() - { - } - protected void lnkShowHide_Click(object sender, EventArgs e) - { - // cambio visibilità del menù laterale... - if (eh_toggleMenuSx != null) - { - eh_toggleMenuSx(this, new EventArgs()); - } - } - protected void Timer1_Tick(object sender, EventArgs e) - { - setClock(); - } + private void doFullDataUpdate() + { + // salvo i dati attuali... + string cod_cdc = memLayer.ML.StringSessionObj("valRicercaCdC"); + string lingua = user_std.UtSn.lingua; + string USER_NAME = memLayer.ML.StringSessionObj("USER_NAME"); + string DOMINIO = memLayer.ML.StringSessionObj("DOMINIO"); + bool isForceUser = user_std.UtSn.isForcedUser; + // salvo i valori delle tab in session... + Dictionary sessionParam = memLayer.ML.valSess2SurvUpd; - private void setClock() - { - //lblDateTime.Text = DateTime.Now.ToString("HH:mm:ss"); - } - protected void lblUser_Click(object sender, EventArgs e) - { - Response.Redirect("./chLang.aspx"); - } + // svuoto session e cache per rileggere i dati da Db + Session.RemoveAll(); + + memLayer.ML.flushRegisteredCache(); + + // rimemorizzo + memLayer.ML.setSessionVal("valRicercaCdC", cod_cdc); + user_std.UtSn.startUpUtente(DOMINIO, USER_NAME); + user_std.UtSn.lingua = lingua; + user_std.UtSn.isForcedUser = isForceUser; + DataWrap.DW.resetVocabolario(); + + // risalvo in session i valori... + foreach (KeyValuePair kvp in sessionParam) + { + memLayer.ML.setSessionVal(kvp.Key, kvp.Value, true); + } + + // cambio visibilità del menù laterale... + if (eh_reqUpdateMenu != null) + { + eh_reqUpdateMenu(this, new EventArgs()); + } + + Response.Redirect(Page.Request.Url.ToString()); + } + + protected void bindControlli() + { + if (!Page.IsPostBack) + { + // solo se user è auth... + if (user_std.UtSn.isAuth) + { + if (_titleString != "") + { + _titleString = ""; + Session["_titleString"] = _titleString; + Session["SessionUpdateMenu"] = true; + } + else + { + Session["SessionUpdateMenu"] = false; + } + btnLogOut.Text = user_std.UtSn.Traduci("LogOut"); + btnUpdate.Text = user_std.UtSn.Traduci("Update"); + setTimer(); + setClock(); + } + } + } + /// + /// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada + /// + private void setTimer() + { + } + protected void lnkShowHide_Click(object sender, EventArgs e) + { + // cambio visibilità del menù laterale... + if (eh_toggleMenuSx != null) + { + eh_toggleMenuSx(this, new EventArgs()); + } + + } + protected void Timer1_Tick(object sender, EventArgs e) + { + setClock(); + } + + private void setClock() + { + //lblDateTime.Text = DateTime.Now.ToString("HH:mm:ss"); + } + protected void lblUser_Click(object sender, EventArgs e) + { + Response.Redirect("./chLang.aspx"); + } - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - btnUpdate.Text = "Update"; - updateWindowSize(); - } + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + btnUpdate.Text = "Update"; + updateWindowSize(); + } - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - } - protected override void OnPreRender(EventArgs e) - { - base.OnPreRender(e); - } + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + } + protected override void OnPreRender(EventArgs e) + { + base.OnPreRender(e); + } - private void updateWindowSize() - { - if (HiddenHeight.Value != "") - { - memLayer.ML.setSessionVal("WindowHeight", HiddenHeight.Value, true); - } - if (HiddenWidth.Value != "") - { - memLayer.ML.setSessionVal("WindowWidth", HiddenWidth.Value); - } - } + private void updateWindowSize() + { + if (HiddenHeight.Value != "") + { + memLayer.ML.setSessionVal("WindowHeight", HiddenHeight.Value, true); + } + if (HiddenWidth.Value != "") + { + memLayer.ML.setSessionVal("WindowWidth", HiddenWidth.Value); + } + } - protected void HiddenHeight_ValueChanged(object sender, EventArgs e) - { - updateWindowSize(); - } + protected void HiddenHeight_ValueChanged(object sender, EventArgs e) + { + updateWindowSize(); + } - protected void HiddenWidth_ValueChanged(object sender, EventArgs e) - { - updateWindowSize(); - } + protected void HiddenWidth_ValueChanged(object sender, EventArgs e) + { + updateWindowSize(); + } - } + } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_menuTop.ascx.designer.cs b/MP-ADM/WebUserControls/mod_menuTop.ascx.designer.cs index 80c6de3b..1246b8d7 100644 --- a/MP-ADM/WebUserControls/mod_menuTop.ascx.designer.cs +++ b/MP-ADM/WebUserControls/mod_menuTop.ascx.designer.cs @@ -7,7 +7,7 @@ // //------------------------------------------------------------------------------ -namespace MoonPro_site.WebUserControls +namespace MP_ADM.WebUserControls { diff --git a/MP-ADM/WebUserControls/mod_menuTopCompact.ascx.cs b/MP-ADM/WebUserControls/mod_menuTopCompact.ascx.cs index a3a1cb9a..a2fb440f 100644 --- a/MP-ADM/WebUserControls/mod_menuTopCompact.ascx.cs +++ b/MP-ADM/WebUserControls/mod_menuTopCompact.ascx.cs @@ -5,93 +5,93 @@ using System.Web.UI; namespace MP_ADM.WebUserControls { - public partial class mod_menuTopCompact : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) + public partial class mod_menuTopCompact : BaseUserControl { - string lastPage = Request.Url.LocalPath.Split('/').Last(); - if (!Page.IsPostBack) - { - // fix visibilità TASK - hlTask.Visible = devicesAuthProxy.stObj.userHasRight("CT_userStart"); - // se l'utente NON c'è torno a login... - if (!devicesAuthProxy.stObj.isAuth) + protected void Page_Load(object sender, EventArgs e) { - if (lastPage != "" && lastPage != "login") - { - Session["nextPage"] = lastPage; - } - // SE non sono in "safe page" - if (memLayer.ML.CRS("_loginPages").IndexOf(lastPage) < 0) - { - Response.Redirect("login"); - } + string lastPage = Request.Url.LocalPath.Split('/').Last(); + if (!Page.IsPostBack) + { + // fix visibilità TASK + hlTask.Visible = devicesAuthProxy.stObj.userHasRight("CT_userStart"); + // se l'utente NON c'è torno a login... + if (!devicesAuthProxy.stObj.isAuth) + { + if (lastPage != "" && lastPage != "login") + { + Session["nextPage"] = lastPage; + } + // SE non sono in "safe page" + if (memLayer.ML.CRS("_loginPages").IndexOf(lastPage) < 0) + { + Response.Redirect("login"); + } + } + else + { + PagCorrente(); + } + } + // controllo pagina... + bool pageAuth = devicesAuthProxy.stObj.isPageEnabled(lastPage); + // controllo pag auth... + if (!pageAuth) + { + Response.Redirect("~/login"); + } + lblTitolo.Text = memLayer.ML.CRS("appName"); } - else + /// + /// salva in variabile pagina il nome della pagina corrente + /// + protected void PagCorrente() { - PagCorrente(); + string[] uri = Request.Url.LocalPath.Split('/'); + // salvo pagina corrente + devicesAuthProxy.pagCorrente = uri.Last(); + if (devicesAuthProxy.pagPrecedente == "") + { + devicesAuthProxy.pagPrecedente = devicesAuthProxy.pagCorrente; + } } - } - // controllo pagina... - bool pageAuth = devicesAuthProxy.stObj.isPageEnabled(lastPage); - // controllo pag auth... - if (!pageAuth) - { - Response.Redirect("~/login"); - } - lblTitolo.Text = memLayer.ML.CRS("appName"); - } - /// - /// salva in variabile pagina il nome della pagina corrente - /// - protected void PagCorrente() - { - string[] uri = Request.Url.LocalPath.Split('/'); - // salvo pagina corrente - devicesAuthProxy.pagCorrente = uri.Last(); - if (devicesAuthProxy.pagPrecedente == "") - { - devicesAuthProxy.pagPrecedente = devicesAuthProxy.pagCorrente; - } - } - /// - /// Codice postazione di lavoro - /// - public string CodPost - { - get - { - return memLayer.ML.StringSessionObj("CodPost"); - } - } - /// - /// Codice Operatore - /// - public string CodOpr - { - get - { - return memLayer.ML.StringSessionObj("CodOpr"); - } - } - /// - /// Codice TASK corrente - /// - public string CurrNumTask - { - get - { - return memLayer.ML.StringSessionObj("CurrNumTask"); - } - } - /// - /// Codice postazione di lavoro - /// - public string DescPost - { - get - { - string answ = ""; + /// + /// Codice postazione di lavoro + /// + public string CodPost + { + get + { + return memLayer.ML.StringSessionObj("CodPost"); + } + } + /// + /// Codice Operatore + /// + public string CodOpr + { + get + { + return memLayer.ML.StringSessionObj("CodOpr"); + } + } + /// + /// Codice TASK corrente + /// + public string CurrNumTask + { + get + { + return memLayer.ML.StringSessionObj("CurrNumTask"); + } + } + /// + /// Codice postazione di lavoro + /// + public string DescPost + { + get + { + string answ = ""; #if false if (memLayer.ML.isInSessionObject("DescPost")) { @@ -107,17 +107,17 @@ namespace MP_ADM.WebUserControls memLayer.ML.setSessionVal("DescPost", answ); } #endif - return answ; - } - } - /// - /// Codice Operatore - /// - public string NomeOpr - { - get - { - string answ = ""; + return answ; + } + } + /// + /// Codice Operatore + /// + public string NomeOpr + { + get + { + string answ = ""; #if false if (memLayer.ML.isInSessionObject("NomeOpr")) { @@ -133,8 +133,8 @@ namespace MP_ADM.WebUserControls memLayer.ML.setSessionVal("NomeOpr", answ); } #endif - return answ; - } + return answ; + } + } } - } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_newOdl.ascx b/MP-ADM/WebUserControls/mod_newOdl.ascx index bbb21287..346d8985 100644 --- a/MP-ADM/WebUserControls/mod_newOdl.ascx +++ b/MP-ADM/WebUserControls/mod_newOdl.ascx @@ -1,5 +1,5 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_newOdl.ascx.cs" - Inherits="MoonPro_site.WebUserControls.mod_newOdl" %> + Inherits="MP_ADM.WebUserControls.mod_newOdl" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
diff --git a/MP-ADM/WebUserControls/mod_newOdl.ascx.cs b/MP-ADM/WebUserControls/mod_newOdl.ascx.cs index f800f327..3245d2b9 100644 --- a/MP-ADM/WebUserControls/mod_newOdl.ascx.cs +++ b/MP-ADM/WebUserControls/mod_newOdl.ascx.cs @@ -2,162 +2,158 @@ using SteamWare; using System; -namespace MoonPro_site.WebUserControls +namespace MP_ADM.WebUserControls { - public partial class mod_newOdl : System.Web.UI.UserControl - { - /// - /// Oggetto datalayer specifico - /// - DataLayer DataLayerObj = new DataLayer(); - protected void Page_Load(object sender, EventArgs e) + public partial class mod_newOdl : BaseUserControl { - - } - - #region gestione eventi - - public event EventHandler eh_nuovoValore; - - #endregion - - /// - /// conferma inserimento TC - /// - /// - /// - protected void btnOk_Click(object sender, EventArgs e) - { - // controllo se ho tutti i valori ok... - string CodArticolo = ""; - string IdxMacchina = ""; - int numPezzi = 0; - int pzPallet = 1; - decimal TCiclo = 0; - - try - { - CodArticolo = ddlArticolo.SelectedValue; - IdxMacchina = ddlMacchine.SelectedValue; - //IdxMacchina = txtMacchina.Text.Trim(); - // se IdxMacchina è vuoto metto null... - if (IdxMacchina == "") + protected void Page_Load(object sender, EventArgs e) { - IdxMacchina = "0"; - } - numPezzi = Convert.ToInt32(txtPezzi.Text.Trim()); - TCiclo = Convert.ToDecimal(txtTempoCiclo.Text.Trim().Replace(".", ",")); - pzPallet = Convert.ToInt32(txtPzPallet.Text.Trim()); - DataLayerObj.taODL.InsertQuery(CodArticolo, DataLayerObj.MatrOpr, IdxMacchina, numPezzi, TCiclo, pzPallet, chkToAs400.Checked, txtCommessa.Text.Trim()); - } - catch - { - logger.lg.scriviLog(string.Format("Non sono riuscito ad inserire l'ODL con i seguenti parametri: {0} | {1} | {2} | {3} | {4}", CodArticolo, IdxMacchina, numPezzi, TCiclo, pzPallet), tipoLog.ERROR); - } - // segnalo update - if (eh_nuovoValore != null) - { - eh_nuovoValore(this, new EventArgs()); - } - } - /// - /// annullamento inserimento - /// - /// - /// - protected void btnCancel_Click(object sender, EventArgs e) - { - if (eh_nuovoValore != null) - { - eh_nuovoValore(this, new EventArgs()); - } - } - /// - /// aggiorno label min e centesimi - /// - /// - /// - protected void txtTempoCiclo_TextChanged(object sender, EventArgs e) - { - string text = ""; - string txtMinCent = txtTempoCiclo.Text.Trim().Replace(".", ","); - int min = 0; - int sec = 0; - try - { - // cerco di convertire in min/sec - min = Convert.ToInt32(Math.Floor(Convert.ToDouble(txtMinCent))); - sec = Convert.ToInt32((Convert.ToDouble(txtMinCent) - min) * 60); - text = string.Format("{0}:{1:00}", min, sec); - } - catch - { } - lblMinSec.Text = text; - } - /// - /// selezione articolo - /// - /// - /// - protected void ddlArticolo_SelectedIndexChanged(object sender, EventArgs e) - { - showLastTimeAndNote(); - } - /// - /// mostro elenco ultimi 5 tempi e note... - /// - private void showLastTimeAndNote() - { - // update tempi ciclo! - grViewTempi.DataBind(); - } - /// - /// selezione impianto - /// - /// - /// - protected void ddlMacchine_SelectedIndexChanged(object sender, EventArgs e) - { - showLastTimeAndNote(); - } - /// - /// reset della selezione - /// - /// - /// - protected void btnReset_Click(object sender, EventArgs e) - { - resetSelezione(); + } + + #region gestione eventi + + public event EventHandler eh_nuovoValore; + + #endregion + + /// + /// conferma inserimento TC + /// + /// + /// + protected void btnOk_Click(object sender, EventArgs e) + { + // controllo se ho tutti i valori ok... + string CodArticolo = ""; + string IdxMacchina = ""; + int numPezzi = 0; + int pzPallet = 1; + decimal TCiclo = 0; + + try + { + CodArticolo = ddlArticolo.SelectedValue; + IdxMacchina = ddlMacchine.SelectedValue; + //IdxMacchina = txtMacchina.Text.Trim(); + // se IdxMacchina è vuoto metto null... + if (IdxMacchina == "") + { + IdxMacchina = "0"; + } + numPezzi = Convert.ToInt32(txtPezzi.Text.Trim()); + TCiclo = Convert.ToDecimal(txtTempoCiclo.Text.Trim().Replace(".", ",")); + pzPallet = Convert.ToInt32(txtPzPallet.Text.Trim()); + DataLayerObj.taODL.InsertQuery(CodArticolo, DataLayerObj.MatrOpr, IdxMacchina, numPezzi, TCiclo, pzPallet, chkToAs400.Checked, txtCommessa.Text.Trim()); + } + catch + { + logger.lg.scriviLog(string.Format("Non sono riuscito ad inserire l'ODL con i seguenti parametri: {0} | {1} | {2} | {3} | {4}", CodArticolo, IdxMacchina, numPezzi, TCiclo, pzPallet), tipoLog.ERROR); + } + // segnalo update + if (eh_nuovoValore != null) + { + eh_nuovoValore(this, new EventArgs()); + } + } + /// + /// annullamento inserimento + /// + /// + /// + protected void btnCancel_Click(object sender, EventArgs e) + { + if (eh_nuovoValore != null) + { + eh_nuovoValore(this, new EventArgs()); + } + } + /// + /// aggiorno label min e centesimi + /// + /// + /// + protected void txtTempoCiclo_TextChanged(object sender, EventArgs e) + { + string text = ""; + string txtMinCent = txtTempoCiclo.Text.Trim().Replace(".", ","); + int min = 0; + int sec = 0; + try + { + // cerco di convertire in min/sec + min = Convert.ToInt32(Math.Floor(Convert.ToDouble(txtMinCent))); + sec = Convert.ToInt32((Convert.ToDouble(txtMinCent) - min) * 60); + text = string.Format("{0}:{1:00}", min, sec); + } + catch + { } + lblMinSec.Text = text; + } + /// + /// selezione articolo + /// + /// + /// + protected void ddlArticolo_SelectedIndexChanged(object sender, EventArgs e) + { + showLastTimeAndNote(); + } + /// + /// mostro elenco ultimi 5 tempi e note... + /// + private void showLastTimeAndNote() + { + // update tempi ciclo! + grViewTempi.DataBind(); + } + /// + /// selezione impianto + /// + /// + /// + protected void ddlMacchine_SelectedIndexChanged(object sender, EventArgs e) + { + showLastTimeAndNote(); + } + + /// + /// reset della selezione + /// + /// + /// + protected void btnReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + /// + /// resetta la selezione dei valori in caso di modifiche su altri controlli + /// + public void resetSelezione() + { + grViewTempi.SelectedIndex = -1; + grViewTempi.DataBind(); + } + /// + /// evento selezione riga: salvo tempo e qta nei campi input... + /// + /// + /// + protected void grViewTempi_SelectedIndexChanged(object sender, EventArgs e) + { + // ricavo i dati selezionati + int idxOdl = 0; + try + { + idxOdl = Convert.ToInt32(grViewTempi.SelectedValue); + } + catch + { } + MapoDb.DS_ProdTempi.ODLRow rigaOdl = DataLayerObj.taODL.getByIdx(idxOdl, false)[0]; + // precompilo dati pezzi/tempi + txtPezzi.Text = rigaOdl.NumPezzi.ToString(); + txtTempoCiclo.Text = rigaOdl.TCAssegnato.ToString("0.00"); + txtPzPallet.Text = rigaOdl.PzPallet.ToString(); + } } - /// - /// resetta la selezione dei valori in caso di modifiche su altri controlli - /// - public void resetSelezione() - { - grViewTempi.SelectedIndex = -1; - grViewTempi.DataBind(); - } - /// - /// evento selezione riga: salvo tempo e qta nei campi input... - /// - /// - /// - protected void grViewTempi_SelectedIndexChanged(object sender, EventArgs e) - { - // ricavo i dati selezionati - int idxOdl = 0; - try - { - idxOdl = Convert.ToInt32(grViewTempi.SelectedValue); - } - catch - { } - MapoDb.DS_ProdTempi.ODLRow rigaOdl = DataLayerObj.taODL.getByIdx(idxOdl, false)[0]; - // precompilo dati pezzi/tempi - txtPezzi.Text = rigaOdl.NumPezzi.ToString(); - txtTempoCiclo.Text = rigaOdl.TCAssegnato.ToString("0.00"); - txtPzPallet.Text = rigaOdl.PzPallet.ToString(); - } - } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_newOdl.ascx.designer.cs b/MP-ADM/WebUserControls/mod_newOdl.ascx.designer.cs index 4481a233..efa228e9 100644 --- a/MP-ADM/WebUserControls/mod_newOdl.ascx.designer.cs +++ b/MP-ADM/WebUserControls/mod_newOdl.ascx.designer.cs @@ -1,177 +1,178 @@ //------------------------------------------------------------------------------ -// -// This code was generated by a tool. +// +// Codice generato da uno strumento. // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// //------------------------------------------------------------------------------ -namespace MoonPro_site.WebUserControls +namespace MP_ADM.WebUserControls { - public partial class mod_newOdl { - + public partial class mod_newOdl + { + /// - /// ddlArticolo control. + /// Controllo ddlArticolo. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.DropDownList ddlArticolo; - + /// - /// odsArticoli control. + /// Controllo odsArticoli. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.ObjectDataSource odsArticoli; - + /// - /// ddlMacchine control. + /// Controllo ddlMacchine. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.DropDownList ddlMacchine; - + /// - /// odsMacchine control. + /// Controllo odsMacchine. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.ObjectDataSource odsMacchine; - + /// - /// txtPezzi control. + /// Controllo txtPezzi. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.TextBox txtPezzi; - + /// - /// rfvPezzi control. + /// Controllo rfvPezzi. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvPezzi; - + /// - /// chkToAs400 control. + /// Controllo chkToAs400. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.CheckBox chkToAs400; - + /// - /// txtTempoCiclo control. + /// Controllo txtTempoCiclo. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.TextBox txtTempoCiclo; - + /// - /// lblMinSec control. + /// Controllo lblMinSec. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Label lblMinSec; - + /// - /// rfvTempoCiclo control. + /// Controllo rfvTempoCiclo. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvTempoCiclo; - + /// - /// txtPzPallet control. + /// Controllo txtPzPallet. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.TextBox txtPzPallet; - + /// - /// rfvPzPallet control. + /// Controllo rfvPzPallet. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rfvPzPallet; - + /// - /// txtCommessa control. + /// Controllo txtCommessa. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.TextBox txtCommessa; - + /// - /// btnOk control. + /// Controllo btnOk. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Button btnOk; - + /// - /// btnCancel control. + /// Controllo btnCancel. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Button btnCancel; - + /// - /// divTempi control. + /// Controllo divTempi. /// /// - /// 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. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl divTempi; - + /// - /// grViewTempi control. + /// Controllo grViewTempi. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.GridView grViewTempi; - + /// - /// odsTempi control. + /// Controllo odsTempi. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.ObjectDataSource odsTempi; } diff --git a/MP-ADM/WebUserControls/mod_newPromessaODL.ascx.cs b/MP-ADM/WebUserControls/mod_newPromessaODL.ascx.cs index 7e8a7161..6675946d 100644 --- a/MP-ADM/WebUserControls/mod_newPromessaODL.ascx.cs +++ b/MP-ADM/WebUserControls/mod_newPromessaODL.ascx.cs @@ -5,211 +5,207 @@ using System.Web.UI; namespace MP_ADM.WebUserControls { - public partial class mod_newPromessaODL : System.Web.UI.UserControl - { - /// - /// Oggetto datalayer specifico - /// - DataLayer DataLayerObj = new DataLayer(); - protected void Page_Load(object sender, EventArgs e) + public partial class mod_newPromessaODL : BaseUserControl { - if (!Page.IsPostBack) - { - setDefaults(); - } - } - /// - /// Testo conferma salvataggio (create/Edit) - /// - public string testoConf - { - get - { - string answ = "Crea Promessa ODL"; - if (memLayer.ML.isInSessionObject("idxProm2Edit")) + protected void Page_Load(object sender, EventArgs e) { - answ = "Edit Promessa ODL"; + if (!Page.IsPostBack) + { + setDefaults(); + } } - return answ; - } - } - public void doSelPODL() - { - // se ho una promessa da clonare copio dati da quella... - int idxProm = 0; - try - { - if (memLayer.ML.isInSessionObject("idxProm2Clone")) + /// + /// Testo conferma salvataggio (create/Edit) + /// + public string testoConf { - idxProm = memLayer.ML.IntSessionObj("idxProm2Clone"); + get + { + string answ = "Crea Promessa ODL"; + if (memLayer.ML.isInSessionObject("idxProm2Edit")) + { + answ = "Edit Promessa ODL"; + } + return answ; + } } - else if (memLayer.ML.isInSessionObject("idxProm2Edit")) + public void doSelPODL() { - idxProm = memLayer.ML.IntSessionObj("idxProm2Edit"); + // se ho una promessa da clonare copio dati da quella... + int idxProm = 0; + try + { + if (memLayer.ML.isInSessionObject("idxProm2Clone")) + { + idxProm = memLayer.ML.IntSessionObj("idxProm2Clone"); + } + else if (memLayer.ML.isInSessionObject("idxProm2Edit")) + { + idxProm = memLayer.ML.IntSessionObj("idxProm2Edit"); + } + // provo a selezionare + var tPODL = DataLayerObj.taPODL.getByKey(idxProm); + if (tPODL.Rows.Count > 0) + { + var rPODL = tPODL[0]; + txtSearch.Text = rPODL.CodArticolo; + ddlArticolo.DataBind(); + ddlArticolo.SelectedValue = rPODL.CodArticolo; + ddlGruppi.DataBind(); + ddlGruppi.SelectedValue = rPODL.CodGruppo; + txtNumPz.Text = rPODL.NumPezzi.ToString(); + txtPzPallet.Text = rPODL.PzPallet.ToString(); + txtPrio.Text = rPODL.Priorita.ToString(); + if (memLayer.ML.cdvb("ADM_TC_MinSec")) + { + txtTCms.Text = TempiCiclo.minSec(rPODL.TCAssegnato); + } + else + { + txtTCmc.Text = rPODL.TCAssegnato.ToString("N3"); + } + ddlMacchine.SelectedValue = rPODL.IdxMacchina; + txtKeyExt.Text = rPODL.KeyRichiesta; + // svuoto se ci fosse cloning...... + memLayer.ML.emptySessionVal("idxProm2Clone"); + } + } + catch + { } } - // provo a selezionare - var tPODL = DataLayerObj.taPODL.getByKey(idxProm); - if (tPODL.Rows.Count > 0) - { - var rPODL = tPODL[0]; - txtSearch.Text = rPODL.CodArticolo; - ddlArticolo.DataBind(); - ddlArticolo.SelectedValue = rPODL.CodArticolo; - ddlGruppi.DataBind(); - ddlGruppi.SelectedValue = rPODL.CodGruppo; - txtNumPz.Text = rPODL.NumPezzi.ToString(); - txtPzPallet.Text = rPODL.PzPallet.ToString(); - txtPrio.Text = rPODL.Priorita.ToString(); - if (memLayer.ML.cdvb("ADM_TC_MinSec")) - { - txtTCms.Text = TempiCiclo.minSec(rPODL.TCAssegnato); - } - else - { - txtTCmc.Text = rPODL.TCAssegnato.ToString("N3"); - } - ddlMacchine.SelectedValue = rPODL.IdxMacchina; - txtKeyExt.Text = rPODL.KeyRichiesta; - // svuoto se ci fosse cloning...... - memLayer.ML.emptySessionVal("idxProm2Clone"); - } - } - catch - { } - } - private void setDefaults() - { - // se abilitato in config inserisce i valori defaults x insert... - if (memLayer.ML.cdvb("resetDefaultPromessaOdl")) - { - txtNumPz.Text = "1"; - txtPzPallet.Text = "1"; - txtPrio.Text = "1"; - // in base ad impostazione mostro TC come min:sec o min.cent - divTCms.Visible = false; - divTCmc.Visible = false; - if (memLayer.ML.cdvb("ADM_TC_MinSec")) + private void setDefaults() { - divTCms.Visible = true; - txtTCms.Text = "1:00"; + // se abilitato in config inserisce i valori defaults x insert... + if (memLayer.ML.cdvb("resetDefaultPromessaOdl")) + { + txtNumPz.Text = "1"; + txtPzPallet.Text = "1"; + txtPrio.Text = "1"; + // in base ad impostazione mostro TC come min:sec o min.cent + divTCms.Visible = false; + divTCmc.Visible = false; + if (memLayer.ML.cdvb("ADM_TC_MinSec")) + { + divTCms.Visible = true; + txtTCms.Text = "1:00"; + } + else + { + divTCmc.Visible = true; + txtTCmc.Text = "1.00"; + } + memLayer.ML.emptySessionVal("idxProm2Clone"); + memLayer.ML.emptySessionVal("idxProm2Edit"); + } } - else + + protected void txtSearch_TextChanged(object sender, EventArgs e) { - divTCmc.Visible = true; - txtTCmc.Text = "1.00"; + ddlArticolo.DataBind(); } - memLayer.ML.emptySessionVal("idxProm2Clone"); - memLayer.ML.emptySessionVal("idxProm2Edit"); - } - } - protected void txtSearch_TextChanged(object sender, EventArgs e) - { - ddlArticolo.DataBind(); - } + #region gestione eventi - #region gestione eventi + public event EventHandler eh_nuovoValore; - public event EventHandler eh_nuovoValore; + #endregion - #endregion - - /// - /// conferma inserimento TC - /// - /// - /// - protected void btnOk_Click(object sender, EventArgs e) - { - // controllo se ho tutti i valori ok... - string CodArticolo = ""; - string Gruppo = ""; - string IdxMacchina = ""; - string KeyReq = ""; - int numPezzi = 0; - int pzPallet = 1; - decimal TCiclo = 0; - bool attiv = false; - int prio = 0; - - try - { - CodArticolo = ddlArticolo.SelectedValue; - Gruppo = ddlGruppi.SelectedValue; - IdxMacchina = ddlMacchine.SelectedValue; - KeyReq = txtKeyExt.Text.Trim(); - //IdxMacchina = txtMacchina.Text.Trim(); - // se IdxMacchina è vuoto metto null... - if (IdxMacchina == "") + /// + /// conferma inserimento TC + /// + /// + /// + protected void btnOk_Click(object sender, EventArgs e) { - IdxMacchina = "0"; - } - numPezzi = Convert.ToInt32(txtNumPz.Text.Trim()); + // controllo se ho tutti i valori ok... + string CodArticolo = ""; + string Gruppo = ""; + string IdxMacchina = ""; + string KeyReq = ""; + int numPezzi = 0; + int pzPallet = 1; + decimal TCiclo = 0; + bool attiv = false; + int prio = 0; - if (memLayer.ML.cdvb("ADM_TC_MinSec")) - { - string[] sTC = txtTCms.Text.Trim().Split(':'); - int numMin = 0; - int numSec = 0; - int.TryParse(sTC[0], out numMin); - int.TryParse(sTC[1], out numSec); - TCiclo = numMin + ((decimal)numSec) / 60; - } - else - { - decimal.TryParse(txtTCmc.Text.Replace(".", ","), out TCiclo); - } - pzPallet = Convert.ToInt32(txtPzPallet.Text.Trim()); - attiv = chkAttiv.Checked; - int.TryParse(txtPrio.Text, out prio); + try + { + CodArticolo = ddlArticolo.SelectedValue; + Gruppo = ddlGruppi.SelectedValue; + IdxMacchina = ddlMacchine.SelectedValue; + KeyReq = txtKeyExt.Text.Trim(); + //IdxMacchina = txtMacchina.Text.Trim(); + // se IdxMacchina è vuoto metto null... + if (IdxMacchina == "") + { + IdxMacchina = "0"; + } + numPezzi = Convert.ToInt32(txtNumPz.Text.Trim()); - // controllo se sono in modalità EDIT faccio un update, altrimenti faccio un INSERT... - if (memLayer.ML.isInSessionObject("idxProm2Edit")) - { - int idxProm = memLayer.ML.IntSessionObj("idxProm2Edit"); - DataLayerObj.taPODL.updateQuery(KeyReq, KeyReq, attiv, CodArticolo, Gruppo, IdxMacchina, numPezzi, TCiclo, DateTime.Now, prio, pzPallet, idxProm); - memLayer.ML.emptySessionVal("idxProm2Edit"); + if (memLayer.ML.cdvb("ADM_TC_MinSec")) + { + string[] sTC = txtTCms.Text.Trim().Split(':'); + int numMin = 0; + int numSec = 0; + int.TryParse(sTC[0], out numMin); + int.TryParse(sTC[1], out numSec); + TCiclo = numMin + ((decimal)numSec) / 60; + } + else + { + decimal.TryParse(txtTCmc.Text.Replace(".", ","), out TCiclo); + } + pzPallet = Convert.ToInt32(txtPzPallet.Text.Trim()); + attiv = chkAttiv.Checked; + int.TryParse(txtPrio.Text, out prio); + + // controllo se sono in modalità EDIT faccio un update, altrimenti faccio un INSERT... + if (memLayer.ML.isInSessionObject("idxProm2Edit")) + { + int idxProm = memLayer.ML.IntSessionObj("idxProm2Edit"); + DataLayerObj.taPODL.updateQuery(KeyReq, KeyReq, attiv, CodArticolo, Gruppo, IdxMacchina, numPezzi, TCiclo, DateTime.Now, prio, pzPallet, idxProm); + memLayer.ML.emptySessionVal("idxProm2Edit"); + } + else + { + // 2018.09.25 --> inserisco PROMESSA ODL + //MapoDb.DataLayerObj.taODL.InsertQuery(CodArticolo, MapoDb.DataLayer.MatrOpr, IdxMacchina, numPezzi, TCiclo, pzPallet, chkToAs400.Checked, txtCommessa.Text.Trim()); + DataLayerObj.taPODL.insertQuery(KeyReq, KeyReq, attiv, CodArticolo, Gruppo, IdxMacchina, numPezzi, TCiclo, DateTime.Now, prio, pzPallet, ""); + } + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Non sono riuscito ad inserire la PromessaODL con i seguenti parametri: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8}{9}{10}", KeyReq, attiv, CodArticolo, IdxMacchina, numPezzi, TCiclo, prio, pzPallet, memLayer.ML.IntSessionObj("idxProm2Edit"), Environment.NewLine, exc), tipoLog.EXCEPTION); + memLayer.ML.emptySessionVal("idxProm2Edit"); + } + // segnalo update + if (eh_nuovoValore != null) + { + eh_nuovoValore(this, new EventArgs()); + } } - else + /// + /// annullamento inserimento + /// + /// + /// + protected void btnCancel_Click(object sender, EventArgs e) { - // 2018.09.25 --> inserisco PROMESSA ODL - //MapoDb.DataLayerObj.taODL.InsertQuery(CodArticolo, MapoDb.DataLayer.MatrOpr, IdxMacchina, numPezzi, TCiclo, pzPallet, chkToAs400.Checked, txtCommessa.Text.Trim()); - DataLayerObj.taPODL.insertQuery(KeyReq, KeyReq, attiv, CodArticolo, Gruppo, IdxMacchina, numPezzi, TCiclo, DateTime.Now, prio, pzPallet, ""); + memLayer.ML.emptySessionVal("idxProm2Clone"); + memLayer.ML.emptySessionVal("idxProm2Edit"); + if (eh_nuovoValore != null) + { + eh_nuovoValore(this, new EventArgs()); + } } - } - catch (Exception exc) - { - logger.lg.scriviLog(string.Format("Non sono riuscito ad inserire la PromessaODL con i seguenti parametri: {0} | {1} | {2} | {3} | {4} | {5} | {6} | {7} | {8}{9}{10}", KeyReq, attiv, CodArticolo, IdxMacchina, numPezzi, TCiclo, prio, pzPallet, memLayer.ML.IntSessionObj("idxProm2Edit"), Environment.NewLine, exc), tipoLog.EXCEPTION); - memLayer.ML.emptySessionVal("idxProm2Edit"); - } - // segnalo update - if (eh_nuovoValore != null) - { - eh_nuovoValore(this, new EventArgs()); - } - } - /// - /// annullamento inserimento - /// - /// - /// - protected void btnCancel_Click(object sender, EventArgs e) - { - memLayer.ML.emptySessionVal("idxProm2Clone"); - memLayer.ML.emptySessionVal("idxProm2Edit"); - if (eh_nuovoValore != null) - { - eh_nuovoValore(this, new EventArgs()); - } - } - /// - /// aggiorno label min e centesimi - /// - /// - /// - protected void txtTempoCiclo_TextChanged(object sender, EventArgs e) - { + /// + /// aggiorno label min e centesimi + /// + /// + /// + protected void txtTempoCiclo_TextChanged(object sender, EventArgs e) + { #if false string text = ""; string txtMinCent = txtTempoCiclo.Text.Trim().Replace(".", ","); @@ -226,87 +222,87 @@ namespace MP_ADM.WebUserControls { } lblMinSec.Text = text; #endif - } - /// - /// selezione articolo - /// - /// - /// - protected void ddlArticolo_SelectedIndexChanged(object sender, EventArgs e) - { - showLastTimeAndNote(); - } - /// - /// mostro elenco ultimi 5 tempi e note... - /// - private void showLastTimeAndNote() - { - // update tempi ciclo! - grViewTempi.DataBind(); - } - /// - /// selezione impianto - /// - /// - /// - protected void ddlMacchine_SelectedIndexChanged(object sender, EventArgs e) - { - showLastTimeAndNote(); - } - /// - /// selezione impianto - /// - /// - /// - protected void ddlGruppi_SelectedIndexChanged(object sender, EventArgs e) - { - ddlMacchine.DataBind(); - } + } + /// + /// selezione articolo + /// + /// + /// + protected void ddlArticolo_SelectedIndexChanged(object sender, EventArgs e) + { + showLastTimeAndNote(); + } + /// + /// mostro elenco ultimi 5 tempi e note... + /// + private void showLastTimeAndNote() + { + // update tempi ciclo! + grViewTempi.DataBind(); + } + /// + /// selezione impianto + /// + /// + /// + protected void ddlMacchine_SelectedIndexChanged(object sender, EventArgs e) + { + showLastTimeAndNote(); + } + /// + /// selezione impianto + /// + /// + /// + protected void ddlGruppi_SelectedIndexChanged(object sender, EventArgs e) + { + ddlMacchine.DataBind(); + } - /// - /// reset della selezione - /// - /// - /// - protected void btnReset_Click(object sender, EventArgs e) - { - resetSelezione(); + /// + /// reset della selezione + /// + /// + /// + protected void btnReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + /// + /// resetta la selezione dei valori in caso di modifiche su altri controlli + /// + public void resetSelezione() + { + grViewTempi.SelectedIndex = -1; + grViewTempi.DataBind(); + } + /// + /// evento selezione riga: salvo tempo e qta nei campi input... + /// + /// + /// + protected void grViewTempi_SelectedIndexChanged(object sender, EventArgs e) + { + // ricavo i dati selezionati + int idxOdl = 0; + try + { + idxOdl = Convert.ToInt32(grViewTempi.SelectedValue); + } + catch + { } + DS_ProdTempi.ODLRow rigaOdl = DataLayerObj.taODL.getByIdx(idxOdl, false)[0]; + // precompilo dati pezzi/tempi + txtNumPz.Text = rigaOdl.NumPezzi.ToString(); + if (memLayer.ML.cdvb("ADM_TC_MinSec")) + { + txtTCms.Text = TempiCiclo.minSec(rigaOdl.TCAssegnato); + } + else + { + txtTCmc.Text = rigaOdl.TCAssegnato.ToString("N3"); + } + txtPzPallet.Text = rigaOdl.PzPallet.ToString(); + } } - /// - /// resetta la selezione dei valori in caso di modifiche su altri controlli - /// - public void resetSelezione() - { - grViewTempi.SelectedIndex = -1; - grViewTempi.DataBind(); - } - /// - /// evento selezione riga: salvo tempo e qta nei campi input... - /// - /// - /// - protected void grViewTempi_SelectedIndexChanged(object sender, EventArgs e) - { - // ricavo i dati selezionati - int idxOdl = 0; - try - { - idxOdl = Convert.ToInt32(grViewTempi.SelectedValue); - } - catch - { } - DS_ProdTempi.ODLRow rigaOdl = DataLayerObj.taODL.getByIdx(idxOdl, false)[0]; - // precompilo dati pezzi/tempi - txtNumPz.Text = rigaOdl.NumPezzi.ToString(); - if (memLayer.ML.cdvb("ADM_TC_MinSec")) - { - txtTCms.Text = TempiCiclo.minSec(rigaOdl.TCAssegnato); - } - else - { - txtTCmc.Text = rigaOdl.TCAssegnato.ToString("N3"); - } - txtPzPallet.Text = rigaOdl.PzPallet.ToString(); - } - } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_ricercaGenerica.ascx.cs b/MP-ADM/WebUserControls/mod_ricercaGenerica.ascx.cs index c1e2a038..b3fea8d2 100644 --- a/MP-ADM/WebUserControls/mod_ricercaGenerica.ascx.cs +++ b/MP-ADM/WebUserControls/mod_ricercaGenerica.ascx.cs @@ -67,12 +67,12 @@ public partial class mod_ricercaGenerica : ApplicationUserControl { if (testoRicerca == "") { - SteamWare.memLayer.ML.emptySessionVal("valoreCercato"); - SteamWare.memLayer.ML.emptySessionVal("listaMatricoleSearch"); + memLayer.ML.emptySessionVal("valoreCercato"); + memLayer.ML.emptySessionVal("listaMatricoleSearch"); } else { - SteamWare.memLayer.ML.setSessionVal("valoreCercato", testoRicerca); + memLayer.ML.setSessionVal("valoreCercato", testoRicerca); // verifico ricerche accessorie if (_cercaMatricole) { @@ -105,7 +105,7 @@ public partial class mod_ricercaGenerica : ApplicationUserControl { listaMatricoleSearch = listaMatricoleSearch.Remove(listaMatricoleSearch.Length - 2); } - SteamWare.memLayer.ML.setSessionVal("listaMatricoleSearch", listaMatricoleSearch); + memLayer.ML.setSessionVal("listaMatricoleSearch", listaMatricoleSearch); } /// /// ricerca utenti e salva lista username x SQL IN @@ -123,7 +123,7 @@ public partial class mod_ricercaGenerica : ApplicationUserControl { listaUsernameSearch = listaUsernameSearch.Remove(listaUsernameSearch.Length - 2); } - SteamWare.memLayer.ML.setSessionVal("listaUsernameSearch", listaUsernameSearch); + memLayer.ML.setSessionVal("listaUsernameSearch", listaUsernameSearch); } #endregion @@ -135,9 +135,9 @@ public partial class mod_ricercaGenerica : ApplicationUserControl /// public void updateText() { - if (SteamWare.memLayer.ML.StringSessionObj("valoreCercato") != "" && !Page.IsPostBack) + if (memLayer.ML.StringSessionObj("valoreCercato") != "" && !Page.IsPostBack) { - testoRicerca = SteamWare.memLayer.ML.StringSessionObj("valoreCercato"); + testoRicerca = memLayer.ML.StringSessionObj("valoreCercato"); } } diff --git a/MP-ADM/WebUserControls/mod_storicoTC.ascx.cs b/MP-ADM/WebUserControls/mod_storicoTC.ascx.cs index 9ee9c919..2e383fe2 100644 --- a/MP-ADM/WebUserControls/mod_storicoTC.ascx.cs +++ b/MP-ADM/WebUserControls/mod_storicoTC.ascx.cs @@ -3,7 +3,7 @@ using System.Web.UI; namespace MP_ADM.WebUserControls { - public partial class mod_storicoTC : System.Web.UI.UserControl + public partial class mod_storicoTC : BaseUserControl { protected void Page_Load(object sender, EventArgs e) { diff --git a/MP-ADM/WebUserControls/mod_unauthorized.ascx b/MP-ADM/WebUserControls/mod_unauthorized.ascx index a28b35cd..c02f3fda 100644 --- a/MP-ADM/WebUserControls/mod_unauthorized.ascx +++ b/MP-ADM/WebUserControls/mod_unauthorized.ascx @@ -1,16 +1,13 @@ -<%@ Control Language="C#" AutoEventWireup="true" Inherits="MoonPro_site.WebUserControls.mod_unauthorized" Codebehind="mod_unauthorized.ascx.cs" %> - - - - - - - - - - -
- -
-
-
+<%@ Control Language="C#" AutoEventWireup="true" Inherits="MP_ADM.WebUserControls.mod_unauthorized" CodeBehind="mod_unauthorized.ascx.cs" %> + +
+
+ +
+
+ +
+
+ +
+
diff --git a/MP-ADM/WebUserControls/mod_unauthorized.ascx.cs b/MP-ADM/WebUserControls/mod_unauthorized.ascx.cs index 511b8989..edbcf7d8 100644 --- a/MP-ADM/WebUserControls/mod_unauthorized.ascx.cs +++ b/MP-ADM/WebUserControls/mod_unauthorized.ascx.cs @@ -1,14 +1,15 @@ +using MP_ADM; using SteamWare; using System; -namespace MoonPro_site.WebUserControls +namespace MP_ADM.WebUserControls { - public partial class mod_unauthorized : System.Web.UI.UserControl + public partial class mod_unauthorized : BaseUserControl { protected void Page_Load(object sender, EventArgs e) { - lblTitle.Text = user_std.UtSn.Traduci("NonDisponibile"); - lblMess.Text = user_std.UtSn.Traduci("NonAuth"); + lblTitle.Text = traduci("NonDisponibile"); + lblMess.Text = traduci("NonAuth"); } } } \ No newline at end of file diff --git a/MP-ADM/WebUserControls/mod_unauthorized.ascx.designer.cs b/MP-ADM/WebUserControls/mod_unauthorized.ascx.designer.cs index 91966c1b..fac1f4a3 100644 --- a/MP-ADM/WebUserControls/mod_unauthorized.ascx.designer.cs +++ b/MP-ADM/WebUserControls/mod_unauthorized.ascx.designer.cs @@ -1,43 +1,43 @@ //------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.4927 +// +// Codice generato da uno strumento. // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// //------------------------------------------------------------------------------ -namespace MoonPro_site.WebUserControls +namespace MP_ADM.WebUserControls { - public partial class mod_unauthorized { - + public partial class mod_unauthorized + { + /// - /// lblTitleMain control. + /// Controllo lblTitleMain. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Label lblTitleMain; - + /// - /// lblTitle control. + /// Controllo lblTitle. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Label lblTitle; - + /// - /// lblMess control. + /// Controllo lblMess. /// /// - /// 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. /// protected global::System.Web.UI.WebControls.Label lblMess; } diff --git a/MP-ADM/approvazioneODL.aspx.cs b/MP-ADM/approvazioneODL.aspx.cs index 7f861c96..74a36356 100644 --- a/MP-ADM/approvazioneODL.aspx.cs +++ b/MP-ADM/approvazioneODL.aspx.cs @@ -3,22 +3,22 @@ using System; namespace MP_ADM { - public partial class approvazioneODL : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) + public partial class approvazioneODL : BasePage { - checkEnabled(); + protected void Page_Load(object sender, EventArgs e) + { + checkEnabled(); + } + private void checkEnabled() + { + bool optPar = memLayer.ML.CRB("OptAdmApprTempiEnabled"); + divContent.Visible = optPar; + string messaggio = ""; + if (!optPar) + { + messaggio = "Attenzione: gestione approvazione cambio TC disabilitata"; + } + lblDataImportOut.Text = messaggio; + } } - private void checkEnabled() - { - bool optPar = memLayer.ML.CRB("OptAdmApprTempiEnabled"); - divContent.Visible = optPar; - string messaggio = ""; - if (!optPar) - { - messaggio = "Attenzione: gestione approvazione cambio TC disabilitata"; - } - lblDataImportOut.Text = messaggio; - } - } } \ No newline at end of file diff --git a/MP-ADM/approvazioneODL.aspx.designer.cs b/MP-ADM/approvazioneODL.aspx.designer.cs index eae322aa..f43c2f8f 100644 --- a/MP-ADM/approvazioneODL.aspx.designer.cs +++ b/MP-ADM/approvazioneODL.aspx.designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ // // Codice generato da uno strumento. // diff --git a/MP-ADM/calendChiusura.aspx b/MP-ADM/calendChiusura.aspx index 309672d2..c0a77063 100644 --- a/MP-ADM/calendChiusura.aspx +++ b/MP-ADM/calendChiusura.aspx @@ -5,7 +5,7 @@ <%@ Register Src="~/WebUserControls/mod_fixCal.ascx" tagname="mod_fixCal" tagprefix="uc2" %> - + diff --git a/MP-ADM/calendChiusura.aspx.designer.cs b/MP-ADM/calendChiusura.aspx.designer.cs index 9bed917b..33605727 100644 --- a/MP-ADM/calendChiusura.aspx.designer.cs +++ b/MP-ADM/calendChiusura.aspx.designer.cs @@ -9,17 +9,18 @@ -public partial class calendChiusura { - +public partial class calendChiusura +{ + /// - /// Controllo mod_fixCal1. + /// Controllo mod_fixCal. /// /// /// Campo generato automaticamente. /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. /// - protected global::mod_fixCal mod_fixCal1; - + protected global::mod_fixCal mod_fixCal; + /// /// Controllo mod_calChiusura1. ///