Fix insert/edit pedana...

This commit is contained in:
Samuele E. Locatelli
2020-03-24 12:03:09 +01:00
parent 382916df7d
commit 70604473a0
6 changed files with 84 additions and 20 deletions
+4 -3
View File
@@ -8,9 +8,10 @@
<div class="card-body py-0">
<div class="row table-dark py-1">
<div class="col-6">
<asp:CheckBox runat="server" ID="chkFiltKey" Text="Filtro LDP" AutoPostBack="true" OnCheckedChanged="chkFiltKey_CheckedChanged" />
<asp:CheckBox runat="server" ID="chkFiltKey" Text="Nome LDP" AutoPostBack="true" OnCheckedChanged="chkFiltKey_CheckedChanged" />
</div>
<div class="col-6">
<asp:HiddenField runat="server" ID="hfLastFilt" />
<asp:TextBox runat="server" ID="txtKeyFilt" CssClass="form form-control" AutoPostBack="true" OnTextChanged="txtKeyFilt_TextChanged" />
</div>
<div class="col-3">
@@ -38,7 +39,7 @@
</div>
</div>
<div class="row">
<div class="col-12">
<div class="col-12 px-0">
<asp:GridView ID="grView" runat="server" AutoGenerateColumns="False" DataKeyNames="AL" DataSourceID="ods" CssClass="table table-striped table-condensed table-sm small" AllowPaging="True" OnSelectedIndexChanged="grView_SelectedIndexChanged">
<HeaderStyle CssClass="default" />
<PagerStyle CssClass="active GridPager" />
@@ -64,7 +65,7 @@
<asp:TextBox ID="txtKeyFilt" runat="server" Text='<%# Bind("KeyFilt") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton runat="server" ID="lbtSelFilt" OnClick="lbtSelFilt_Click" CssClass="text-primary" CommandArgument='<%# Eval("KeyFilt") %>'>
<asp:LinkButton runat="server" ID="lbtSelFilt" OnClick="lbtSelFilt_Click" CssClass="btn btn-sm btn-outline-primary" CommandArgument='<%# Eval("KeyFilt") %>'>
<asp:Label ID="lblKeyFilt" runat="server" Text='<%# Eval("KeyFilt") %>' />
</asp:LinkButton>
</ItemTemplate>
@@ -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();
}
/// <summary>
/// Filtro attivo
/// </summary>
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;
}
}
}
/// <summary>
/// Ultimo filtro valido
/// </summary>
protected string lastFiltKey
{
get
{
return hfLastFilt.Value;
}
set
{
hfLastFilt.Value = value;
}
}
/// <summary>
/// TOggle buttons x add new pedana
/// </summary>
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 = "";
}
}
/// <summary>
@@ -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
{ }
@@ -23,6 +23,15 @@ namespace MP_MAG.WebUserControls
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkFiltKey;
/// <summary>
/// Controllo hfLastFilt.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfLastFilt;
/// <summary>
/// Controllo txtKeyFilt.
/// </summary>
+1 -1
View File
@@ -1,7 +1,7 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_menuTop.ascx.cs" Inherits="MP_MAG.WebUserControls.cmp_menuTop" %>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark text-light py-1 mb-0">
<asp:LinkButton runat="server" ID="lbnUpdate" Text="---" OnClick="lbnUpdate_Click" CssClass="navbar-brand" ToolTip="Update + HOME"><i class="fas fa-warehouse"></i> MP-MAG | </asp:LinkButton>
<asp:LinkButton runat="server" ID="lbnUpdate" Text="---" OnClick="lbnUpdate_Click" CssClass="navbar-brand" ToolTip="Update + HOME"><i class="fas fa-warehouse"></i> MP-MAG </asp:LinkButton>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
+10 -3
View File
@@ -6245,6 +6245,7 @@ namespace MagData.DS_MagTableAdapters {
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@DayRef", global::System.Data.SqlDbType.DateTime, 8, global::System.Data.ParameterDirection.Input, 23, 3, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Flusso", global::System.Data.SqlDbType.NVarChar, 50, 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("@CodSoggetto", global::System.Data.SqlDbType.NVarChar, 50, 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("@KeyFilt", global::System.Data.SqlDbType.NVarChar, 50, 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("@Descr", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[3] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[3].Connection = this.Connection;
@@ -6319,7 +6320,7 @@ namespace MagData.DS_MagTableAdapters {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
public virtual DS_Mag.ElencoALDataTable insertQuery(global::System.Nullable<global::System.DateTime> DayRef, string Flusso, string CodSoggetto, string Descr) {
public virtual DS_Mag.ElencoALDataTable insertQuery(global::System.Nullable<global::System.DateTime> DayRef, string Flusso, string CodSoggetto, string KeyFilt, string Descr) {
this.Adapter.SelectCommand = this.CommandCollection[2];
if ((DayRef.HasValue == true)) {
this.Adapter.SelectCommand.Parameters[1].Value = ((System.DateTime)(DayRef.Value));
@@ -6339,11 +6340,17 @@ namespace MagData.DS_MagTableAdapters {
else {
this.Adapter.SelectCommand.Parameters[3].Value = ((string)(CodSoggetto));
}
if ((Descr == null)) {
if ((KeyFilt == null)) {
this.Adapter.SelectCommand.Parameters[4].Value = global::System.DBNull.Value;
}
else {
this.Adapter.SelectCommand.Parameters[4].Value = ((string)(Descr));
this.Adapter.SelectCommand.Parameters[4].Value = ((string)(KeyFilt));
}
if ((Descr == null)) {
this.Adapter.SelectCommand.Parameters[5].Value = global::System.DBNull.Value;
}
else {
this.Adapter.SelectCommand.Parameters[5].Value = ((string)(Descr));
}
DS_Mag.ElencoALDataTable dataTable = new DS_Mag.ElencoALDataTable();
this.Adapter.Fill(dataTable);
+7 -6
View File
@@ -375,6 +375,7 @@ FROM v_ElencoAL</CommandText>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@DayRef" Precision="23" ProviderType="DateTime" Scale="3" Size="8" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@Flusso" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@CodSoggetto" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@KeyFilt" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@Descr" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
@@ -403,7 +404,7 @@ FROM v_ElencoAL</CommandText>
<xs:element name="DS_Mag" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DS_Mag" msprop:Generator_UserDSName="DS_Mag">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="ElencoLotti" msprop:Generator_TableClassName="ElencoLottiDataTable" msprop:Generator_TableVarName="tableElencoLotti" msprop:Generator_TablePropName="ElencoLotti" msprop:Generator_RowDeletingName="ElencoLottiRowDeleting" msprop:Generator_RowChangingName="ElencoLottiRowChanging" msprop:Generator_RowEvHandlerName="ElencoLottiRowChangeEventHandler" msprop:Generator_RowDeletedName="ElencoLottiRowDeleted" msprop:Generator_UserTableName="ElencoLotti" msprop:Generator_RowChangedName="ElencoLottiRowChanged" msprop:Generator_RowEvArgName="ElencoLottiRowChangeEvent" msprop:Generator_RowClassName="ElencoLottiRow">
<xs:element name="ElencoLotti" msprop:Generator_TableClassName="ElencoLottiDataTable" msprop:Generator_TableVarName="tableElencoLotti" msprop:Generator_RowChangedName="ElencoLottiRowChanged" msprop:Generator_TablePropName="ElencoLotti" msprop:Generator_RowDeletingName="ElencoLottiRowDeleting" msprop:Generator_RowChangingName="ElencoLottiRowChanging" msprop:Generator_RowEvHandlerName="ElencoLottiRowChangeEventHandler" msprop:Generator_RowDeletedName="ElencoLottiRowDeleted" msprop:Generator_RowClassName="ElencoLottiRow" msprop:Generator_UserTableName="ElencoLotti" msprop:Generator_RowEvArgName="ElencoLottiRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="Lotto" msprop:Generator_ColumnVarNameInTable="columnLotto" msprop:Generator_ColumnPropNameInRow="Lotto" msprop:Generator_ColumnPropNameInTable="LottoColumn" msprop:Generator_UserColumnName="Lotto">
@@ -478,7 +479,7 @@ FROM v_ElencoAL</CommandText>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ElencoUdc" msprop:Generator_TableClassName="ElencoUdcDataTable" msprop:Generator_TableVarName="tableElencoUdc" msprop:Generator_RowChangedName="ElencoUdcRowChanged" msprop:Generator_TablePropName="ElencoUdc" msprop:Generator_RowDeletingName="ElencoUdcRowDeleting" msprop:Generator_RowChangingName="ElencoUdcRowChanging" msprop:Generator_RowEvHandlerName="ElencoUdcRowChangeEventHandler" msprop:Generator_RowDeletedName="ElencoUdcRowDeleted" msprop:Generator_RowClassName="ElencoUdcRow" msprop:Generator_UserTableName="ElencoUdc" msprop:Generator_RowEvArgName="ElencoUdcRowChangeEvent">
<xs:element name="ElencoUdc" msprop:Generator_TableClassName="ElencoUdcDataTable" msprop:Generator_TableVarName="tableElencoUdc" msprop:Generator_TablePropName="ElencoUdc" msprop:Generator_RowDeletingName="ElencoUdcRowDeleting" msprop:Generator_RowChangingName="ElencoUdcRowChanging" msprop:Generator_RowEvHandlerName="ElencoUdcRowChangeEventHandler" msprop:Generator_RowDeletedName="ElencoUdcRowDeleted" msprop:Generator_UserTableName="ElencoUdc" msprop:Generator_RowChangedName="ElencoUdcRowChanged" msprop:Generator_RowEvArgName="ElencoUdcRowChangeEvent" msprop:Generator_RowClassName="ElencoUdcRow">
<xs:complexType>
<xs:sequence>
<xs:element name="UDC" msprop:Generator_ColumnVarNameInTable="columnUDC" msprop:Generator_ColumnPropNameInRow="UDC" msprop:Generator_ColumnPropNameInTable="UDCColumn" msprop:Generator_UserColumnName="UDC">
@@ -633,7 +634,7 @@ FROM v_ElencoAL</CommandText>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AnagArt" msprop:Generator_TableClassName="AnagArtDataTable" msprop:Generator_TableVarName="tableAnagArt" msprop:Generator_TablePropName="AnagArt" msprop:Generator_RowDeletingName="AnagArtRowDeleting" msprop:Generator_RowChangingName="AnagArtRowChanging" msprop:Generator_RowEvHandlerName="AnagArtRowChangeEventHandler" msprop:Generator_RowDeletedName="AnagArtRowDeleted" msprop:Generator_UserTableName="AnagArt" msprop:Generator_RowChangedName="AnagArtRowChanged" msprop:Generator_RowEvArgName="AnagArtRowChangeEvent" msprop:Generator_RowClassName="AnagArtRow">
<xs:element name="AnagArt" msprop:Generator_TableClassName="AnagArtDataTable" msprop:Generator_TableVarName="tableAnagArt" msprop:Generator_RowChangedName="AnagArtRowChanged" msprop:Generator_TablePropName="AnagArt" msprop:Generator_RowDeletingName="AnagArtRowDeleting" msprop:Generator_RowChangingName="AnagArtRowChanging" msprop:Generator_RowEvHandlerName="AnagArtRowChangeEventHandler" msprop:Generator_RowDeletedName="AnagArtRowDeleted" msprop:Generator_RowClassName="AnagArtRow" msprop:Generator_UserTableName="AnagArt" msprop:Generator_RowEvArgName="AnagArtRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="CodArt" msprop:Generator_ColumnVarNameInTable="columnCodArt" msprop:Generator_ColumnPropNameInRow="CodArt" msprop:Generator_ColumnPropNameInTable="CodArtColumn" msprop:Generator_UserColumnName="CodArt">
@@ -660,7 +661,7 @@ FROM v_ElencoAL</CommandText>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ODL" msprop:Generator_TableClassName="ODLDataTable" msprop:Generator_TableVarName="tableODL" msprop:Generator_RowChangedName="ODLRowChanged" msprop:Generator_TablePropName="ODL" msprop:Generator_RowDeletingName="ODLRowDeleting" msprop:Generator_RowChangingName="ODLRowChanging" msprop:Generator_RowEvHandlerName="ODLRowChangeEventHandler" msprop:Generator_RowDeletedName="ODLRowDeleted" msprop:Generator_RowClassName="ODLRow" msprop:Generator_UserTableName="ODL" msprop:Generator_RowEvArgName="ODLRowChangeEvent">
<xs:element name="ODL" msprop:Generator_TableClassName="ODLDataTable" msprop:Generator_TableVarName="tableODL" msprop:Generator_TablePropName="ODL" msprop:Generator_RowDeletingName="ODLRowDeleting" msprop:Generator_RowChangingName="ODLRowChanging" msprop:Generator_RowEvHandlerName="ODLRowChangeEventHandler" msprop:Generator_RowDeletedName="ODLRowDeleted" msprop:Generator_UserTableName="ODL" msprop:Generator_RowChangedName="ODLRowChanged" msprop:Generator_RowEvArgName="ODLRowChangeEvent" msprop:Generator_RowClassName="ODLRow">
<xs:complexType>
<xs:sequence>
<xs:element name="IdxODL" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnIdxODL" msprop:Generator_ColumnPropNameInRow="IdxODL" msprop:Generator_ColumnPropNameInTable="IdxODLColumn" msprop:Generator_UserColumnName="IdxODL" type="xs:int" />
@@ -727,7 +728,7 @@ FROM v_ElencoAL</CommandText>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Elencopost2Queue" msprop:Generator_TableClassName="Elencopost2QueueDataTable" msprop:Generator_TableVarName="tableElencopost2Queue" msprop:Generator_RowChangedName="Elencopost2QueueRowChanged" msprop:Generator_TablePropName="Elencopost2Queue" msprop:Generator_RowDeletingName="Elencopost2QueueRowDeleting" msprop:Generator_RowChangingName="Elencopost2QueueRowChanging" msprop:Generator_RowEvHandlerName="Elencopost2QueueRowChangeEventHandler" msprop:Generator_RowDeletedName="Elencopost2QueueRowDeleted" msprop:Generator_RowClassName="Elencopost2QueueRow" msprop:Generator_UserTableName="Elencopost2Queue" msprop:Generator_RowEvArgName="Elencopost2QueueRowChangeEvent">
<xs:element name="Elencopost2Queue" msprop:Generator_TableClassName="Elencopost2QueueDataTable" msprop:Generator_TableVarName="tableElencopost2Queue" msprop:Generator_TablePropName="Elencopost2Queue" msprop:Generator_RowDeletingName="Elencopost2QueueRowDeleting" msprop:Generator_RowChangingName="Elencopost2QueueRowChanging" msprop:Generator_RowEvHandlerName="Elencopost2QueueRowChangeEventHandler" msprop:Generator_RowDeletedName="Elencopost2QueueRowDeleted" msprop:Generator_UserTableName="Elencopost2Queue" msprop:Generator_RowChangedName="Elencopost2QueueRowChanged" msprop:Generator_RowEvArgName="Elencopost2QueueRowChangeEvent" msprop:Generator_RowClassName="Elencopost2QueueRow">
<xs:complexType>
<xs:sequence>
<xs:element name="CodPost" msprop:Generator_ColumnVarNameInTable="columnCodPost" msprop:Generator_ColumnPropNameInRow="CodPost" msprop:Generator_ColumnPropNameInTable="CodPostColumn" msprop:Generator_UserColumnName="CodPost">
@@ -747,7 +748,7 @@ FROM v_ElencoAL</CommandText>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ElencoAL" msprop:Generator_TableClassName="ElencoALDataTable" msprop:Generator_TableVarName="tableElencoAL" msprop:Generator_RowChangedName="ElencoALRowChanged" msprop:Generator_TablePropName="ElencoAL" msprop:Generator_RowDeletingName="ElencoALRowDeleting" msprop:Generator_RowChangingName="ElencoALRowChanging" msprop:Generator_RowEvHandlerName="ElencoALRowChangeEventHandler" msprop:Generator_RowDeletedName="ElencoALRowDeleted" msprop:Generator_RowClassName="ElencoALRow" msprop:Generator_UserTableName="ElencoAL" msprop:Generator_RowEvArgName="ElencoALRowChangeEvent">
<xs:element name="ElencoAL" msprop:Generator_TableClassName="ElencoALDataTable" msprop:Generator_TableVarName="tableElencoAL" msprop:Generator_TablePropName="ElencoAL" msprop:Generator_RowDeletingName="ElencoALRowDeleting" msprop:Generator_RowChangingName="ElencoALRowChanging" msprop:Generator_RowEvHandlerName="ElencoALRowChangeEventHandler" msprop:Generator_RowDeletedName="ElencoALRowDeleted" msprop:Generator_UserTableName="ElencoAL" msprop:Generator_RowChangedName="ElencoALRowChanged" msprop:Generator_RowEvArgName="ElencoALRowChangeEvent" msprop:Generator_RowClassName="ElencoALRow">
<xs:complexType>
<xs:sequence>
<xs:element name="AL" msprop:Generator_ColumnVarNameInTable="columnAL" msprop:Generator_ColumnPropNameInRow="AL" msprop:Generator_ColumnPropNameInTable="ALColumn" msprop:Generator_UserColumnName="AL">