aggiunta gestione selezione condomini da grView e deselezione ddlink x Richieste aperte

This commit is contained in:
Samuele E. Locatelli
2018-07-16 18:28:30 +02:00
parent d14898c6aa
commit add6adf26a
5 changed files with 82 additions and 34 deletions
+14 -25
View File
@@ -1,5 +1,6 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_ER_grid.ascx.cs" Inherits="PUB.WebUserContols.mod_ER_grid" %>
<asp:GridView runat="server" ID="grViewElRich" AutoGenerateColumns="False" DataKeyNames="idxRichiesta" DataSourceID="odsElRich" AllowPaging="True" Width="100%" AllowSorting="True" PageSize="5" CellPadding="4" ForeColor="#333333" GridLines="None" CssClass="table table-responsive table-striped" OnRowCancelingEdit="grViewElRich_RowCancelingEdit" OnRowEditing="grViewElRich_RowEditing" OnSelectedIndexChanging="grViewElRich_SelectedIndexChanging">
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
@@ -35,31 +36,29 @@
<ItemTemplate>
<div class="d-flex text-info">
<div class="p-2 flex-grow-1 text-info">
<i class="far fa-building"></i>
<asp:Label ID="Label5" runat="server" Text='<%# Eval("nom_cond") %>' />
</div>
<div class="p-2 text-warning">
<asp:LinkButton runat="server" ID="lbtSelCond" OnClick="lbtSelCond_Click" CausesValidation="False" CommandArgument='<%# Eval("idxCond") %>'>
<i class="far fa-building"></i>
<asp:Label ID="Label5" runat="server" Text='<%# Eval("nom_cond") %>' />
</asp:LinkButton></div><div class="p-2 text-warning">
<asp:Label ID="Label6" runat="server" Text='<%# Eval("cod_fornitore") %>' />
<i class="fas fa-industry"></i>
</div>
</div>
<div class="d-flex small">
<div class="p-2 flex-grow-1 text-secondary">
<div class="p-2 flex-grow-1 text-secondary">
<i class="fas fa-phone"></i>
<asp:Label ID="Label9" runat="server" Text='<%# Eval("telContatto") %>' />
(<asp:Label ID="Label7" runat="server" Text='<%# Eval("genContatto") %>' />)
</div>
<div class="p-2 text-secondary">
(<asp:Label ID="Label7" runat="server" Text='<%# Eval("genContatto") %>' />) </div><div class="p-2 text-secondary">
<asp:Label ID="Label8" runat="server" Text='<%# Eval("collaboratore") %>' />
<i class="far fa-user"></i>
</div>
</div>
</div>
<div class="d-flex small">
<div class="p-2">
<i class="far fa-bell"></i>
<asp:Label ID="lblFullText" runat="server" CssClass="small" Text='<%# Eval("messaggio") %>' />
</div>
</div>
</div>
</div>
<div class="d-flex small">
<div class="col-12 text-warning">
<i class="far fa-comment"></i>
@@ -80,19 +79,15 @@
<div class="col-6 text-secondary small">
<i class="fas fa-phone"></i>
<asp:Label ID="Label9" runat="server" Text='<%# Eval("telContatto") %>' />
(<asp:Label ID="Label7" runat="server" Text='<%# Eval("genContatto") %>' />)
</div>
<div class="col-6 text-secondary text-right small">
(<asp:Label ID="Label7" runat="server" Text='<%# Eval("genContatto") %>' />) </div><div class="col-6 text-secondary text-right small">
<asp:Label ID="Label8" runat="server" Text='<%# Eval("collaboratore") %>' />
<i class="far fa-user"></i>
</div>
<div class="col-12 small">
<i class="far fa-bell"></i>Messaggio
<asp:TextBox ID="txtMessaggio" runat="server" CssClass="form-control" Width="100%" Text='<%# Bind("messaggio") %>' Height="10em" TextMode="MultiLine" />
<i class="far fa-bell"></i>Messaggio <asp:TextBox ID="txtMessaggio" runat="server" CssClass="form-control" Width="100%" Text='<%# Bind("messaggio") %>' Height="10em" TextMode="MultiLine" />
</div>
<div class="col-12 text-warning small">
<i class="far fa-comment"></i>Note
<asp:TextBox ID="lblNote" runat="server" CssClass="form-control" Text='<%# Bind("note") %>' Height="5em" TextMode="MultiLine" />
<i class="far fa-comment"></i>Note <asp:TextBox ID="lblNote" runat="server" CssClass="form-control" Text='<%# Bind("note") %>' Height="5em" TextMode="MultiLine" />
</div>
</div>
</EditItemTemplate>
@@ -102,13 +97,7 @@
<div class="text-center">
<i class='<%# Eval("cssStato") %>'></i>
<br />
<asp:Label ID="Label1" runat="server" Text='<%# Eval("stato") %>'></asp:Label>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource runat="server" ID="odsElRich" OldValuesParameterFormatString="Original_{0}" SelectMethod="getByCondStato" TypeName="Data.DS_appTableAdapters.ElencolRichTableAdapter" UpdateMethod="UpdateText">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("stato") %>'></asp:Label></div></ItemTemplate></asp:TemplateField></Columns></asp:GridView><asp:ObjectDataSource runat="server" ID="odsElRich" OldValuesParameterFormatString="Original_{0}" SelectMethod="getByCondStato" TypeName="Data.DS_appTableAdapters.ElencolRichTableAdapter" UpdateMethod="UpdateText">
<SelectParameters>
<asp:SessionParameter DefaultValue="1" Name="idxAmm" SessionField="idxAmm" Type="Int32" />
<asp:ControlParameter ControlID="hfCondominio" DefaultValue="0" Name="idxCond" PropertyName="Value" Type="Int32" />
+24 -1
View File
@@ -9,9 +9,10 @@ namespace PUB.WebUserContols
{
public partial class mod_ER_grid : System.Web.UI.UserControl
{
public event EventHandler eh_selCond;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lbtReset_Click(object sender, EventArgs e)
@@ -79,5 +80,27 @@ namespace PUB.WebUserContols
hfStatoMax.Value = value;
}
}
/// <summary>
/// Selezionato un condominio --> riporto selezione
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtSelCond_Click(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
int idxCond = 0;
int.TryParse(lb.CommandArgument, out idxCond);
// sollevo evento selezione condominio...
eh_selCond?.Invoke(this, new SelCondEventArgs(idxCond));
}
}
/// <summary>
/// Evento parametrico sel condominio
/// </summary>
public class SelCondEventArgs : EventArgs
{
public SelCondEventArgs(int newIdxCond)
{ idxCond = newIdxCond; }
public int idxCond { get; set; }
}
}
+13 -8
View File
@@ -8,14 +8,19 @@
<h5 class="">Richieste</h5>
</div>
<div class="col-6 text-right">
<asp:DropDownList runat="server" ID="ddlCondominio" DataSourceID="odsCondomini" DataTextField="nome" DataValueField="idxCond" AppendDataBoundItems="true" AutoPostBack="true" OnSelectedIndexChanged="ddlCondominio_SelectedIndexChanged" CssClass="form-control">
<asp:ListItem Text="-- Selezionare Condominio --" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:ObjectDataSource runat="server" ID="odsCondomini" SelectMethod="getByAmm" TypeName="Data.DS_appTableAdapters.AnagCondominiTableAdapter">
<SelectParameters>
<asp:SessionParameter DefaultValue="1" Name="idxAmm" SessionField="idxAmm" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
<div class="input-group mb-3">
<div class="input-group-prepend">
<asp:LinkButton runat="server" ID="lbtResetCond" class="btn btn-outline-secondary" type="button" OnClick="lbtResetCond_Click"><i class="fas fa-ban"></i></asp:LinkButton>
</div>
<asp:DropDownList runat="server" ID="ddlCondominio" DataSourceID="odsCondomini" DataTextField="nome" DataValueField="idxCond" AppendDataBoundItems="true" AutoPostBack="true" OnSelectedIndexChanged="ddlCondominio_SelectedIndexChanged" CssClass="form-control">
<asp:ListItem Text="-- Selezionare Condominio --" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:ObjectDataSource runat="server" ID="odsCondomini" SelectMethod="getByAmm" TypeName="Data.DS_appTableAdapters.AnagCondominiTableAdapter">
<SelectParameters>
<asp:SessionParameter DefaultValue="1" Name="idxAmm" SessionField="idxAmm" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
</div>
<div class="col-3 text-right">
<asp:LinkButton runat="server" ID="lbtAddNew" CssClass="btn btn-danger btn-sm btn-block" Visible="false" OnClick="lbtAddNew_Click">Apri nuova &raquo;</asp:LinkButton>
@@ -18,6 +18,21 @@ namespace PUB.WebUserContols
// salvo le selezioni...
saveSelections();
}
mod_ER_grid.eh_selCond += Mod_ER_grid_eh_selCond;
}
private void Mod_ER_grid_eh_selCond(object sender, EventArgs e)
{
// recupero evento tipizzato
SelCondEventArgs ce = (SelCondEventArgs)e;
// imposto!
try
{
ddlCondominio.SelectedValue = ce.idxCond.ToString();
}
catch
{ }
saveSelections();
}
private void saveSelections()
@@ -94,5 +109,12 @@ namespace PUB.WebUserContols
DtProxy.man.taElRich.InsertQuery(idxCond, idxForn, DateTime.Now, codCollab, txtContatto.Text.Trim(), txtTelefono.Text.Trim(), txtMessaggio.Text.Trim());
Response.Redirect(devicesAuthProxy.pagCorrente);
}
protected void lbtResetCond_Click(object sender, EventArgs e)
{
ddlCondominio.SelectedIndex = 0;
ddlCondominio.DataBind();
saveSelections();
}
}
}
+9
View File
@@ -12,6 +12,15 @@ namespace PUB.WebUserContols {
public partial class mod_ER_richieste {
/// <summary>
/// Controllo lbtResetCond.
/// </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.LinkButton lbtResetCond;
/// <summary>
/// Controllo ddlCondominio.
/// </summary>