From 36822c2a6b7dbfe2dff668fe3de4bf0e371e7ba5 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 5 Jan 2021 12:20:09 +0100 Subject: [PATCH] completata gestione copy/paste schede --- Jenkinsfile | 2 +- MP-ADM/BaseUserControl.cs | 15 ++++ MP-ADM/WebUserControls/cmp_ST_preview.ascx | 14 +++- MP-ADM/WebUserControls/cmp_ST_preview.ascx.cs | 81 +++++++++++++++++++ .../cmp_ST_preview.ascx.designer.cs | 18 +++++ .../WebUserControls/cmp_TechSheetMan.ascx.cs | 8 ++ MapoDb/DS_SheetTech.Designer.cs | 55 +++++++++++-- MapoDb/DS_SheetTech.xsd | 42 ++++++---- MapoDb/DS_SheetTech.xss | 2 +- 9 files changed, 210 insertions(+), 27 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8980aaf4..3a9da4fe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=1357']) { + withEnv(['NEXT_BUILD_NUMBER=1358']) { // env.versionNumber = VersionNumber(versionNumberString : '6.12.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '6.12.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO' diff --git a/MP-ADM/BaseUserControl.cs b/MP-ADM/BaseUserControl.cs index ada5ee1c..f9161331 100644 --- a/MP-ADM/BaseUserControl.cs +++ b/MP-ADM/BaseUserControl.cs @@ -76,6 +76,21 @@ namespace MP_ADM #region Public Properties + /// + /// Clipboard corrente utente + /// + public string clipboard + { + get + { + return memLayer.ML.StringSessionObj("UserClipboard"); + } + set + { + memLayer.ML.setSessionVal("UserClipboard", value); + } + } + /// /// titolo pagina /// diff --git a/MP-ADM/WebUserControls/cmp_ST_preview.ascx b/MP-ADM/WebUserControls/cmp_ST_preview.ascx index 35aaeae0..9d1b29a6 100644 --- a/MP-ADM/WebUserControls/cmp_ST_preview.ascx +++ b/MP-ADM/WebUserControls/cmp_ST_preview.ascx @@ -4,12 +4,20 @@
-
+

Scheda Tecnica Articolo

-
+
+ + PASTE +
-
+
+ + COPY + +
+
Modifica Scheda
diff --git a/MP-ADM/WebUserControls/cmp_ST_preview.ascx.cs b/MP-ADM/WebUserControls/cmp_ST_preview.ascx.cs index f3510bf7..aa283e50 100644 --- a/MP-ADM/WebUserControls/cmp_ST_preview.ascx.cs +++ b/MP-ADM/WebUserControls/cmp_ST_preview.ascx.cs @@ -9,6 +9,29 @@ namespace MP_ADM.WebUserControls { public partial class cmp_ST_preview : BaseUserControl { + #region Protected Fields + + protected string preClip = "IdxST:"; + + #endregion Protected Fields + + #region Protected Properties + + protected int clipbIdxST + { + get + { + int answ = 0; + if (!string.IsNullOrEmpty(clipboard)) + { + int.TryParse(clipboard.Replace(preClip, ""), out answ); + } + return answ; + } + } + + #endregion Protected Properties + #region Public Properties public int IdxST @@ -28,15 +51,73 @@ namespace MP_ADM.WebUserControls #endregion Public Properties + #region Private Methods + + private void checkClipboard() + { + bool showPaste = false; + // verifico ci sia qualcosa + if (!string.IsNullOrEmpty(clipboard)) + { + // verifico sia tipo clipboard valida + if (clipboard.StartsWith(preClip)) + { + //verifico sia intero valido + if (clipbIdxST > 0) + { + // verifico SIA una ST esistente... + var tabSTA = DataLayerObj.taSTA.getByKey(clipbIdxST); + showPaste = (tabSTA.Rows.Count > 0); + } + } + } + lbtPaste.Visible = showPaste; + } + + #endregion Private Methods + #region Protected Methods + protected void lbtCopy_Click(object sender, EventArgs e) + { + // salvo il clipboard la ST corrente... + clipboard = $"{preClip}{IdxST}"; + checkClipboard(); + } + protected void lbtDoEdit_Click(object sender, EventArgs e) { raiseNewVal(); } + /// + /// Effettua paste --> duplicazione Scheda Tecnica + /// + /// + /// + protected void lbtPaste_Click(object sender, EventArgs e) + { + // verifico codici... + if (clipbIdxST > 0 && IdxST > 0) + { + // se diversi... + if (clipbIdxST != IdxST) + { + // effettuo chiamata copy/paste + DataLayerObj.taSTAR.PasteAll(clipbIdxST, IdxST); + } + clipboard = ""; + } + raiseReset(); + } + protected void Page_Load(object sender, EventArgs e) { + if (!Page.IsPostBack) + { + clipboard = ""; + } + checkClipboard(); } #endregion Protected Methods diff --git a/MP-ADM/WebUserControls/cmp_ST_preview.ascx.designer.cs b/MP-ADM/WebUserControls/cmp_ST_preview.ascx.designer.cs index c4646f2c..8b62d0c6 100644 --- a/MP-ADM/WebUserControls/cmp_ST_preview.ascx.designer.cs +++ b/MP-ADM/WebUserControls/cmp_ST_preview.ascx.designer.cs @@ -14,6 +14,24 @@ namespace MP_ADM.WebUserControls public partial class cmp_ST_preview { + /// + /// Controllo lbtPaste. + /// + /// + /// 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.LinkButton lbtPaste; + + /// + /// Controllo lbtCopy. + /// + /// + /// 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.LinkButton lbtCopy; + /// /// Controllo lbtDoEdit. /// diff --git a/MP-ADM/WebUserControls/cmp_TechSheetMan.ascx.cs b/MP-ADM/WebUserControls/cmp_TechSheetMan.ascx.cs index eb31a943..2b9a4edf 100644 --- a/MP-ADM/WebUserControls/cmp_TechSheetMan.ascx.cs +++ b/MP-ADM/WebUserControls/cmp_TechSheetMan.ascx.cs @@ -63,6 +63,13 @@ namespace MP_ADM.WebUserControls editMode = true; } + private void Cmp_ST_preview_eh_resetSelezione(object sender, EventArgs e) + { + // resetto... + IdxST = dummyArt; + cmp_TechSheetArt.doUpdate(); + } + private void Cmp_TechSheetArt_eh_nuovoValore(object sender, EventArgs e) { IdxST = dummyArt; @@ -121,6 +128,7 @@ namespace MP_ADM.WebUserControls cmp_TechSheetArt.eh_resetSelezione += Cmp_TechSheetArt_eh_resetSelezione; cmp_TechSheetDetail.eh_nuovoValore += Cmp_TechSheetDetail_eh_nuovoValore; cmp_ST_preview.eh_nuovoValore += Cmp_ST_preview_eh_nuovoValore; + cmp_ST_preview.eh_resetSelezione += Cmp_ST_preview_eh_resetSelezione; } #endregion Protected Methods diff --git a/MapoDb/DS_SheetTech.Designer.cs b/MapoDb/DS_SheetTech.Designer.cs index 47dccfbb..0d70876e 100644 --- a/MapoDb/DS_SheetTech.Designer.cs +++ b/MapoDb/DS_SheetTech.Designer.cs @@ -4662,7 +4662,7 @@ SELECT IdxST, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Require [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] private void InitCommandCollection() { - this._commandCollection = new global::System.Data.SqlClient.SqlCommand[9]; + this._commandCollection = new global::System.Data.SqlClient.SqlCommand[10]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "SELECT DescGruppo, DescTipo, IdxST, Label, Oggetto, Num, CodGruppo, CodTip" + @@ -4719,13 +4719,20 @@ SELECT IdxST, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Require this._commandCollection[7].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IdxODL", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[8] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[8].Connection = this.Connection; - this._commandCollection[8].CommandText = "dbo.stp_ST_AR_UpdateVal"; + this._commandCollection[8].CommandText = "dbo.stp_ST_AR_PasteAll"; this._commandCollection[8].CommandType = global::System.Data.CommandType.StoredProcedure; this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_IdxST", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Label", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Oggetto", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Value", global::System.Data.SqlDbType.NVarChar, 250, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Src_IdxST", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[8].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Tgt_IdxST", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[9] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[9].Connection = this.Connection; + this._commandCollection[9].CommandText = "dbo.stp_ST_AR_UpdateVal"; + this._commandCollection[9].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[9].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[9].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_IdxST", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[9].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Label", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[9].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Oggetto", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[9].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Value", global::System.Data.SqlDbType.NVarChar, 250, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -5280,8 +5287,42 @@ SELECT IdxST, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Require [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - public virtual int UpdateVal(global::System.Nullable Original_IdxST, string Original_Label, global::System.Nullable Original_Oggetto, string Value) { + public virtual int PasteAll(global::System.Nullable Src_IdxST, global::System.Nullable Tgt_IdxST) { global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[8]; + if ((Src_IdxST.HasValue == true)) { + command.Parameters[1].Value = ((int)(Src_IdxST.Value)); + } + else { + command.Parameters[1].Value = global::System.DBNull.Value; + } + if ((Tgt_IdxST.HasValue == true)) { + command.Parameters[2].Value = ((int)(Tgt_IdxST.Value)); + } + else { + command.Parameters[2].Value = global::System.DBNull.Value; + } + global::System.Data.ConnectionState previousConnectionState = command.Connection.State; + if (((command.Connection.State & global::System.Data.ConnectionState.Open) + != global::System.Data.ConnectionState.Open)) { + command.Connection.Open(); + } + int returnValue; + try { + returnValue = command.ExecuteNonQuery(); + } + finally { + if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { + command.Connection.Close(); + } + } + return returnValue; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int UpdateVal(global::System.Nullable Original_IdxST, string Original_Label, global::System.Nullable Original_Oggetto, string Value) { + global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[9]; if ((Original_IdxST.HasValue == true)) { command.Parameters[1].Value = ((int)(Original_IdxST.Value)); } diff --git a/MapoDb/DS_SheetTech.xsd b/MapoDb/DS_SheetTech.xsd index e286d1d3..de85f97e 100644 --- a/MapoDb/DS_SheetTech.xsd +++ b/MapoDb/DS_SheetTech.xsd @@ -32,7 +32,7 @@ FROM v_ST_Actual - + dbo.stp_ST_A_DeleteQuery @@ -66,7 +66,7 @@ FROM v_ST_Actual - + dbo.stp_ST_A_InsertQuery @@ -79,7 +79,7 @@ FROM v_ST_Actual - + dbo.stp_ST_A_updateValid @@ -271,6 +271,18 @@ SELECT IdxST, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Require + + + + dbo.stp_ST_AR_PasteAll + + + + + + + + @@ -667,7 +679,7 @@ SELECT CodTempl, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Requ - + @@ -713,7 +725,7 @@ SELECT CodTempl, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Requ - + @@ -786,7 +798,7 @@ SELECT CodTempl, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Requ - + @@ -826,7 +838,7 @@ SELECT CodTempl, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Requ - + @@ -854,7 +866,7 @@ SELECT CodTempl, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Requ - + @@ -874,7 +886,7 @@ SELECT CodTempl, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Requ - + @@ -894,7 +906,7 @@ SELECT CodTempl, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Requ - + @@ -993,11 +1005,11 @@ SELECT CodTempl, Label, Oggetto, Num, CodGruppo, CodTipo, Value, CheckType, Requ - - - - - + + + + + \ No newline at end of file diff --git a/MapoDb/DS_SheetTech.xss b/MapoDb/DS_SheetTech.xss index a25b0946..e02d8c0e 100644 --- a/MapoDb/DS_SheetTech.xss +++ b/MapoDb/DS_SheetTech.xss @@ -4,7 +4,7 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - +