From 45e6f325414ca5b238cdcc29d15bc7bbd3bc1a63 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 20 Apr 2021 12:51:36 +0200 Subject: [PATCH] completato insert x ordini filtrabili (mass ADD) --- MP-MAG/MP-MAG.csproj | 8 + MP-MAG/WebUserControls/cmp_OrderListAdd.ascx | 38 ++- .../WebUserControls/cmp_OrderListAdd.ascx.cs | 47 ++-- .../cmp_OrderListAdd.ascx.designer.cs | 52 ++-- .../WebUserControls/cmp_selPeriodoFuturo.ascx | 6 + .../cmp_selPeriodoFuturo.ascx.cs | 254 ++++++++++++++++++ .../cmp_selPeriodoFuturo.ascx.designer.cs | 35 +++ 7 files changed, 397 insertions(+), 43 deletions(-) create mode 100644 MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx create mode 100644 MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx.cs create mode 100644 MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx.designer.cs diff --git a/MP-MAG/MP-MAG.csproj b/MP-MAG/MP-MAG.csproj index f07fa9b7..375f3efc 100644 --- a/MP-MAG/MP-MAG.csproj +++ b/MP-MAG/MP-MAG.csproj @@ -658,6 +658,13 @@ cmp_LottiOut.ascx + + cmp_selPeriodoFuturo.ascx + ASPXCodeBehind + + + cmp_selPeriodoFuturo.ascx + cmp_SelUdc.ascx ASPXCodeBehind @@ -908,6 +915,7 @@ + diff --git a/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx b/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx index 58b1c542..86c91bc1 100644 --- a/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx +++ b/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx @@ -1,8 +1,24 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_OrderListAdd.ascx.cs" Inherits="MP_MAG.WebUserControls.cmp_OrderListAdd" %> +<%@ Register Src="~/WebUserControls/cmp_selPeriodoFuturo.ascx" TagPrefix="uc1" TagName="cmp_selPeriodoFuturo" %>
- Ordini Aperti +
+
+ Ordini Aperti +
+
+
+
+ Articolo +
+ +
+
+
+ +
+
@@ -16,13 +32,13 @@ - <%----%> + + - <%-- --%> @@ -30,9 +46,6 @@ <%----%> <%----%> - - -
@@ -49,13 +62,20 @@
- - + + + + + + - + + + + diff --git a/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx.cs b/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx.cs index 1c213a30..fa603948 100644 --- a/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx.cs +++ b/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx.cs @@ -43,21 +43,8 @@ namespace MP_MAG.WebUserControls #region Private Methods - private void resetSelezione() + private void addOrder(string keySel) { - grView.SelectedIndex = -1; - grView.DataBind(); - raiseReset(); - } - - #endregion Private Methods - - #region Protected Methods - - protected void grView_SelectedIndexChanged(object sender, EventArgs e) - { - // recupero dati... - string keySel = grView.SelectedValue.ToString(); int numRigaOrd = 0; int.TryParse(keySel, out numRigaOrd); var tabOrdExt = MagData.MagDataLayer.man.taEOL.getByKey(numRigaOrd); @@ -78,14 +65,40 @@ namespace MP_MAG.WebUserControls } } + private void resetSelezione() + { + grView.SelectedIndex = -1; + grView.DataBind(); + raiseReset(); + } + + #endregion Private Methods + + #region Protected Methods + + protected void grView_SelectedIndexChanged(object sender, EventArgs e) + { + // invio valore selezionato... + addOrder($"{grView.SelectedValue}"); + } + /// - /// comando reset + /// Aggiunge tutti i record visualizzati /// /// /// - protected void lbtReset_Click(object sender, EventArgs e) + protected void lbtAddAll_Click(object sender, EventArgs e) { - resetSelezione(); + for (int i = 0; i < grView.Rows.Count; i++) + { + // seleziono + grView.SelectedIndex = i; + grView.DataBind(); + // recupero ed invio + addOrder($"{grView.SelectedValue}"); + } + grView.SelectedIndex = -1; + grView.DataBind(); } protected void Page_Load(object sender, EventArgs e) diff --git a/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx.designer.cs b/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx.designer.cs index c604a70a..46c3855f 100644 --- a/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx.designer.cs +++ b/MP-MAG/WebUserControls/cmp_OrderListAdd.ascx.designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ -// -// Codice generato da uno strumento. +// +// This code was generated by a tool. // -// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se -// il codice viene rigenerato. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// //------------------------------------------------------------------------------ namespace MP_MAG.WebUserControls @@ -15,38 +15,56 @@ namespace MP_MAG.WebUserControls { /// - /// Controllo grView. + /// txtCodArt control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCodArt; + + /// + /// cmp_selPeriodoFuturo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::MP_MAG.WebUserControls.cmp_selPeriodoFuturo cmp_selPeriodoFuturo; + + /// + /// grView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.GridView grView; /// - /// Controllo ods. + /// ods control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ObjectDataSource ods; /// - /// Controllo hfPackListID. + /// hfPackListID control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfPackListID; /// - /// Controllo hfCodCli. + /// hfCodCli control. /// /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField hfCodCli; } diff --git a/MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx b/MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx new file mode 100644 index 00000000..46ef131d --- /dev/null +++ b/MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx @@ -0,0 +1,6 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_selPeriodoFuturo.ascx.cs" Inherits="MP_MAG.WebUserControls.cmp_selPeriodoFuturo" %> + +
+ + +
\ No newline at end of file diff --git a/MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx.cs b/MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx.cs new file mode 100644 index 00000000..c08329a2 --- /dev/null +++ b/MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx.cs @@ -0,0 +1,254 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using SteamWare; + +namespace MP_MAG.WebUserControls +{ + public partial class cmp_selPeriodoFuturo : BaseUserControl + { + #region Protected Fields + + protected intervalloDate _intervallo; + + #endregion Protected Fields + + #region Protected Properties + + /// + /// definisce se sia da mostrare il selettore delle ore nel controllo + /// + protected bool mostraSelOra + { + get + { + bool answ = false; + if (memLayer.ML.isInSessionObject("mostraSelOra")) + { + answ = memLayer.ML.BoolSessionObj("mostraSelOra"); + } + else + { + // leggo da sessione e salvo... + try + { + answ = memLayer.ML.CRB("mostraSelOra"); + } + catch + { } + memLayer.ML.setSessionVal("mostraSelOra", answ); + } + return answ; + } + } + + #endregion Protected Properties + + #region Public Properties + + /// + /// indica se il controllo debba fare update in automatico o attendere pressione button update da utente + /// + public bool autoUpdate { get; set; } + + public DateTime fine + { + get + { + return intervalloAnalisi.fine; + } + } + + public DateTime inizio + { + get + { + return intervalloAnalisi.inizio; + } + } + + public intervalloDate intervalloAnalisi + { + get + { + return (intervalloDate)Session["_intervallo"]; + } + set + { + intervalloDate interv = value; + Session["_intervallo"] = interv; + Session["_inizio"] = interv.inizio; + Session["_fine"] = interv.fine; + _intervallo = interv; + aggiornaDateMostrate(false); + } + } + + #endregion Public Properties + + #region Private Methods + + /// + /// effettua update delle date mostrate da intervallo analisi (ed eventualmente riporta update...) + /// + /// + private void aggiornaDateMostrate(bool doReportUpdate) + { + scriviDate(); + if (doReportUpdate) + { + reportUpdate(); + } + } + + /// + /// update periodo + /// + private void aggiornaPeriodo() + { + _intervallo = new intervalloDate(); + // calcolo tempi arrotondati + _intervallo.inizio = Convert.ToDateTime(txtInizio.Text); + _intervallo.fine = Convert.ToDateTime(txtFine.Text); + verificaCoerenzaDate(); + reportUpdate(); + } + + /// + /// verifica la modifica delle date.. + /// + private void procDateMod() + { + aggiornaPeriodo(); + } + + /// + /// scrive nuove date in controllo + /// + private void scriviDate() + { + // se intervallo non è valorizzato leggo da sessione... + if (!_intervallo.isValid) + { + _intervallo = intervalloAnalisi; + } + txtInizio.Text = _intervallo.inizio.ToString("yyyy-MM-dd"); + txtFine.Text = _intervallo.fine.ToString("yyyy-MM-dd"); + } + + /// + /// imposta intervallo da sessione o di default + /// + private void setIntervallo() + { + //intervalloDate _intervallo; + try + { + _intervallo = (intervalloDate)Session["_intervallo"]; + } + catch + { + int numGG = memLayer.ML.CRI("defDayTo") > 1 ? memLayer.ML.CRI("defDayTo") : 30; + _intervallo = new intervalloDate(); + _intervallo.inizio = DateTime.Today; + _intervallo.fine = _intervallo.inizio.AddDays(numGG); + Session["_intervallo"] = _intervallo; + Session["_inizio"] = _intervallo.inizio; + Session["_fine"] = _intervallo.fine; + } + scriviDate(); + } + + /// + /// verifica che le date dell'intervallo siano coerenti (inizio < fine) + /// + private void verificaCoerenzaDate() + { + // controllo date siano coerenti (fine > inizio)... + if (_intervallo.inizio >= _intervallo.fine) + { + _intervallo.inizio = DateTime.Today; + _intervallo.fine = _intervallo.inizio.AddDays(memLayer.ML.CRI("defDayTo")); + } + //intervalloAnalisi = _intervallo; + aggiornaDateMostrate(false); + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// avvio componente + /// + /// + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + txtInizio.ToolTip = "inizio periodo di riferimento per i dati mostrati"; + txtFine.ToolTip = "fine periodo di riferimento per i dati mostrati"; + setIntervallo(); + } + + /// + /// caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + txtInizio.ToolTip = "inizio periodo di riferimento per i dati mostrati"; + txtFine.ToolTip = "fine periodo di riferimento per i dati mostrati"; + } + } + + /// + /// evento cambio testo data fine + /// + /// + /// + protected void txtFine_TextChanged(object sender, EventArgs e) + { + procDateMod(); + } + + /// + /// evento cambio testo data inizio + /// + /// + /// + protected void txtInizio_TextChanged(object sender, EventArgs e) + { + procDateMod(); + } + + #endregion Protected Methods + + #region Public Methods + + /// + /// effettua update + /// + /// + public void doUpdate(bool doReportUpdate) + { + aggiornaDateMostrate(doReportUpdate); + } + + /// + /// riporta aggiornamento a controller + /// + public void reportUpdate() + { + intervalloAnalisi = _intervallo; + base.raiseEvent(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx.designer.cs b/MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx.designer.cs new file mode 100644 index 00000000..6022ad43 --- /dev/null +++ b/MP-MAG/WebUserControls/cmp_selPeriodoFuturo.ascx.designer.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace MP_MAG.WebUserControls +{ + + + public partial class cmp_selPeriodoFuturo + { + + /// + /// txtInizio control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtInizio; + + /// + /// txtFine control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtFine; + } +}