test filtraggio da manterene

This commit is contained in:
Samuele E. Locatelli
2021-01-07 15:48:29 +01:00
parent 0be9218f9d
commit a529e150aa
6 changed files with 912 additions and 708 deletions
@@ -1,79 +1,66 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_adminProgetti.ascx.cs" Inherits="GPW_Admin.WebUserControls.mod_adminProgetti" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="mod_filtro.ascx" TagName="mod_filtro" TagPrefix="uc1" %>
<%@ Register Src="mod_periodoAnalisi.ascx" TagName="mod_periodoAnalisi" TagPrefix="uc2" %>
<%@ Register Src="mod_dettaglioProgetto.ascx" TagName="mod_dettaglioProgetto" TagPrefix="uc3" %>
<%@ Register Src="~/WebUserControls/cmp_periodoAnalisi.ascx" TagPrefix="uc1" TagName="cmp_periodoAnalisi" %>
<% if (false)
{ %>
<link href="~/css/Style.css" rel="stylesheet" type="text/css" />
<% } %>
<div class="filtro_1 fontPiccolo" style="white-space: nowrap; height: 30px;">
<div class="divSx">
<uc2:mod_periodoAnalisi ID="mod_periodoAnalisi1" runat="server" realtimeUpdate="true" />
<div class="row table-secondary mb-1">
<div class="col-4">
<uc1:cmp_periodoAnalisi runat="server" ID="cmp_periodoAnalisi" />
</div>
<div class="divSx">
<asp:CheckBox ID="chkShowChiusi" runat="server" Text="Mostra Archiviati" OnCheckedChanged="chkShowChiusi_CheckedChanged"
AutoPostBack="True" />
<div class="col-4 input-group-text">
<div class="row">
<div class="col">
<asp:CheckBox ID="chkShowChiusi" runat="server" Text="Mostra Archiviati" OnCheckedChanged="chkShowChiusi_CheckedChanged" AutoPostBack="True" />
</div>
<div class="col">
<asp:CheckBox ID="chkShowVuoti" runat="server" Text="Mostra Vuoti" AutoPostBack="True" OnCheckedChanged="chkShowVuoti_CheckedChanged" Checked="true" />
</div>
<div class="col">
<asp:CheckBox ID="chkShowOnlyStarred" runat="server" Text="Mostra SOLO Starred" AutoPostBack="True" OnCheckedChanged="chkShowOnlyStarred_CheckedChanged" Checked="false" />
</div>
<div class="col">
<asp:LinkButton runat="server" ID="lbtResetFilt" ToolTip="Reset Filtro" OnClick="lbtResetFilt_Click" CssClass="btn btn-sm btn-block btn-outline-info"><i class="fa fa-times" aria-hidden="true"></i></asp:LinkButton>
</div>
</div>
</div>
<div class="divSx">
<div class="col-3">
<uc1:mod_filtro ID="filtroCli" runat="server" filterChekText="filtroCliente" comboWidth="180" />
</div>
<%--<div class="divSx">
<uc1:mod_filtro ID="filtroDip" runat="server" filterChekText="filtroDipendenti" comboWidth="180" />
</div>--%>
<div class="divSx">
<asp:CheckBox ID="chkShowVuoti" runat="server" Text="Mostra Vuoti" AutoPostBack="True"
OnCheckedChanged="chkShowVuoti_CheckedChanged" Checked="true" />
</div>
<div class="divSx">
<asp:CheckBox ID="chkShowOnlyStarred" runat="server" Text="Mostra SOLO Starred" AutoPostBack="True"
OnCheckedChanged="chkShowOnlyStarred_CheckedChanged" Checked="false" />
</div>
</div>
<div class="divSx" style="min-width: 600px;">
<div class="fontPiccolo">
<asp:GridView ID="grView" runat="server" AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4"
DataKeyNames="idxProgetto" DataSourceID="ods" ForeColor="#333333" GridLines="None" OnDataBound="grView_DataBound" OnSelectedIndexChanged="grView_SelectedIndexChanged"
OnRowUpdating="grView_RowUpdating">
<AlternatingRowStyle CssClass="alternatingRowStyle" />
<EditRowStyle CssClass="editRowStyle" />
<FooterStyle CssClass="footerStyle" ForeColor="White" />
<HeaderStyle CssClass="headerStyle" ForeColor="White" />
<PagerStyle CssClass="pagerStyle" ForeColor="White" />
<RowStyle CssClass="rowStyle" />
<SelectedRowStyle CssClass="selectedRowStyle" ForeColor="#333333" />
<SortedAscendingCellStyle CssClass="sortAscCell" />
<SortedAscendingHeaderStyle CssClass="sortAscHead" />
<SortedDescendingCellStyle CssClass="sortDescCell" />
<SortedDescendingHeaderStyle CssClass="sortDescHead" />
<div class="row table-default small">
<div class="col-12">
<asp:GridView ID="grView" runat="server" AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False" CssClass="table table-sm table-striped" DataKeyNames="idxProgetto" DataSourceID="ods" OnDataBound="grView_DataBound" OnSelectedIndexChanged="grView_SelectedIndexChanged" OnRowUpdating="grView_RowUpdating">
<EditRowStyle CssClass="table-primary" />
<SelectedRowStyle CssClass="table-info" />
<HeaderStyle CssClass="default" />
<PagerStyle CssClass="active GridPager" />
<PagerSettings Mode="NumericFirstLast" />
<Columns>
<asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center" ItemStyle-Wrap="false" ItemStyle-Width="72px" ItemStyle-VerticalAlign="Middle"
ItemStyle-Height="26px">
<asp:TemplateField ShowHeader="False" ItemStyle-Wrap="false" ItemStyle-VerticalAlign="Middle">
<HeaderTemplate>
<asp:LinkButton ID="lbtReset" runat="server" CssClass="btn btn-sm btn-info" ToolTip='<%# traduci("Reset") %>' CausesValidation="False" OnClick="btnReset_Click" Visible="true"><i class="fa fa-refresh" aria-hidden="true"></i></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:ImageButton ID="imgSelect" runat="server" CausesValidation="False" CommandName="Select" ToolTip='<%# traduci("Select") %>'
ImageUrl="~/images/view_m.png" />
<asp:ImageButton ID="imgEdit" runat="server" CausesValidation="False" CommandName="Edit" ToolTip='<%# traduci("Edit") %>'
ImageUrl="~/images/edit_m.png" Visible='<%# isWritable() %>' />
<asp:ImageButton ID="imgDettFasi" runat="server" CausesValidation="False" CommandArgument="dettFasi" CommandName="Update"
ToolTip='<%# traduci("go2dettFasi") %>' ImageUrl="~/images/naviga_m.png" OnClick="imgDettFasi_Click" />
<asp:LinkButton runat="server" ID="lbtSelect" CssClass="btn btn-sm btn-info" CausesValidation="False" CommandName="Select" ToolTip='<%# traduci("Select") %>'><i class="fa fa-search" aria-hidden="true"></i></asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtEdit" CssClass="btn btn-sm btn-primary" CausesValidation="False" CommandName="Edit" ToolTip='<%# traduci("Edit") %>'><i class="fa fa-edit" aria-hidden="true"></i></asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtDettFasi" CssClass="btn btn-sm btn-warning" CausesValidation="False" CommandArgument="dettFasi" CommandName="Update" ToolTip='<%# traduci("go2dettFasi") %>' OnClick="lbtDettFasi_Click"><i class="fa fa-arrow-right" aria-hidden="true"></i></asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:ImageButton ID="imgUpdate" runat="server" CausesValidation="False" CommandName="Update" ToolTip='<%# traduci("Update")%>'
ImageUrl="~/images/apply_s.png" />
<asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip='<%# traduci("Cancel") %>'
ImageUrl="~/images/cancel_s.png" />
<asp:LinkButton runat="server" ID="lbtUpdate" CssClass="btn btn-sm btn-success" CausesValidation="False" CommandName="Update" ToolTip='<%# traduci("Update") %>'><i class="fa fa-check" aria-hidden="true"></i></asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtCancel" CssClass="btn btn-sm btn-warning" CausesValidation="False" CommandName="Cancel" ToolTip='<%# traduci("Cancel") %>'><i class="fa fa-ban" aria-hidden="true"></i></asp:LinkButton>
</EditItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="imgInsert" runat="server" CausesValidation="False" CommandName="Insert" ToolTip='<%# traduci("Insert") %>'
ImageUrl="~/images/new_s.png" OnClick="lblIns_click" />
<asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip='<%# traduci("Cancel") %>'
ImageUrl="~/images/cancel_s.png" />
<asp:LinkButton runat="server" ID="lbtInsert" CssClass="btn btn-sm btn-success" CausesValidation="False" CommandName="Insert" ToolTip='<%# traduci("Insert") %>' OnClick="lblIns_click"><i class="fa fa-plus" aria-hidden="true"></i></asp:LinkButton>
<asp:LinkButton runat="server" ID="lbtCancel" CssClass="btn btn-sm btn-warning" CausesValidation="False" CommandName="Cancel" ToolTip='<%# traduci("Cancel") %>'><i class="fa fa-ban" aria-hidden="true"></i></asp:LinkButton>
</FooterTemplate>
<HeaderTemplate>
<asp:ImageButton ID="imgBtnReset" runat="server" ToolTip='<%# traduci("Reset") %>' CausesValidation="False" OnClick="btnReset_Click"
ImageUrl="~/images/reload_l.png" Visible="true" />
</HeaderTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderText="RagSociale" SortExpression="RagSociale"
ItemStyle-Wrap="false">
@@ -91,12 +78,12 @@
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderText="nomeProj" SortExpression="nomeProj"
ItemStyle-Width="500px">
ItemStyle-Width="60em">
<ItemTemplate>
<div class="fontNormale">
<asp:Label ID="lblnomeProj" runat="server" Text='<%# Eval("nomeProj") %>' Font-Strikeout='<%# invBool(Eval("Attivo")) %>' />
</div>
<div class="labelInput">
<div class="small textCondens">
<asp:Label ID="lbldescrProj" runat="server" Text='<%# Eval("descrProj") %>' Font-Size="7pt" />
</div>
</ItemTemplate>
@@ -152,28 +139,17 @@
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Wrap="false">
<HeaderTemplate>
<asp:LinkButton runat="server" ID="lbt" CssClass="btn btn-sm btn-success" OnClick="btnNew_Click" ToolTip='<%# traduci("New") %>' Visible='<%# isWritable() && chkLicOk %>'><i class="fa fa-plus" aria-hidden="true"></i></asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandArgument='<%# Eval("idxProgetto") %>' CommandName="Delete"
ImageUrl="~/images/elimina_s.png" ToolTip='<%# traduci("Delete") %>' Visible='<%# delEnabled(Eval("idxProgetto")) %>' />
<asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText='<%# traduci("confermaDel")%>' TargetControlID="imgDelete"></asp:ConfirmButtonExtender>
<asp:LinkButton runat="server" ID="lbtDelete" CssClass="btn btn-sm btn-danger" CausesValidation="False" CommandArgument='<%# Eval("idxProgetto") %>' CommandName="Delete" ToolTip='<%# traduci("Delete") %>' Visible='<%# delEnabled(Eval("idxProgetto")) %>'><i class="fa fa-trash" aria-hidden="true"></i></asp:LinkButton>
<asp:ConfirmButtonExtender ID="cbeDelete" runat="server" ConfirmText='<%# traduci("confermaDel")%>' TargetControlID="lbtDelete"></asp:ConfirmButtonExtender>
</ItemTemplate>
<EditItemTemplate>
<asp:ImageButton ID="imgUpdate2" runat="server" CausesValidation="False" CommandName="Update" ImageUrl="~/images/apply_s.png"
ToolTip='<%# traduci("Update")%>' />
<asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/images/cancel_s.png"
ToolTip='<%# traduci("Cancel") %>' />
</EditItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="imgInsert2" runat="server" CausesValidation="False" CommandName="Insert" ImageUrl="~/images/new_s.png"
OnClick="lblIns_click" ToolTip='<%# traduci("Insert") %>' />
<asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/images/cancel_s.png"
ToolTip='<%# traduci("Cancel") %>' />
</FooterTemplate>
<HeaderTemplate>
<asp:ImageButton ID="imgBtnNew" runat="server" ToolTip='<%# traduci("New") %>' CausesValidation="False" OnClick="btnNew_Click"
ImageUrl="~/images/new_m.png" Visible='<%# isWritable() %>' />
</HeaderTemplate>
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
</asp:GridView>
@@ -208,8 +184,12 @@
<asp:Parameter Name="Original_idxProgetto" Type="Int32" />
</UpdateParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsClienti" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="GPW_data.DS_UtilityTableAdapters.v_selClientiTableAdapter"></asp:ObjectDataSource>
<asp:ObjectDataSource ID="odsClienti" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByConditio"
TypeName="GPW_data.DS_UtilityTableAdapters.v_selClientiTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="chkShowChiusi" DefaultValue="0" Name="Conditio" PropertyName="Checked" Type="Boolean" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:Label ID="lblNumRec" runat="server" CssClass="txtMini" />
</div>
</div>
@@ -8,53 +8,227 @@ using System.Data;
using SteamWare;
using GPW_data;
using System.ServiceModel;
using Newtonsoft.Json;
namespace GPW_Admin.WebUserControls
{
public class filtroProj
{
#region Public Constructors
/// <summary>
/// Init con valori specifici
/// </summary>
/// <param name="fCli"></param>
/// <param name="interv"></param>
/// <param name="onlStar"></param>
/// <param name="showA"></param>
/// <param name="showE"></param>
public filtroProj(bool fCli, intervalloDate interv, bool onlStar, bool showA, bool showE)
{
this.filtCli = fCli;
this.intAnalys = interv;
this.onlyStarred = onlStar;
this.showArch = showA;
this.showEmpty = showE;
}
/// <summary>
/// Init con valori default
/// </summary>
public filtroProj()
{
filtCli = false;
// imposto intervallo dal 2000.01.01...
intervalloDate date = new intervalloDate();
date.fine = DateTime.Now.Date.AddDays(1);
date.inizio = new DateTime(2000, 1, 1);
onlyStarred = false;
intAnalys = date;
showArch = false;
showEmpty = true;
}
#endregion Public Constructors
#region Public Properties
public bool filtCli { get; set; }
public intervalloDate intAnalys { get; set; }
public bool onlyStarred { get; set; }
public bool showArch { get; set; }
public bool showEmpty { get; set; }
#endregion Public Properties
}
public partial class mod_adminProgetti : System.Web.UI.UserControl
{
#region area standard (non modificare)
#region Public Events
#region gestione eventi
public event EventHandler eh_nuovoValore;
public event EventHandler eh_resetSelezione;
public event EventHandler eh_nuovoValore;
public event EventHandler eh_selValore;
#endregion
#endregion Public Events
#region Protected Properties
/// <summary>
/// effettua traduzione del lemma
/// Filtro attivo (formato OBJ)
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
protected filtroProj currFiltProjRaw
{
return user_std.UtSn.Traduci(lemma);
}
/// <summary>
/// resetta la selezione dei valori in caso di modifiche su altri controlli
/// </summary>
public void resetSelezione()
{
grView.SelectedIndex = -1;
grView.DataBind();
mod_dettaglioProgetto1.Visible = false;
if (eh_resetSelezione != null)
get
{
eh_resetSelezione(this, new EventArgs());
filtroProj answ = new filtroProj();
string rawData = memLayer.ML.StringSessionObj("currFiltProjRaw");
if (!string.IsNullOrEmpty(rawData))
{
try
{
answ = JsonConvert.DeserializeObject<filtroProj>(rawData);
}
catch
{ }
}
return answ;
}
set
{
string rawData = JsonConvert.SerializeObject(value);
memLayer.ML.setSessionVal("currFiltProjRaw", rawData);
}
}
#endregion Protected Properties
#region Public Properties
/// <summary>
/// reset della selezione
/// pagina corrente (URL finale)
/// </summary>
public string _paginaCorrente { get; set; }
/// <summary>
/// controllo stato licenze!
/// </summary>
public bool chkLicOk
{
get
{
return (licenzeGPW.utentiAttivi <= licenzeGPW.licenzeAttive);
}
}
/// <summary>
/// determina se siano da visualizzare i progetti già chiusi
/// </summary>
public bool showChiusi
{
get
{
return memLayer.ML.BoolSessionObj("showPrjArch");
}
set
{
memLayer.ML.setSessionVal("showPrjArch", value);
}
}
/// <summary>
/// determina se siano visibili SOLO progetti "Starred"
/// </summary>
public bool showOnlyStarred
{
get
{
return memLayer.ML.BoolSessionObj("showPrjStar");
}
set
{
memLayer.ML.setSessionVal("showPrjStar", value);
}
}
/// <summary>
/// determina se siano visibili progetti "vuoti" con zero ore caricate quindi
/// </summary>
public bool showVuoti
{
get
{
return memLayer.ML.BoolSessionObj("showPrjZeroH");
}
set
{
memLayer.ML.setSessionVal("showPrjZeroH", value);
}
}
#endregion Public Properties
#region Private Methods
/// <summary>
/// selezionato valore, filtro!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnReset_Click(object sender, EventArgs e)
private void filtroCli_eh_selValore(object sender, EventArgs e)
{
resetSelezione();
if (filtroCli.isChecked)
{
memLayer.ML.setSessionVal("idxCli_sel", filtroCli.valoreInt);
}
else
{
memLayer.ML.setSessionVal("idxCli_sel", 0);
}
grView.DataBind();
}
/// <summary>
/// cambiati dati dettaglio (attivo/inattivo)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mod_dettaglioProgetto1_eh_nuovoValore(object sender, EventArgs e)
{
doUpdate();
}
/// <summary>
/// resetta filtraggio
/// </summary>
private void resetFilter()
{
// svuoto variabili sessione
memLayer.ML.emptySessionVal("idxProgetto_sel");
memLayer.ML.emptySessionVal("idxCli_sel");
// genero un nuovo oggetto di default
currFiltProjRaw = new filtroProj();
setupFilter(currFiltProjRaw);
filtroCli.reselFirst();
}
private void setupFilter(filtroProj currFilt)
{
// imposto
cmp_periodoAnalisi.intervalloAnalisi = currFilt.intAnalys;
showChiusi = currFilt.showArch;
showVuoti = currFilt.showEmpty;
filtroCli.isChecked = currFilt.filtCli;
// salvo ulteriori valori
filtroCli.ods = odsClienti;
}
#endregion Private Methods
#region Protected Methods
/// <summary>
/// gestione evento richiesta nuovo valore (mostra footer, ...)
/// </summary>
@@ -75,26 +249,60 @@ namespace GPW_Admin.WebUserControls
eh_nuovoValore(this, new EventArgs());
}
}
/// <summary>
/// inserisce nuovo valore da footer
/// reset della selezione
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lblIns_click(object sender, EventArgs e)
protected void btnReset_Click(object sender, EventArgs e)
{
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
ods.Insert();
resetSelezione();
}
/// <summary>
/// annulla inserimento nuovo valore da footer
/// determina se mostrare i progetti archiviati
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lblCanc_click(object sender, EventArgs e)
protected void chkShowChiusi_CheckedChanged(object sender, EventArgs e)
{
// annullo inserimento: nascondo footer, bind controlli...
grView.FooterRow.Visible = false;
showChiusi = chkShowChiusi.Checked;
filtroCli.ods = odsClienti;
grView.DataBind();
}
protected void chkShowOnlyStarred_CheckedChanged(object sender, EventArgs e)
{
showOnlyStarred = chkShowOnlyStarred.Checked;
grView.DataBind();
}
/// <summary>
/// cambia impsotazione show/hide progetti con ore a zero...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void chkShowVuoti_CheckedChanged(object sender, EventArgs e)
{
showVuoti = chkShowVuoti.Checked;
grView.DataBind();
}
/// <summary>
/// elenco colonne del datagrid
/// </summary>
/// <returns></returns>
protected DataColumnCollection colonneObj()
{
DataColumnCollection colonne = null;
using (DS_Applicazione.AnagProgettiDataTable tabella = new DS_Applicazione.AnagProgettiDataTable())
{
colonne = tabella.Columns;
}
return colonne;
}
/// <summary>
/// traduce gli header delle colonne
/// </summary>
@@ -105,7 +313,7 @@ namespace GPW_Admin.WebUserControls
if (grView.Rows.Count > 0)
{
LinkButton lb;
// aggiorno gli headers
// aggiorno gli headers
foreach (TableCell cella in grView.HeaderRow.Cells)
{
try
@@ -125,191 +333,6 @@ namespace GPW_Admin.WebUserControls
}
}
#endregion
#region area CUSTOM (da modificare)
/// <summary>
/// pagina corrente (URL finale)
/// </summary>
public string _paginaCorrente { get; set; }
/// <summary>
/// determina se siano da visualizzare i progetti già chiusi
/// </summary>
public bool showChiusi
{
get
{
return memLayer.ML.BoolSessionObj("showPrjArch");
}
set
{
memLayer.ML.setSessionVal("showPrjArch", value);
}
}
/// <summary>
/// determina se siano visibili progetti "vuoti" con zero ore caricate quindi
/// </summary>
public bool showVuoti
{
get
{
return memLayer.ML.BoolSessionObj("showPrjZeroH");
}
set
{
memLayer.ML.setSessionVal("showPrjZeroH", value);
}
}
/// <summary>
/// determina se siano visibili SOLO progetti "Starred"
/// </summary>
public bool showOnlyStarred
{
get
{
return memLayer.ML.BoolSessionObj("showPrjStar");
}
set
{
memLayer.ML.setSessionVal("showPrjStar", value);
}
}
/// <summary>
/// caricamento
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
grView.PageSize = utils.pageSize;
if (!Page.IsPostBack)
{
// imposto intervallo date...10 anni...
intervalloDate date = new intervalloDate();
date.fine = DateTime.Now.Date.AddDays(1);
date.inizio = date.fine.AddYears(-20);
mod_periodoAnalisi1.intervalloAnalisi = date;
// svuoto variabili sessione
memLayer.ML.emptySessionVal("idxProgetto_sel");
memLayer.ML.emptySessionVal("idxCli_sel");
filtroCli.ods = odsClienti;
filtroCli.reselFirst();
filtroCli.isChecked = false;
showChiusi = false;
showVuoti = true;
mod_dettaglioProgetto1.Visible = false;
}
filtroCli.eh_selValore += new EventHandler(filtroCli_eh_selValore);
mod_dettaglioProgetto1.eh_nuovoValore += new EventHandler(mod_dettaglioProgetto1_eh_nuovoValore);
}
/// <summary>
/// salva in variabile pagina il nome della pagina corrente
/// </summary>
protected void PagCorrente()
{
Uri MyUrl = Request.Url;
string delimStr = "/";
char[] delimiter = delimStr.ToCharArray();
string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
int n = finalUrl.Length;
_paginaCorrente = finalUrl[n - 1].ToString();
}
/// <summary>
/// cambiati dati dettaglio (attivo/inattivo)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void mod_dettaglioProgetto1_eh_nuovoValore(object sender, EventArgs e)
{
doUpdate();
}
/// <summary>
/// selezionato valore, filtro!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void filtroCli_eh_selValore(object sender, EventArgs e)
{
if (filtroCli.isChecked)
{
memLayer.ML.setSessionVal("idxCli_sel", filtroCli.valoreInt);
}
else
{
memLayer.ML.setSessionVal("idxCli_sel", 0);
}
grView.DataBind();
}
/// <summary>
/// elenco colonne del datagrid
/// </summary>
/// <returns></returns>
protected DataColumnCollection colonneObj()
{
DataColumnCollection colonne = null;
using (DS_Applicazione.AnagProgettiDataTable tabella = new DS_Applicazione.AnagProgettiDataTable())
{
colonne = tabella.Columns;
}
return colonne;
}
/// <summary>
/// determina se sia eliminabile il record (=non usato)
/// </summary>
/// <param name="idxMaker"></param>
/// <returns></returns>
public bool delEnabled(object idxObj)
{
bool answ = isWritable();
// solo se ha diritti scrittura controllo
if (idxObj != null)
{
int trovati = 0;
int idxProj = 0;
_ = int.TryParse(idxObj.ToString(), out idxProj);
trovati = DataProxy.DP.taAF.getByIdxProgetto(idxProj).Count;
// controllo se ci sono record correlati...
if (trovati > 0)
{
answ = false;
}
}
return answ;
}
/// <summary>
/// evento selezione!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
memLayer.ML.setSessionVal("idxProgetto_sel", grView.SelectedDataKey["idxProgetto"]);
mod_dettaglioProgetto1.Visible = true;
if (eh_selValore != null)
{
eh_selValore(this, new EventArgs());
}
}
/// <summary>
/// determina se mostrare i progetti archiviati
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void chkShowChiusi_CheckedChanged(object sender, EventArgs e)
{
showChiusi = chkShowChiusi.Checked;
grView.DataBind();
}
/// <summary>
/// salvo in session che il prox comando è clonare...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void imgDettFasi_Click(object sender, ImageClickEventArgs e)
{
SteamWare.memLayer.ML.setSessionVal("nextObjCommand", "dettFasi");
}
/// <summary>
/// intercetto eventuale update fittizio x rimandare a pagina dett fasi
/// </summary>
@@ -345,110 +368,116 @@ namespace GPW_Admin.WebUserControls
// blocco update!
e.Cancel = true;
break;
default:
// faccio update!
break;
}
}
}
/// <summary>
/// effettua update controllo
/// </summary>
public void doUpdate()
{
resetSelezione();
}
/// <summary>
/// inverte valore booleano
/// </summary>
/// <param name="isEnt"></param>
/// <returns></returns>
public bool invBool(object valore)
{
bool answ = true;
try
{
answ = !Convert.ToBoolean(valore);
}
catch
{ }
return answ;
}
/// <summary>
/// restituisce una classe css a seconda dei valori passati:
/// green: bdgt > real
/// orange: real > bdgt*warning
/// red: real > bdgt
/// std: errore...
/// </summary>
/// <param name="real"></param>
/// <param name="bdgt"></param>
/// <returns></returns>
public string colorByVal(object real, object bdgt)
{
string answ = "badgeStd";
try
{
double valoreReal = Convert.ToDouble(real);
double valoreBdget = Convert.ToDouble(bdgt);
double valoreWarn = Convert.ToDouble(bdgt) * Convert.ToDouble(memLayer.ML.confReadString("warningRatioPerc")) / 100;
if (valoreReal >= valoreBdget)
{
answ = "badgeRosso";
}
else if (valoreReal >= valoreWarn)
{
answ = "badgeArancio";
}
else
{
answ = "badgeVerde";
}
}
catch
{
}
return "ui-corner-all " + answ;
}
/// <summary>
/// cambia impsotazione show/hide progetti con ore a zero...
/// evento selezione!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void chkShowVuoti_CheckedChanged(object sender, EventArgs e)
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
showVuoti = chkShowVuoti.Checked;
grView.DataBind();
}
protected void chkShowOnlyStarred_CheckedChanged(object sender, EventArgs e)
{
showOnlyStarred = chkShowOnlyStarred.Checked;
grView.DataBind();
}
/// <summary>
/// risponde alla domanda se l'utente abbia permesso tipo writable (S) nel permessi2funzione
/// </summary>
/// <returns></returns>
public bool isWritable()
{
bool answ = false;
if (_paginaCorrente == null)
memLayer.ML.setSessionVal("idxProgetto_sel", grView.SelectedDataKey["idxProgetto"]);
mod_dettaglioProgetto1.Visible = true;
if (eh_selValore != null)
{
PagCorrente();
}
answ = user_std.UtSn.isPageWriteEnabled(_paginaCorrente) && chkLicOk;
return answ;
}
/// <summary>
/// controllo stato licenze!
/// </summary>
public bool chkLicOk
{
get
{
return (licenzeGPW.utentiAttivi <= licenzeGPW.licenzeAttive);
eh_selValore(this, new EventArgs());
}
}
/// <summary>
/// annulla inserimento nuovo valore da footer
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lblCanc_click(object sender, EventArgs e)
{
// annullo inserimento: nascondo footer, bind controlli...
grView.FooterRow.Visible = false;
}
/// <summary>
/// inserisce nuovo valore da footer
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lblIns_click(object sender, EventArgs e)
{
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
ods.Insert();
}
/// <summary>
/// salvo in session che il prox comando è andare a dettaglio...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtDettFasi_Click(object sender, EventArgs e)
{
memLayer.ML.setSessionVal("nextObjCommand", "dettFasi");
}
protected void lbtResetFilt_Click(object sender, EventArgs e)
{
resetFilter();
}
/// <summary>
/// check licenze in fase di update...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
{
if (!licenzeGPW.checkLicenze)
{
if (e != null)
{
// annullo insert se licenze sforate...
e.Cancel = true;
grView.EditIndex = -1;
grView.DataBind();
}
}
}
/// <summary>
/// salva in variabile pagina il nome della pagina corrente
/// </summary>
protected void PagCorrente()
{
Uri MyUrl = Request.Url;
string delimStr = "/";
char[] delimiter = delimStr.ToCharArray();
string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
int n = finalUrl.Length;
_paginaCorrente = finalUrl[n - 1].ToString();
}
/// <summary>
/// caricamento
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
grView.PageSize = utils.pageSize;
if (!Page.IsPostBack)
{
// imposto filtro (precedente o da zero)
setupFilter(currFiltProjRaw);
mod_dettaglioProgetto1.Visible = false;
}
filtroCli.eh_selValore += new EventHandler(filtroCli_eh_selValore);
mod_dettaglioProgetto1.eh_nuovoValore += new EventHandler(mod_dettaglioProgetto1_eh_nuovoValore);
}
/// <summary>
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
@@ -487,12 +516,15 @@ namespace GPW_Admin.WebUserControls
case "textBox":
e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text;
break;
case "dropDownList":
e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue;
break;
case "checkBox":
e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked;
break;
default:
break;
}
@@ -507,26 +539,136 @@ namespace GPW_Admin.WebUserControls
}
}
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// check licenze in fase di update...
/// restituisce una classe css a seconda dei valori passati:
/// green: bdgt > real
/// orange: real > bdgt*warning
/// red: real > bdgt
/// std: errore...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
/// <param name="real"></param>
/// <param name="bdgt"></param>
/// <returns></returns>
public string colorByVal(object real, object bdgt)
{
if (!licenzeGPW.checkLicenze)
string answ = "badgeStd";
try
{
if (e != null)
double valoreReal = Convert.ToDouble(real);
double valoreBdget = Convert.ToDouble(bdgt);
double valoreWarn = Convert.ToDouble(bdgt) * Convert.ToDouble(memLayer.ML.confReadString("warningRatioPerc")) / 100;
if (valoreReal >= valoreBdget)
{
// annullo insert se licenze sforate...
e.Cancel = true;
grView.EditIndex = -1;
grView.DataBind();
answ = "badgeRosso";
}
else if (valoreReal >= valoreWarn)
{
answ = "badgeArancio";
}
else
{
answ = "badgeVerde";
}
}
catch
{
}
return "ui-corner-all " + answ;
}
/// <summary>
/// determina se sia eliminabile il record (=non usato)
/// </summary>
/// <param name="idxMaker"></param>
/// <returns></returns>
public bool delEnabled(object idxObj)
{
bool answ = isWritable();
// solo se ha diritti scrittura controllo
if (idxObj != null)
{
int trovati = 0;
int idxProj = 0;
_ = int.TryParse(idxObj.ToString(), out idxProj);
trovati = DataProxy.DP.taAF.getByIdxProgetto(idxProj).Count;
// controllo se ci sono record correlati...
if (trovati > 0)
{
answ = false;
}
}
return answ;
}
/// <summary>
/// effettua update controllo
/// </summary>
public void doUpdate()
{
resetSelezione();
}
/// <summary>
/// inverte valore booleano
/// </summary>
/// <param name="isEnt"></param>
/// <returns></returns>
public bool invBool(object valore)
{
bool answ = true;
try
{
answ = !Convert.ToBoolean(valore);
}
catch
{ }
return answ;
}
/// <summary>
/// risponde alla domanda se l'utente abbia permesso tipo writable (S) nel permessi2funzione
/// </summary>
/// <returns></returns>
public bool isWritable()
{
bool answ = false;
if (_paginaCorrente == null)
{
PagCorrente();
}
answ = user_std.UtSn.isPageWriteEnabled(_paginaCorrente) && chkLicOk;
return answ;
}
/// <summary>
/// resetta la selezione dei valori in caso di modifiche su altri controlli
/// </summary>
public void resetSelezione()
{
grView.SelectedIndex = -1;
grView.DataBind();
mod_dettaglioProgetto1.Visible = false;
if (eh_resetSelezione != null)
{
eh_resetSelezione(this, new EventArgs());
}
}
/// <summary>
/// effettua traduzione del lemma
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(string lemma)
{
return user_std.UtSn.Traduci(lemma);
}
#endregion
#endregion Public Methods
}
}
+20 -11
View File
@@ -15,13 +15,13 @@ namespace GPW_Admin.WebUserControls
{
/// <summary>
/// Controllo mod_periodoAnalisi1.
/// Controllo cmp_periodoAnalisi.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::mod_periodoAnalisi mod_periodoAnalisi1;
protected global::GPW_Admin.WebUserControls.cmp_periodoAnalisi cmp_periodoAnalisi;
/// <summary>
/// Controllo chkShowChiusi.
@@ -32,15 +32,6 @@ namespace GPW_Admin.WebUserControls
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkShowChiusi;
/// <summary>
/// Controllo filtroCli.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::mod_filtro filtroCli;
/// <summary>
/// Controllo chkShowVuoti.
/// </summary>
@@ -59,6 +50,24 @@ namespace GPW_Admin.WebUserControls
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkShowOnlyStarred;
/// <summary>
/// Controllo lbtResetFilt.
/// </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 lbtResetFilt;
/// <summary>
/// Controllo filtroCli.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::mod_filtro filtroCli;
/// <summary>
/// Controllo grView.
/// </summary>
+7 -10
View File
@@ -1,13 +1,10 @@
<%@ Control Language="C#" AutoEventWireup="true" Inherits="mod_filtro" CodeBehind="mod_filtro.ascx.cs" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<div>
<div style="float: left;">
<asp:CheckBox ID="chkFilt" runat="server" Checked="false" AutoPostBack="True" CssClass='<%# css %>' OnCheckedChanged="chkFilt_CheckedChanged" />
<div class="input-group">
<div class="input-group-prepend">
<asp:CheckBox ID="chkFilt" runat="server" Checked="false" AutoPostBack="True" CssClass='input-group-text <%# css %>' OnCheckedChanged="chkFilt_CheckedChanged" />
</div>
<div style="float: left;">
<asp:ComboBox ID="dlFilt" runat="server" Visible="False" DataTextField="label" DataValueField="value" AutoCompleteMode="SuggestAppend" DropDownStyle="DropDownList" AutoPostBack="True" OnSelectedIndexChanged="dlFilt_SelectedIndexChanged" CssClass="Windows" />
</div>
<div style="float: left;">
<asp:Label ID="where" runat="server" Visible="false" Text="" />
</div>
</div>
<asp:ComboBox ID="dlFilt" runat="server" Visible="False" DataTextField="label" DataValueField="value" AutoCompleteMode="SuggestAppend" DropDownStyle="DropDownList" AutoPostBack="True" OnSelectedIndexChanged="dlFilt_SelectedIndexChanged" CssClass="Windows" />
<asp:Label ID="where" runat="server" Visible="false" Text="" />
</div>
+349 -274
View File
@@ -12,19 +12,85 @@ using SteamWare;
public partial class mod_filtro : ApplicationUserControl
{
#region Protected Fields
protected bool _changeCheckEnabled = true;
protected bool _changeCheckVisible = true;
protected bool _changeSelEnabled = true;
protected string _css;
protected SteamWare.tipoVistaMod _modo = SteamWare.tipoVistaMod.editing;
protected ObjectDataSource _ods;
protected string _where = "";
/// <summary>
/// nome variabile x salvataggio filtro
/// </summary>
protected string nomeFiltro = $"valFiltro_";
/// <summary>
/// nome variabile x salvataggio stato SHOW ALL
/// </summary>
protected string showAll = $"_showAll_";
/// <summary>
/// nome variabile x salvataggio stato filtro
/// </summary>
protected string showFiltro = $"_showFiltered_";
#endregion Protected Fields
#region Public Events
public event EventHandler eh_selValore;
#endregion Public Events
#region Protected Properties
protected string _showAll
{
get
{
return memLayer.ML.StringSessionObj($"_showAll_{this.UniqueID}");
}
set
{
memLayer.ML.setSessionVal($"_showAll_{this.UniqueID}", value);
traduciObj();
}
}
protected string _showFiltered
{
get
{
return memLayer.ML.StringSessionObj(showFiltro);
}
set
{
memLayer.ML.setSessionVal(showFiltro, value);
traduciObj();
}
}
protected string _valore
{
get
{
return memLayer.ML.StringSessionObj(string.Format("valFiltro_{0}", this.ID));
return memLayer.ML.StringSessionObj(nomeFiltro);
}
set
{
memLayer.ML.setSessionVal(string.Format("valFiltro_{0}", this.ID), value, false);
memLayer.ML.setSessionVal(nomeFiltro, value, false);
}
}
/// <summary>
/// calcola se ci sia in sessione il valore del filtro
/// </summary>
@@ -35,149 +101,80 @@ public partial class mod_filtro : ApplicationUserControl
bool answ = false;
try
{
memLayer.ML.isInSessionObject(string.Format("valFiltro_{0}", this.ID));
memLayer.ML.isInSessionObject(nomeFiltro);
}
catch
{ }
return answ;
}
}
protected bool _changeCheckEnabled = true;
protected bool _changeCheckVisible = true;
protected bool _changeSelEnabled = true;
protected string _where = "";
protected string _showFiltered
{
get
{
return memLayer.ML.StringSessionObj(string.Format("_showFiltered_{0}", this.ID));
}
set
{
memLayer.ML.setSessionVal(string.Format("_showFiltered_{0}", this.ID), value);
traduciObj();
}
}
protected string _showAll
{
get
{
return memLayer.ML.StringSessionObj(string.Format("_showAll_{0}", this.ID));
}
set
{
memLayer.ML.setSessionVal(string.Format("_showAll_{0}", this.ID), value);
traduciObj();
}
}
protected override void OnInit(EventArgs e)
#endregion Protected Properties
#region Public Properties
/// <summary>
/// determina se sia possibile (de)selezionare il check di filtraggio, altrimenti sempre attivo
/// </summary>
public bool changeCheckEnabled
{
base.OnInit(e);
if (!Page.IsPostBack)
get
{
if (string.IsNullOrEmpty(_showFiltered)) _showFiltered = "mostraSoloSelez";
if (string.IsNullOrEmpty(_showAll)) _showAll = "mostraTutti";
return _changeCheckEnabled;
}
set
{
_changeCheckEnabled = value;
updateChk();
}
}
/// <summary>
/// traduzione oggetti
/// determina se sia possibile visibile il check di filtraggio
/// </summary>
protected override void traduciObj()
{
if (_changeCheckVisible)
{
if (!chkFilt.Checked)
{
chkFilt.Text = traduci(_showFiltered);
}
else
{
chkFilt.Text = traduci(_showAll);
}
}
}
/// <summary>
/// get/set messaggio di attivazione filtraggio
/// </summary>
public string filterChekText
public bool changeCheckVisible
{
get
{
return _showFiltered;
return _changeCheckVisible;
}
set
{
_showFiltered = value;
_changeCheckVisible = value;
updateChkLbl();
}
}
/// <summary>
/// get/set messaggio di disattivazione filtraggio
/// determina se sia possibile modificare la selezione
/// </summary>
public string filterUnchekText
public bool changeSelEnabled
{
get
{
return _showAll;
return _changeSelEnabled;
}
set
{
_showAll = value;
_changeSelEnabled = value;
updateSel();
}
}
protected void chkFilt_CheckedChanged(object sender, EventArgs e)
{
// cambio modalità visualizzazione del filtro...
dlFilt.Visible = !dlFilt.Visible;
raiseSelEvent();
}
protected void raiseSelEvent()
/// <summary>
/// get/set per la larghezza della combo dropdown
/// </summary>
public int comboWidth
{
if (!dlFilt.Visible)
get
{
memLayer.ML.setSessionVal(string.Format("valFiltro_{0}", this.ID), "", false);
return Convert.ToInt32(dlFilt.Width);
}
else
set
{
_valore = dlFilt.SelectedValue;
}
if (eh_selValore != null)
{
eh_selValore(this, new EventArgs());
dlFilt.Width = value;
}
}
protected void updateChk()
{
chkFilt.Enabled = _changeCheckEnabled;
if (!_changeCheckEnabled)
{
chkFilt.Checked = true;
dlFilt.Visible = true;
}
}
protected void updateSel()
{
dlFilt.Enabled = _changeSelEnabled;
}
protected void updateChkLbl()
{
chkFilt.Visible = _changeCheckVisible;
}
protected override void bindControlli()
{
updateChk();
fixValore();
where.Text = _where;
traduciObj();
}
protected SteamWare.tipoVistaMod _modo = SteamWare.tipoVistaMod.editing;
protected void dlFilt_SelectedIndexChanged(object sender, EventArgs e)
{
raiseSelEvent();
}
/// <summary>
/// condizione where per ridurre elementi mostrati in selettore
@@ -195,171 +192,50 @@ public partial class mod_filtro : ApplicationUserControl
}
/// <summary>
/// fornisce il valore scelto o "*" se nulla selezionato
/// css applicato agli elementi del controllo
/// </summary>
public string valore
public string css
{
get
{
string answ = "*";
if (chkFilt.Checked)
{
answ = dlFilt.SelectedValue;
}
return answ;
return _css;
}
set
{
_valore = value;
//fixValore();
_css = value;
}
}
/// <summary>
/// primo valore di una chiave multicampo
/// get/set messaggio di attivazione filtraggio
/// </summary>
public string val_1
public string filterChekText
{
get
{
string answ = "";
if (chkFilt.Checked)
{
try
{
string[] _dataKey = dlFilt.SelectedValue.Split('#');
answ = _dataKey[0];
}
catch
{ }
}
else
{
answ = "*";
}
return answ;
}
}
/// <summary>
/// secondo valore di una chiave multicampo
/// </summary>
public string val_2
{
get
{
string answ = "";
if (chkFilt.Checked)
{
try
{
string[] _dataKey = dlFilt.SelectedValue.Split('#');
answ = _dataKey[1];
}
catch
{ }
}
else
{
answ = "*";
}
return answ;
}
}
/// <summary>
/// fornisce il valore scelto o "0" se nulla selezionato o non valido
/// </summary>
public int valoreInt
{
get
{
int answ = -1;
try
{
if (chkFilt.Checked)
{
answ = Convert.ToInt32(dlFilt.SelectedValue);
}
}
catch
{ }
return answ;
}
}
/// <summary>
/// sistema visualizzazione
/// </summary>
protected void fixValore()
{
if (_ods != null)
{
try
{
dlFilt.DataSource = _ods;
dlFilt.DataBind();
if (!string.IsNullOrEmpty(_valore))
{
dlFilt.SelectedValue = _valore;
dlFilt.Visible = true;
chkFilt.Checked = true;
}
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Eccezione:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
dlFilt.SelectedIndex = 0;
}
}
}
public event EventHandler eh_selValore;
/// <summary>
/// determina se sia possibile (de)selezionare il check di filtraggio, altrimenti sempre attivo
/// </summary>
public bool changeCheckEnabled
{
get
{
return _changeCheckEnabled;
return _showFiltered;
}
set
{
_changeCheckEnabled = value;
updateChk();
_showFiltered = value;
}
}
/// <summary>
/// determina se sia possibile modificare la selezione
/// get/set messaggio di disattivazione filtraggio
/// </summary>
public bool changeSelEnabled
public string filterUnchekText
{
get
{
return _changeSelEnabled;
return _showAll;
}
set
{
_changeSelEnabled = value;
updateSel();
}
}
/// <summary>
/// determina se sia possibile visibile il check di filtraggio
/// </summary>
public bool changeCheckVisible
{
get
{
return _changeCheckVisible;
}
set
{
_changeCheckVisible = value;
updateChkLbl();
_showAll = value;
}
}
/// <summary>
/// get/set della checkbox
/// </summary>
@@ -389,22 +265,248 @@ public partial class mod_filtro : ApplicationUserControl
set
{
_ods = value;
reselFirst();
}
}
/// <summary>
/// css applicato agli elementi del controllo
/// primo valore di una chiave multicampo
/// </summary>
public string css
public string val_1
{
get
{
return _css;
string answ = "";
if (chkFilt.Checked)
{
try
{
string[] _dataKey = dlFilt.SelectedValue.Split('#');
answ = _dataKey[0];
}
catch
{ }
}
else
{
answ = "*";
}
return answ;
}
}
/// <summary>
/// secondo valore di una chiave multicampo
/// </summary>
public string val_2
{
get
{
string answ = "";
if (chkFilt.Checked)
{
try
{
string[] _dataKey = dlFilt.SelectedValue.Split('#');
answ = _dataKey[1];
}
catch
{ }
}
else
{
answ = "*";
}
return answ;
}
}
/// <summary>
/// fornisce il valore scelto o "*" se nulla selezionato
/// </summary>
public string valore
{
get
{
string answ = "*";
if (chkFilt.Checked)
{
answ = dlFilt.SelectedValue;
}
return answ;
}
set
{
_css = value;
_valore = value;
}
}
/// <summary>
/// fornisce il valore scelto o "0" se nulla selezionato o non valido
/// </summary>
public int valoreInt
{
get
{
int answ = -1;
try
{
if (chkFilt.Checked)
{
answ = Convert.ToInt32(dlFilt.SelectedValue);
}
}
catch
{ }
return answ;
}
}
#endregion Public Properties
#region Protected Methods
protected override void bindControlli()
{
updateChk();
fixValore();
where.Text = _where;
traduciObj();
}
protected void chkFilt_CheckedChanged(object sender, EventArgs e)
{
// cambio modalità visualizzazione del filtro...
dlFilt.Visible = !dlFilt.Visible;
raiseSelEvent();
}
protected void dlFilt_SelectedIndexChanged(object sender, EventArgs e)
{
raiseSelEvent();
}
/// <summary>
/// sistema visualizzazione
/// </summary>
protected void fixValore()
{
if (_ods != null)
{
try
{
dlFilt.DataSource = _ods;
dlFilt.DataBind();
if (!string.IsNullOrEmpty(_valore))
{
dlFilt.SelectedValue = _valore;
dlFilt.Visible = true;
chkFilt.Checked = true;
}
}
catch (Exception exc)
{
logger.lg.scriviLog($"Eccezione:{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
dlFilt.SelectedIndex = 0;
}
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (!Page.IsPostBack)
{
if (string.IsNullOrEmpty(_showFiltered)) _showFiltered = "mostraSoloSelez";
if (string.IsNullOrEmpty(_showAll)) _showAll = "mostraTutti";
}
}
protected override void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
nomeFiltro = $"valFiltro_{this.UniqueID}";
showFiltro = $"_showFiltered_{this.UniqueID}";
}
base.Page_Load(sender, e);
}
protected void raiseSelEvent()
{
if (!dlFilt.Visible)
{
memLayer.ML.setSessionVal(nomeFiltro, "", false);
}
else
{
_valore = dlFilt.SelectedValue;
}
if (eh_selValore != null)
{
eh_selValore(this, new EventArgs());
}
}
/// <summary>
/// traduzione oggetti
/// </summary>
protected override void traduciObj()
{
if (_changeCheckVisible)
{
if (!chkFilt.Checked)
{
chkFilt.Text = traduci(_showFiltered);
}
else
{
chkFilt.Text = traduci(_showAll);
}
}
}
protected void updateChk()
{
chkFilt.Enabled = _changeCheckEnabled;
if (!_changeCheckEnabled)
{
chkFilt.Checked = true;
dlFilt.Visible = true;
}
}
protected void updateChkLbl()
{
chkFilt.Visible = _changeCheckVisible;
}
protected void updateSel()
{
dlFilt.Enabled = _changeSelEnabled;
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// resetta e seleziona primo valore
/// </summary>
public void reselFirst()
{
try
{
dlFilt.DataBind();
bindControlli();
dlFilt.SelectedIndex = 0;
}
catch(Exception exc)
{
logger.lg.scriviLog($"Eccezione:{Environment.NewLine}{exc}", tipoLog.EXCEPTION);
}
}
/// <summary>
/// resetta il controllo (un-checked)
/// </summary>
@@ -412,35 +514,8 @@ public partial class mod_filtro : ApplicationUserControl
{
chkFilt.Checked = false;
dlFilt.Visible = false;
memLayer.ML.emptySessionVal(string.Format("valFiltro_{0}", this.ID));
}
/// <summary>
/// resetta e seleziona primo valore
/// </summary>
public void reselFirst()
{
dlFilt.DataBind();
bindControlli();
try
{
dlFilt.SelectedIndex = 0;
}
catch
{ }
}
/// <summary>
/// get/set per la larghezza della combo dropdown
/// </summary>
public int comboWidth
{
get
{
return Convert.ToInt32(dlFilt.Width);
}
set
{
dlFilt.Width = value;
}
memLayer.ML.emptySessionVal(nomeFiltro);
}
#endregion Public Methods
}
+19 -18
View File
@@ -1,40 +1,41 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
public partial class mod_filtro {
public partial class mod_filtro
{
/// <summary>
/// chkFilt control.
/// Controllo chkFilt.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 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.CheckBox chkFilt;
/// <summary>
/// dlFilt control.
/// Controllo dlFilt.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::AjaxControlToolkit.ComboBox dlFilt;
/// <summary>
/// where control.
/// Controllo where.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// 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.Label where;
}