Completata con gestione insert macchine multiplo

This commit is contained in:
Samuele E. Locatelli
2015-11-24 12:00:34 +01:00
parent 9be4998d00
commit 022cd9b18d
8 changed files with 34 additions and 56 deletions
Binary file not shown.
Binary file not shown.
@@ -54,33 +54,26 @@
<div runat="server" id="divAddNew">
<asp:LinkButton runat="server" ID="lbtAddNew" OnClick="lbtAddNew_Click"><%: traduci("addNewTag2Macc") %></asp:LinkButton>
<div style="font-size: 0.8em;">
<asp:DropDownList runat="server" ID="ddlMacc" DataSourceID="odsMaccAvail" DataTextField="label" DataValueField="value"></asp:DropDownList>
<asp:ObjectDataSource runat="server" ID="odsMaccAvail" OldValuesParameterFormatString="original_{0}" SelectMethod="avail4tag" TypeName="GIM_data.DS_utilityTableAdapters.v_selMacchineTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="hfTagCode" Name="TagCode" PropertyName="Value" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<div style="float: right;">
<asp:TextBox runat="server" ID="txtCercaMacchine" Width="8em" Text="*" AutoPostBack="True" />
</div>
<div>
<asp:ListBox ID="listMacchine" runat="server" AutoPostBack="True" DataSourceID="odsMacchine"
SelectionMode="Multiple" DataTextField="label" DataValueField="value" Height="200px"
Width="450px" BackColor="#ddffee" Font-Size="8pt" OnSelectedIndexChanged="listMacchine_SelectedIndexChanged"
OnDataBound="listMacchine_DataBound" />
<asp:ObjectDataSource ID="odsMacchine" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="avail4tag" TypeName="GIM_data.DS_utilityTableAdapters.v_selMacchineTableAdapter"
FilterExpression="label LIKE '%{0}%'">
<FilterParameters>
<asp:ControlParameter ControlID="txtCercaMacchine" DefaultValue="*" Type="String" Name="txtCercaMacchine" />
</FilterParameters>
<SelectParameters>
<asp:ControlParameter ControlID="hfTagCode" Name="TagCode" PropertyName="Value" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
</div>
<div style="float: right;">
<asp:TextBox runat="server" ID="txtCercaMacchine" Width="8em" Text="*" AutoPostBack="True" />
</div>
<div>
<asp:ListBox ID="listMacchine" runat="server" AutoPostBack="True" DataSourceID="odsMacchine"
SelectionMode="Multiple" DataTextField="label" DataValueField="value" Height="200px"
Width="450px" BackColor="#ddffee" Font-Size="8pt" OnSelectedIndexChanged="listMacchine_SelectedIndexChanged"
OnDataBound="listMacchine_DataBound" />
<asp:ObjectDataSource ID="odsMacchine" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="GIM_data.DS_utilityTableAdapters.v_selMacchineTableAdapter"
FilterExpression="label LIKE '%{0}%'">
<FilterParameters>
<asp:ControlParameter ControlID="txtCercaMacchine" DefaultValue="*" Type="String"
Name="txtCercaMacchine" />
</FilterParameters>
</asp:ObjectDataSource>
</div>
</div>
<asp:GridView ID="grViewMacc" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" PageSize="20" DataKeyNames="idxMacchina" DataSourceID="odsByTags" OnDataBound="grViewMacc_DataBound" OnRowEditing="grViewMacc_RowEditing" OnRowDeleted="grViewMacc_RowDeleted">
<RowStyle CssClass="ctrRowStyle" />
@@ -308,20 +308,23 @@ namespace GIM_site.WebUserControls
protected void lbtAddNew_Click(object sender, EventArgs e)
{
// aggiunge tag ad Macc selezionato...
// aggiunge tag a TUTTE le macchine selezionate...
int idxMacc = 0;
try
// spazzo TUTTE le righe del controllo...
foreach (ListItem riga in listMacchine.Items)
{
idxMacc = Convert.ToInt32(ddlMacc.SelectedValue);
}
catch
{ }
if (idxMacc > 0)
{
TA_app.obj.taTag2Macc.Insert(hfTagCode.Value, idxMacc);
grViewMacc.DataBind();
ddlMacc.DataBind();
// se è selezionata creo riga anche x lei...
if (riga.Selected)
{
idxMacc = Convert.ToInt32(riga.Value);
if (idxMacc > 0)
{
TA_app.obj.taTag2Macc.Insert(hfTagCode.Value, idxMacc);
}
}
}
grViewMacc.DataBind();
listMacchine.DataBind();
}
protected void grViewTags_RowDeleted(object sender, GridViewDeletedEventArgs e)
@@ -330,7 +333,7 @@ namespace GIM_site.WebUserControls
protected void grViewMacc_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
ddlMacc.DataBind();
listMacchine.DataBind();
}
protected void btnShowHideAdd_Click(object sender, EventArgs e)
@@ -102,24 +102,6 @@ namespace GIM_site.WebUserControls {
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtAddNew;
/// <summary>
/// ddlMacc control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlMacc;
/// <summary>
/// odsMaccAvail control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsMaccAvail;
/// <summary>
/// txtCercaMacchine control.
/// </summary>
Binary file not shown.
Binary file not shown.
Binary file not shown.