From 20e51e25f3e5651ef8a38f4cf992ad4f50bc8834 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 26 Oct 2022 18:27:35 +0200 Subject: [PATCH] Fix editing materiali --- AppData/DS_App.Designer.cs | 167 ++- AppData/DS_App.cs | 4 + AppData/DS_App.xsd | 45 +- AppData/DS_App.xss | 102 +- NKC_WF/Web.config | 960 +++++++++--------- NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx | 82 ++ .../WebUserControls/cmp_MaterialsMgmt.ascx.cs | 61 +- .../cmp_MaterialsMgmt.ascx.designer.cs | 29 +- NKC_WF/WebUserControls/cmp_plantMgmt.ascx | 4 +- NKC_WF/site/MaterialsMgmt.aspx.cs | 2 +- 10 files changed, 914 insertions(+), 542 deletions(-) diff --git a/AppData/DS_App.Designer.cs b/AppData/DS_App.Designer.cs index 75f1da4..f54244f 100644 --- a/AppData/DS_App.Designer.cs +++ b/AppData/DS_App.Designer.cs @@ -34672,12 +34672,39 @@ SELECT MatID, MatExtCode, MatDesc, ApprovDate, ApprovUser, L_mm, W_mm, T_mm, Mat [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "17.0.0.0")] private void InitCommandCollection() { - this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1]; + this._commandCollection = new global::System.Data.SqlClient.SqlCommand[4]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "SELECT MatID, MatExtCode, MatDesc, ApprovDate, ApprovUser, L_mm, W_mm, T_mm, MatD" + "tmx FROM dbo.Materials"; this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[1].Connection = this.Connection; + this._commandCollection[1].CommandText = "dbo.stp_Material_delete"; + this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[1].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[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_MatID", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[2].Connection = this.Connection; + this._commandCollection[2].CommandText = "dbo.stp_Material_insert"; + this._commandCollection[2].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[2].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[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@MatExtCode", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@MatDesc", global::System.Data.SqlDbType.NVarChar, 500, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@L_mm", global::System.Data.SqlDbType.Decimal, 9, global::System.Data.ParameterDirection.Input, 18, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@W_mm", global::System.Data.SqlDbType.Decimal, 9, global::System.Data.ParameterDirection.Input, 18, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@T_mm", global::System.Data.SqlDbType.Decimal, 9, global::System.Data.ParameterDirection.Input, 18, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[3].Connection = this.Connection; + this._commandCollection[3].CommandText = "dbo.stp_Material_update"; + this._commandCollection[3].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[3].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[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@MatExtCode", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@MatDesc", global::System.Data.SqlDbType.NVarChar, 500, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@L_mm", global::System.Data.SqlDbType.Decimal, 9, global::System.Data.ParameterDirection.Input, 18, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@W_mm", global::System.Data.SqlDbType.Decimal, 9, global::System.Data.ParameterDirection.Input, 18, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@T_mm", global::System.Data.SqlDbType.Decimal, 9, global::System.Data.ParameterDirection.Input, 18, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_MatID", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -34923,6 +34950,144 @@ SELECT MatID, MatExtCode, MatDesc, ApprovDate, ApprovUser, L_mm, W_mm, T_mm, Mat string Original_MatDtmx) { return this.Update(MatExtCode, MatDesc, ApprovDate, ApprovUser, L_mm, W_mm, T_mm, Original_MatID, Original_MatExtCode, Original_MatDesc, Original_ApprovDate, Original_ApprovUser, Original_L_mm, Original_W_mm, Original_T_mm, Original_MatDtmx, Original_MatID); } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "17.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int deleteQuery(string Original_MatID) { + global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[1]; + if ((Original_MatID == null)) { + command.Parameters[1].Value = global::System.DBNull.Value; + } + else { + command.Parameters[1].Value = ((string)(Original_MatID)); + } + 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", "17.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int insertQuery(global::System.Nullable MatExtCode, string MatDesc, global::System.Nullable L_mm, global::System.Nullable W_mm, global::System.Nullable T_mm) { + global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[2]; + if ((MatExtCode.HasValue == true)) { + command.Parameters[1].Value = ((int)(MatExtCode.Value)); + } + else { + command.Parameters[1].Value = global::System.DBNull.Value; + } + if ((MatDesc == null)) { + command.Parameters[2].Value = global::System.DBNull.Value; + } + else { + command.Parameters[2].Value = ((string)(MatDesc)); + } + if ((L_mm.HasValue == true)) { + command.Parameters[3].Value = ((decimal)(L_mm.Value)); + } + else { + command.Parameters[3].Value = global::System.DBNull.Value; + } + if ((W_mm.HasValue == true)) { + command.Parameters[4].Value = ((decimal)(W_mm.Value)); + } + else { + command.Parameters[4].Value = global::System.DBNull.Value; + } + if ((T_mm.HasValue == true)) { + command.Parameters[5].Value = ((decimal)(T_mm.Value)); + } + else { + command.Parameters[5].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", "17.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + public virtual int updateQuery(global::System.Nullable MatExtCode, string MatDesc, global::System.Nullable L_mm, global::System.Nullable W_mm, global::System.Nullable T_mm, string Original_MatID) { + global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[3]; + if ((MatExtCode.HasValue == true)) { + command.Parameters[1].Value = ((int)(MatExtCode.Value)); + } + else { + command.Parameters[1].Value = global::System.DBNull.Value; + } + if ((MatDesc == null)) { + command.Parameters[2].Value = global::System.DBNull.Value; + } + else { + command.Parameters[2].Value = ((string)(MatDesc)); + } + if ((L_mm.HasValue == true)) { + command.Parameters[3].Value = ((decimal)(L_mm.Value)); + } + else { + command.Parameters[3].Value = global::System.DBNull.Value; + } + if ((W_mm.HasValue == true)) { + command.Parameters[4].Value = ((decimal)(W_mm.Value)); + } + else { + command.Parameters[4].Value = global::System.DBNull.Value; + } + if ((T_mm.HasValue == true)) { + command.Parameters[5].Value = ((decimal)(T_mm.Value)); + } + else { + command.Parameters[5].Value = global::System.DBNull.Value; + } + if ((Original_MatID == null)) { + command.Parameters[6].Value = global::System.DBNull.Value; + } + else { + command.Parameters[6].Value = ((string)(Original_MatID)); + } + 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; + } } /// diff --git a/AppData/DS_App.cs b/AppData/DS_App.cs index dff28ce..4c1376f 100644 --- a/AppData/DS_App.cs +++ b/AppData/DS_App.cs @@ -4,6 +4,10 @@ partial class DS_App { + partial class OffOrd2ItemDataTable + { + } + partial class SheetsPreviewDataTable { } diff --git a/AppData/DS_App.xsd b/AppData/DS_App.xsd index f0d4693..f342d41 100644 --- a/AppData/DS_App.xsd +++ b/AppData/DS_App.xsd @@ -1232,7 +1232,50 @@ SELECT MatID, MatExtCode, MatDesc, ApprovDate, ApprovUser, L_mm, W_mm, T_mm, Mat - + + + + + dbo.stp_Material_delete + + + + + + + + + + + dbo.stp_Material_insert + + + + + + + + + + + + + + + dbo.stp_Material_update + + + + + + + + + + + + + diff --git a/AppData/DS_App.xss b/AppData/DS_App.xss index 12b38ac..00ed297 100644 --- a/AppData/DS_App.xss +++ b/AppData/DS_App.xss @@ -4,66 +4,66 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - 1189 - 282 + 1227 + 202 1153 - 282 + 202 @@ -191,7 +191,7 @@ - + 1042 diff --git a/NKC_WF/Web.config b/NKC_WF/Web.config index 216ad6f..be7408f 100644 --- a/NKC_WF/Web.config +++ b/NKC_WF/Web.config @@ -1,474 +1,476 @@ - + - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx b/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx index 32ad26a..8f8029f 100644 --- a/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx +++ b/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx @@ -1 +1,83 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_MaterialsMgmt.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_MaterialsMgmt" %> +<%@ Register Src="~/WebUserControls/cmp_numRow.ascx" TagPrefix="uc1" TagName="cmp_numRow" %> + + +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ diff --git a/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx.cs b/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx.cs index 2518317..a1b743a 100644 --- a/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx.cs @@ -1,17 +1,66 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; +using NKC_SDK; +using SteamWare; +using System; using System.Web.UI; -using System.Web.UI.WebControls; namespace NKC_WF.WebUserControls { - public partial class cmp_MaterialsMgmt : System.Web.UI.UserControl + public partial class cmp_MaterialsMgmt : BaseUserControl { + #region Protected Methods + + protected void lbtAddNew_Click(object sender, EventArgs e) + { + DLMan.taMat.insertQuery(999999, "NEW MATERIAL 999999", 1000, 1000, 10); + grView.SelectedIndex = -1; + grView.DataBind(); + } + protected void Page_Load(object sender, EventArgs e) { + if (!Page.IsPostBack) + { + cmp_numRow.numRow = 20; + grView.PageSize = cmp_numRow.numRow; + } + cmp_numRow.eh_doRefresh += Cmp_numRow_eh_doRefresh; + } + #endregion Protected Methods + + #region Private Methods + + private void Cmp_numRow_eh_doRefresh(object sender, EventArgs e) + { + // recupero num righe ed aggiorno... + grView.PageSize = cmp_numRow.numRow; + grView.DataBind(); + } + + public bool canEdit(object matId) + { + bool answ = $"{matId}" != "0"; + return answ; + } + + #endregion Private Methods + + protected void ods_Updating(object sender, System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs e) + { + string rawVal = ""; + string fixDecFrom = memLayer.ML.CRS("fixDecFrom"); + string fixDecTo = memLayer.ML.CRS("fixDecTo"); + if (memLayer.ML.CRB("fixDecimals")) + { + rawVal = $"{e.InputParameters["L_mm"]}"; + e.InputParameters["L_mm"] = rawVal.Replace(fixDecFrom, fixDecTo); + + rawVal = $"{e.InputParameters["W_mm"]}"; + e.InputParameters["W_mm"] = rawVal.Replace(fixDecFrom, fixDecTo); + + rawVal = $"{e.InputParameters["T_mm"]}"; + e.InputParameters["T_mm"] = rawVal.Replace(fixDecFrom, fixDecTo); + } } } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx.designer.cs index 7549cf9..e71ed26 100644 --- a/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx.designer.cs +++ b/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx.designer.cs @@ -3,7 +3,7 @@ // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,5 +13,32 @@ namespace NKC_WF.WebUserControls public partial class cmp_MaterialsMgmt { + + /// + /// cmp_numRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_numRow cmp_numRow; + + /// + /// 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; + + /// + /// ods control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource ods; } } diff --git a/NKC_WF/WebUserControls/cmp_plantMgmt.ascx b/NKC_WF/WebUserControls/cmp_plantMgmt.ascx index f478021..106839a 100644 --- a/NKC_WF/WebUserControls/cmp_plantMgmt.ascx +++ b/NKC_WF/WebUserControls/cmp_plantMgmt.ascx @@ -18,8 +18,8 @@ ToolTip='<%# traduci("Cancel") %>' CssClass="btn btn-warning btn-sm"> - - + + diff --git a/NKC_WF/site/MaterialsMgmt.aspx.cs b/NKC_WF/site/MaterialsMgmt.aspx.cs index 5ebd885..3e79258 100644 --- a/NKC_WF/site/MaterialsMgmt.aspx.cs +++ b/NKC_WF/site/MaterialsMgmt.aspx.cs @@ -13,7 +13,7 @@ namespace NKC_WF.site { if (!Page.IsPostBack) { - ((SiteContent)this.Master).showSearch = false; + ((SiteContent)this.Master).showSearch = true; } } }