diff --git a/GMW/GMW_Term/Barcode.aspx.cs b/GMW/GMW_Term/Barcode.aspx.cs index 0ab2e639..9a7f0729 100644 --- a/GMW/GMW_Term/Barcode.aspx.cs +++ b/GMW/GMW_Term/Barcode.aspx.cs @@ -20,19 +20,17 @@ namespace GMW_Term void mod_barcode1_eh_resetUser(object sender, EventArgs e) { - memLayer.ML.setSessionVal("activeTask", "LogOff Operatore"); + TermUtils.TU.forceLogOut(); Response.Redirect("Barcode.aspx"); } void mod_barcode1_eh_scannedUser(object sender, EventArgs e) { - memLayer.ML.setSessionVal("activeTask", "Selezionato Operatore"); Response.Redirect("Home.aspx"); } void mod_barcode1_eh_scannedUdc(object sender, EventArgs e) { - memLayer.ML.setSessionVal("activeTask", string.Format("UDC: {0}", memLayer.ML.StringSessionObj("scannedValue"))); Response.Redirect("UDC.aspx"); } diff --git a/GMW/GMW_Term/GMW_Term.csproj b/GMW/GMW_Term/GMW_Term.csproj index d51a1268..6a68a127 100644 --- a/GMW/GMW_Term/GMW_Term.csproj +++ b/GMW/GMW_Term/GMW_Term.csproj @@ -74,6 +74,7 @@ Default.aspx + UDC.aspx ASPXCodeBehind diff --git a/GMW/GMW_Term/TermUtils.cs b/GMW/GMW_Term/TermUtils.cs new file mode 100644 index 00000000..a7709fb8 --- /dev/null +++ b/GMW/GMW_Term/TermUtils.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using SteamWare; + +namespace GMW_Term +{ + public class TermUtils + { + protected TermUtils() + { + + } + + /// + /// effettua logout da terminalino azzerando tutte le variabili necessarie + /// + public void forceLogOut() + { + HttpContext.Current.Session.Clear(); + user_std.UtSn.logOffUtente(); + // salvo esecuzione logout + memLayer.ML.setSessionVal("activeTask", "LogOff Operatore"); + } + + /// + /// oggetto static per fare chiamate + /// + public static TermUtils TU = new TermUtils(); + } +} diff --git a/GMW/GMW_Term/WebUserControls/mod_activeTask.ascx.cs b/GMW/GMW_Term/WebUserControls/mod_activeTask.ascx.cs index 7a507796..14097bb6 100644 --- a/GMW/GMW_Term/WebUserControls/mod_activeTask.ascx.cs +++ b/GMW/GMW_Term/WebUserControls/mod_activeTask.ascx.cs @@ -103,7 +103,7 @@ namespace GMW_Term.WebUserControls /// protected void btnLoginPage_Click(object sender, EventArgs e) { - user_std.UtSn.logOffUtente(); + TermUtils.TU.forceLogOut(); Response.Redirect("~/Barcode.aspx"); } /// diff --git a/GMW/GMW_Term/WebUserControls/mod_barcode.ascx.cs b/GMW/GMW_Term/WebUserControls/mod_barcode.ascx.cs index ef55c164..7cfd12a3 100644 --- a/GMW/GMW_Term/WebUserControls/mod_barcode.ascx.cs +++ b/GMW/GMW_Term/WebUserControls/mod_barcode.ascx.cs @@ -91,8 +91,7 @@ namespace GMW_Term.WebUserControls effettuaLoginOperatore(txtScansione); break; case tipoCodiceBarcode.ListaPrelievo: - lblData.Text = "Codice Lista Prelievo: " + txtScansione; - txtInput.Text = ""; + chekListaPrelievo(); break; case tipoCodiceBarcode.UDC: verificaUdc(); @@ -110,6 +109,40 @@ namespace GMW_Term.WebUserControls lblData.Font.Italic = false; } /// + /// verifica la lista di prelievo (se attivabile la attiva) + /// + private void chekListaPrelievo() + { + // verifico se al lista di prelievo sia valida ed attivabile + if (MagClass.magazzino.listaPrelevabile(txtScansione)) + { + // verifico se l'utente ha delle lsite di prelievo attive e quindi NON PUO prenderne in carico altre + if (!MagClass.magazzino.userHasActiveLP) + { + // salvo la lista di prelievo come attiva + memLayer.ML.setSessionVal("activeTask", string.Format("Lista Prelievo {0}", txtScansione)); + memLayer.ML.setSessionVal("CodListaAttiva", txtScansione); + // indico la lista come attiva + GMW_data.MagClass.magazzino.iniziaListaPrelievo(memLayer.ML.StringSessionObj("CodCS"), txtScansione, MagClass.magazzino.CodSoggCurrUser); + // salvo in sessione che voglio mostrare il dettaglio della lista appena presa in carico + memLayer.ML.setSessionVal("showDetListaPre", true, false); + // mando alla pagina liste di prelievo + Response.Redirect("~/ListePrelievo.aspx"); + } + else + { + // indico l'errore: operatore già con una lista attiva + lblData.Text = "!!! Lista di prelievo ancora aperta"; + } + } + else + { + // indico l'errore: lista non valida o non attivabile + lblData.Text = string.Format("!!! Codice {0} non valido", txtScansione); + } + txtInput.Text = ""; + } + /// /// verifica validità UDC /// private void verificaUdc() @@ -121,6 +154,7 @@ namespace GMW_Term.WebUserControls { // salvo in session UDC selezionato memLayer.ML.setSessionVal("UDC_sel", valoreScan, false); + memLayer.ML.setSessionVal("activeTask", string.Format("UDC: {0}", memLayer.ML.StringSessionObj("scannedValue"))); if (eh_scannedUdc != null) { eh_scannedUdc(this, new EventArgs()); @@ -139,6 +173,28 @@ namespace GMW_Term.WebUserControls { // salvo i dati di CodCS memLayer.ML.setSessionVal("CodCS", memLayer.ML.confReadString("CodCS"), true); + // in caso operatore abbia liste attive le carico... + if (MagClass.magazzino.userHasActiveLP) + { + string codiceListaAttivo = ""; + try + { + codiceListaAttivo = MagClass.magazzino.codListaAttivaUtente; + // salvo la lista di prelievo come attiva + memLayer.ML.setSessionVal("activeTask", string.Format("Lista Prelievo {0}", codiceListaAttivo)); + memLayer.ML.setSessionVal("CodListaAttiva", codiceListaAttivo); + } + catch + { + // c'era una lsita attiva, non l'ho recuperata, segno errore! + logger.lg.scriviLog(string.Format("Errore: l'utente {0} aveva una lista di prelievo attiva ma non sono riuscito a recuperarne i dati", user_std.UtSn.utente), tipoLog.ERROR); + } + } + else + { + memLayer.ML.setSessionVal("activeTask", "Selezionato Operatore"); + } + // alza evento login! if (eh_scannedUser != null) { eh_scannedUser(this, new EventArgs()); @@ -158,7 +214,7 @@ namespace GMW_Term.WebUserControls /// protected void btnLoginPage_Click(object sender, EventArgs e) { - user_std.UtSn.logOffUtente(); + TermUtils.TU.forceLogOut(); verificaOperatoreInSessione(); // evento reset if (eh_resetUser != null) diff --git a/GMW/GMW_Term/WebUserControls/mod_listePrelievo.ascx.cs b/GMW/GMW_Term/WebUserControls/mod_listePrelievo.ascx.cs index 18243b5f..135368be 100644 --- a/GMW/GMW_Term/WebUserControls/mod_listePrelievo.ascx.cs +++ b/GMW/GMW_Term/WebUserControls/mod_listePrelievo.ascx.cs @@ -288,6 +288,12 @@ namespace GMW_Term.WebUserControls { Response.Redirect("Home.aspx"); } + // controllo se ci sia richiesta x mostrare dettagli... + if (memLayer.ML.BoolSessionObj("showDetListaPre")) + { + memLayer.ML.emptySessionVal("showDetListaPre"); + showListDetails(memLayer.ML.StringSessionObj("CodListaAttiva")); + } } /// @@ -443,6 +449,8 @@ namespace GMW_Term.WebUserControls switch (_comando) { case "IniziaListaPrelievo": + memLayer.ML.setSessionVal("activeTask", string.Format("Lista Prelievo {0}", codLista)); + memLayer.ML.setSessionVal("CodListaAttiva", codLista); GMW_data.MagClass.magazzino.iniziaListaPrelievo(memLayer.ML.StringSessionObj("CodCS"), codLista, CodSoggetto); updateOds(); grView.EditIndex = -1; @@ -452,12 +460,12 @@ namespace GMW_Term.WebUserControls { eh_nuovoValore(this, new EventArgs()); } - memLayer.ML.setSessionVal("activeTask", string.Format("Lista Prelievo {0}", codLista)); - memLayer.ML.setSessionVal("CodListaAttiva", codLista); // blocco update! e.Cancel = true; break; case "CompletaListaPrelievo": + memLayer.ML.emptySessionVal("CodListaAttiva"); + memLayer.ML.emptySessionVal("activeTask"); GMW_data.MagClass.magazzino.completaListaPrelievo(memLayer.ML.StringSessionObj("CodCS"), codLista, CodSoggetto); updateOds(); grView.EditIndex = -1; @@ -467,27 +475,11 @@ namespace GMW_Term.WebUserControls { eh_nuovoValore(this, new EventArgs()); } - memLayer.ML.emptySessionVal("CodListaAttiva"); - memLayer.ML.emptySessionVal("activeTask"); // blocco update! e.Cancel = true; break; case "ShowDetail": - // salvo codice lista - memLayer.ML.setSessionVal("CodLista_sel", codLista); - // mostro dettaglio lista (e relativi buttons) - pnlDetail.Visible = true; - // nascondo elenco lista prelievo - pnlMaster.Visible = false; - // button x barcode: visibile solo se c'è una lista di prelievo attiva... - if (userHasListActive) - { - btnBarcode.Visible = true; - } - else - { - btnBarcode.Visible = false; - } + showListDetails(codLista); // blocco update! e.Cancel = true; break; @@ -497,6 +489,28 @@ namespace GMW_Term.WebUserControls } } /// + /// mostro la lista di prelievo indicata + /// + /// + private void showListDetails(string codLista) + { + // salvo codice lista + memLayer.ML.setSessionVal("CodLista_sel", codLista); + // mostro dettaglio lista (e relativi buttons) + pnlDetail.Visible = true; + // nascondo elenco lista prelievo + pnlMaster.Visible = false; + // button x barcode: visibile solo se c'è una lista di prelievo attiva... + if (MagClass.magazzino.userHasActiveLP) + { + btnBarcode.Visible = true; + } + else + { + btnBarcode.Visible = false; + } + } + /// /// chiamato post modifica valore check/selezione nel selettore filtro stato /// /// @@ -543,7 +557,7 @@ namespace GMW_Term.WebUserControls { int stato = Convert.ToInt32(codStato); string answ = ""; - if (userHasListActive && stato == 1) + if (MagClass.magazzino.userHasActiveLP && stato == 1) { answ = string.Format("~/images/circleDis_s_{0}.png", codStato); } @@ -587,33 +601,15 @@ namespace GMW_Term.WebUserControls switch (stato) { case 1: - answ = !userHasListActive; + answ = !MagClass.magazzino.userHasActiveLP; break; case 2: - answ = userHasListActive; + answ = MagClass.magazzino.userHasActiveLP; break; } return answ; } - /// - /// vero/falso ceh l'utent eha una lista di prelievo attiva - /// - protected bool userHasListActive - { - get - { - bool answ = false; - try - { - answ = (MagClass.magazzino.taElencoListePrelievo.getByCodSogg(MagClass.magazzino.CodSoggCurrUser).Rows.Count > 0); - } - catch - { } - return answ; - } - } - - + /// /// restituisce tooltip da mostrare x STATO lista /// @@ -642,8 +638,6 @@ namespace GMW_Term.WebUserControls return traduci(codice.ToString()); } - - /// /// effettua logout... /// @@ -651,7 +645,7 @@ namespace GMW_Term.WebUserControls /// protected void btnLoginPage_Click(object sender, EventArgs e) { - user_std.UtSn.logOffUtente(); + TermUtils.TU.forceLogOut(); Response.Redirect("~/Barcode.aspx"); } /// @@ -675,7 +669,6 @@ namespace GMW_Term.WebUserControls // ricarico x evitare proliferazione "_" su prima colonna Response.Redirect("~/ListePrelievo.aspx"); } - /// /// passa al barcode! /// diff --git a/GMW/GMW_Term/WebUserControls/mod_search.ascx b/GMW/GMW_Term/WebUserControls/mod_search.ascx index a23d0610..7d6c6213 100644 --- a/GMW/GMW_Term/WebUserControls/mod_search.ascx +++ b/GMW/GMW_Term/WebUserControls/mod_search.ascx @@ -1,23 +1,25 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_search.ascx.cs" Inherits="GMW_Term.WebUserControls.mod_search" %> +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_search.ascx.cs" + Inherits="GMW_Term.WebUserControls.mod_search" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> - - -
-
-
- - -
- - - -
-
-
-
- - -
-
\ No newline at end of file + + +
+
+
+
+ + +
+ + +
+ + + +
+
+
+
diff --git a/GMW/GMW_Term/WebUserControls/mod_search.ascx.cs b/GMW/GMW_Term/WebUserControls/mod_search.ascx.cs index d5636c67..10fdf766 100644 --- a/GMW/GMW_Term/WebUserControls/mod_search.ascx.cs +++ b/GMW/GMW_Term/WebUserControls/mod_search.ascx.cs @@ -5,16 +5,53 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using SteamWare; +using GMW_data; + namespace GMW_Term.WebUserControls { public partial class mod_search : System.Web.UI.UserControl { + // variabile per verificare se è operatore + bool _validUserInSession = false; + /// + /// Verifica se c'è un valore in sessione di tipo operatore + /// + protected void verificaOperatoreInSessione() + { + if (string.IsNullOrEmpty(user_std.UtSn.utente)) + { + _validUserInSession = false; + } + else + { + _validUserInSession = true; + } + } + /// + /// caricamento pagina! + /// + /// + /// protected void Page_Load(object sender, EventArgs e) { // scrive label e text bottoni - //lblTitle.Text = (string)(Session["loginName"]); - + btnLoginPage.Text = "[7]-LogOut"; + btnLoginPage.AccessKey = "7"; + btnButtonsHome.Text = "[9]-Home"; + btnButtonsHome.AccessKey = "9"; + // se username è valorizzato... + verificaOperatoreInSessione(); + if (_validUserInSession) + { + btnLoginPage.Visible = true; + btnButtonsHome.Visible = true; + } + // se non è valorizzato chiede di effettuare login... + else + { + Response.Redirect("Home.aspx"); + } } /// /// in caso di valore cercato... @@ -53,5 +90,25 @@ namespace GMW_Term.WebUserControls memLayer.ML.setSessionVal("searchValue", value, false); } } + + /// + /// effettua logout... + /// + /// + /// + protected void btnLoginPage_Click(object sender, EventArgs e) + { + TermUtils.TU.forceLogOut(); + Response.Redirect("~/Barcode.aspx"); + } + /// + /// va alla pagina dei buttons principale + /// + /// + /// + protected void btnButtonsHome_Click(object sender, EventArgs e) + { + Response.Redirect("~/Home.aspx"); + } } } \ No newline at end of file diff --git a/GMW/GMW_Term/WebUserControls/mod_search.ascx.designer.cs b/GMW/GMW_Term/WebUserControls/mod_search.ascx.designer.cs index 7911a369..b2b08ee5 100644 --- a/GMW/GMW_Term/WebUserControls/mod_search.ascx.designer.cs +++ b/GMW/GMW_Term/WebUserControls/mod_search.ascx.designer.cs @@ -31,6 +31,24 @@ namespace GMW_Term.WebUserControls { /// protected global::System.Web.UI.WebControls.Label lblInput; + /// + /// btnLoginPage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnLoginPage; + + /// + /// btnButtonsHome control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnButtonsHome; + /// /// updPanel1 control. /// @@ -57,23 +75,5 @@ namespace GMW_Term.WebUserControls { /// To modify move field declaration from designer file to code-behind file. /// protected global::AjaxControlToolkit.AutoCompleteExtender aceSearch; - - /// - /// btn1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btn1; - - /// - /// btn2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btn2; } } diff --git a/GMW/GMW_Term/bin/GMW_Term.dll b/GMW/GMW_Term/bin/GMW_Term.dll index d9721279..ad4cb875 100644 Binary files a/GMW/GMW_Term/bin/GMW_Term.dll and b/GMW/GMW_Term/bin/GMW_Term.dll differ diff --git a/GMW/GMW_Term/bin/GMW_data.dll b/GMW/GMW_Term/bin/GMW_data.dll index 37148059..08ef1d12 100644 Binary files a/GMW/GMW_Term/bin/GMW_data.dll and b/GMW/GMW_Term/bin/GMW_data.dll differ diff --git a/GMW/GMW_Term/obj/Debug/GMW_Term.dll b/GMW/GMW_Term/obj/Debug/GMW_Term.dll index d9721279..ad4cb875 100644 Binary files a/GMW/GMW_Term/obj/Debug/GMW_Term.dll and b/GMW/GMW_Term/obj/Debug/GMW_Term.dll differ diff --git a/GMW/GMW_Term/obj/Debug/ResolveAssemblyReference.cache b/GMW/GMW_Term/obj/Debug/ResolveAssemblyReference.cache index 3d7cfa25..77d3958f 100644 Binary files a/GMW/GMW_Term/obj/Debug/ResolveAssemblyReference.cache and b/GMW/GMW_Term/obj/Debug/ResolveAssemblyReference.cache differ diff --git a/GMW/GMW_data/MagClass.cs b/GMW/GMW_data/MagClass.cs index a1f3865b..0a8a02f6 100644 --- a/GMW/GMW_data/MagClass.cs +++ b/GMW/GMW_data/MagClass.cs @@ -895,6 +895,56 @@ namespace GMW_data { } return answ; } + /// + /// vero/falso che l'utent eha una lista di prelievo attiva + /// + public bool userHasActiveLP + { + get + { + bool answ = false; + try + { + answ = (MagClass.magazzino.taElencoListePrelievo.getByCodSogg(CodSoggCurrUser).Rows.Count > 0); + } + catch + { } + return answ; + } + } + /// + /// codice della lista di prelievo attiva + /// + public string codListaAttivaUtente + { + get + { + string answ = ""; + try + { + answ = MagClass.magazzino.taElencoListePrelievo.getByCodSogg(CodSoggCurrUser)[0].CodLista; + } + catch + { } + return answ; + } + } + /// + /// + /// + /// + /// + public bool listaPrelevabile(string CodLista) + { + bool answ = false; + try + { + answ = (MagClass.magazzino.taElencoListePrelievo.getByCodLista(CodLista).Select("CodStatoLista = 1").Length > 0); // filtro su stato = 1 (può esser presa in carico) + } + catch + { } + return answ; + } #endregion diff --git a/GMW/GMW_data/bin/Debug/GMW_data.dll b/GMW/GMW_data/bin/Debug/GMW_data.dll index 37148059..08ef1d12 100644 Binary files a/GMW/GMW_data/bin/Debug/GMW_data.dll and b/GMW/GMW_data/bin/Debug/GMW_data.dll differ diff --git a/GMW/GMW_data/obj/Debug/GMW_data.dll b/GMW/GMW_data/obj/Debug/GMW_data.dll index 37148059..08ef1d12 100644 Binary files a/GMW/GMW_data/obj/Debug/GMW_data.dll and b/GMW/GMW_data/obj/Debug/GMW_data.dll differ diff --git a/GMW/GMW_data/obj/Debug/Refactor/GMW_data.dll b/GMW/GMW_data/obj/Debug/Refactor/GMW_data.dll index 6659139d..bc9b886c 100644 Binary files a/GMW/GMW_data/obj/Debug/Refactor/GMW_data.dll and b/GMW/GMW_data/obj/Debug/Refactor/GMW_data.dll differ