From 70604473a04c06e0ae7d9ef21bd30dc2aee45d4c Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 24 Mar 2020 12:03:09 +0100 Subject: [PATCH] Fix insert/edit pedana... --- MP-MAG/WebUserControls/cmp_elencoPedane.ascx | 7 ++- .../WebUserControls/cmp_elencoPedane.ascx.cs | 60 ++++++++++++++++--- .../cmp_elencoPedane.ascx.designer.cs | 9 +++ MP-MAG/WebUserControls/cmp_menuTop.ascx | 2 +- MagData/DS_Mag.Designer.cs | 13 +++- MagData/DS_Mag.xsd | 13 ++-- 6 files changed, 84 insertions(+), 20 deletions(-) diff --git a/MP-MAG/WebUserControls/cmp_elencoPedane.ascx b/MP-MAG/WebUserControls/cmp_elencoPedane.ascx index 6d5759a..d7e75f8 100644 --- a/MP-MAG/WebUserControls/cmp_elencoPedane.ascx +++ b/MP-MAG/WebUserControls/cmp_elencoPedane.ascx @@ -8,9 +8,10 @@
- +
+
@@ -38,7 +39,7 @@
-
+
@@ -64,7 +65,7 @@ - + diff --git a/MP-MAG/WebUserControls/cmp_elencoPedane.ascx.cs b/MP-MAG/WebUserControls/cmp_elencoPedane.ascx.cs index e42915a..786d73a 100644 --- a/MP-MAG/WebUserControls/cmp_elencoPedane.ascx.cs +++ b/MP-MAG/WebUserControls/cmp_elencoPedane.ascx.cs @@ -29,8 +29,7 @@ namespace MP_MAG.WebUserControls grView.PageSize = cmp_numRow.numRow; txtData.Text = $"{DateTime.Today:yyyy-MM-dd}"; txtData.Visible = false; - txtKeyFilt.Visible = false; - txtKeyFilt.Text = ""; + filtKey = ""; divAddNew.Visible = false; } cmp_numRow.eh_doRefresh += Cmp_numRow_eh_doRefresh; @@ -71,7 +70,7 @@ namespace MP_MAG.WebUserControls protected void lbkAddNew_Click(object sender, EventArgs e) { // chiamo insert - MagDataLayer.man.taEAL.insertQuery(DateTime.Today, "PED", currProdData.CodOpr, txtDescr.Text.Trim()); + MagDataLayer.man.taEAL.insertQuery(DateTime.Today, "PED", currProdData.CodOpr, filtKey, txtDescr.Text.Trim()); // nascondo add... toggleAddNew(); // update!!! @@ -96,7 +95,47 @@ namespace MP_MAG.WebUserControls { toggleAddNew(); } - + /// + /// Filtro attivo + /// + protected string filtKey + { + get + { + string answ = txtKeyFilt.Text; + return answ; + } + set + { + txtKeyFilt.Text = value; + if (!string.IsNullOrEmpty(value)) + { + lastFiltKey = value; + txtKeyFilt.Visible = true; + } + else + { + txtKeyFilt.Visible = false; + } + } + } + /// + /// Ultimo filtro valido + /// + protected string lastFiltKey + { + get + { + return hfLastFilt.Value; + } + set + { + hfLastFilt.Value = value; + } + } + /// + /// TOggle buttons x add new pedana + /// private void toggleAddNew() { divAddNew.Visible = !divAddNew.Visible; @@ -105,13 +144,20 @@ namespace MP_MAG.WebUserControls // calcolo quante pedane ho... try { - var tabAL = MagDataLayer.man.taEAL.getBySearch(true, DateTime.Today, "*", "*"); + var tabAL = MagDataLayer.man.taEAL.getBySearch(true, DateTime.Today, filtKey, "*"); newNum = tabAL.Count + 1; } catch { } // descrizione txtDescr.Text = $"PEDANA {newNum}"; + // mostro se non ci fosse nome LDP + chkFiltKey.Checked = true; + txtKeyFilt.Visible = true; + if (!string.IsNullOrEmpty(hfLastFilt.Value)) + { + txtKeyFilt.Text = lastFiltKey; + } } protected void txtData_TextChanged(object sender, EventArgs e) @@ -138,7 +184,7 @@ namespace MP_MAG.WebUserControls txtKeyFilt.Visible = chkFiltKey.Checked; if (!chkFiltKey.Checked) { - txtKeyFilt.Text = ""; + filtKey = ""; } } /// @@ -153,7 +199,7 @@ namespace MP_MAG.WebUserControls LinkButton lbtSend = (LinkButton)sender; txtKeyFilt.Visible = true; chkFiltKey.Checked = true; - txtKeyFilt.Text = lbtSend.CommandArgument; + filtKey = lbtSend.CommandArgument; } catch { } diff --git a/MP-MAG/WebUserControls/cmp_elencoPedane.ascx.designer.cs b/MP-MAG/WebUserControls/cmp_elencoPedane.ascx.designer.cs index b41c037..c3e2bf7 100644 --- a/MP-MAG/WebUserControls/cmp_elencoPedane.ascx.designer.cs +++ b/MP-MAG/WebUserControls/cmp_elencoPedane.ascx.designer.cs @@ -23,6 +23,15 @@ namespace MP_MAG.WebUserControls /// protected global::System.Web.UI.WebControls.CheckBox chkFiltKey; + /// + /// Controllo hfLastFilt. + /// + /// + /// 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.HiddenField hfLastFilt; + /// /// Controllo txtKeyFilt. /// diff --git a/MP-MAG/WebUserControls/cmp_menuTop.ascx b/MP-MAG/WebUserControls/cmp_menuTop.ascx index 8f40220..9a941dc 100644 --- a/MP-MAG/WebUserControls/cmp_menuTop.ascx +++ b/MP-MAG/WebUserControls/cmp_menuTop.ascx @@ -1,7 +1,7 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_menuTop.ascx.cs" Inherits="MP_MAG.WebUserControls.cmp_menuTop" %>