fix errore sel permessi
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_toggle.ascx.cs" Inherits="GPW_Admin.WebUserControls.cmp_toggle" %>
|
||||
<asp:HiddenField runat="server" ID="hfValue" />
|
||||
<asp:HiddenField runat="server" ID="hfMessageOff" />
|
||||
<asp:HiddenField runat="server" ID="hfMessageOn" />
|
||||
<asp:Label runat="server" ID="lblMessage" />
|
||||
|
||||
<asp:LinkButton runat="server" ID="lbtToggleOn" OnClick="lbtToggleOn_Click" ToolTip="Nascondi TagCloud"><i class="fa fa-2x fa-toggle-on" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton runat="server" ID="lbtToggleOff" OnClick="lbtToggleOff_Click" ToolTip="Mostra TagCloud"><i class="fa fa-2x fa-toggle-off" aria-hidden="true"></i></asp:LinkButton>
|
||||
@@ -50,6 +50,36 @@ namespace GPW_Admin.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Messaggio toggle Off
|
||||
/// </summary>
|
||||
public string messageOff
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfMessageOff.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfMessageOff.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Messaggio toggle ON
|
||||
/// </summary>
|
||||
public string messageOn
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfMessageOn.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfMessageOn.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// valore toggle
|
||||
/// </summary>
|
||||
@@ -115,6 +145,7 @@ namespace GPW_Admin.WebUserControls
|
||||
bool doShow = toggleValue;
|
||||
lbtToggleOn.Visible = doShow;
|
||||
lbtToggleOff.Visible = !doShow;
|
||||
lblMessage.Text = doShow ? messageOn : messageOff;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -23,6 +23,33 @@ namespace GPW_Admin.WebUserControls
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfValue;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfMessageOff.
|
||||
/// </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 hfMessageOff;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfMessageOn.
|
||||
/// </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 hfMessageOn;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lblMessage.
|
||||
/// </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.Label lblMessage;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lbtToggleOn.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_adminClienti.ascx.cs" Inherits="GPW_Admin.WebUserControls.mod_adminClienti" %>
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
|
||||
<%@ Register Src="~/WebUserControls/cmp_toggle.ascx" TagPrefix="uc1" TagName="cmp_toggle" %>
|
||||
|
||||
<div class="row fontPiccolo2">
|
||||
<div class="col-12">
|
||||
filtraggio...
|
||||
<div class="col-12 text-right mb-1">
|
||||
<div class="input-group table-secondary">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">Filtro visualizzazione</span>
|
||||
</div>
|
||||
<div class="form-control">
|
||||
<uc1:cmp_toggle runat="server" ID="cmp_toggle" classOn="text-success" classOff="text-dark" messageOn="Mostra Tutti" messageOff="Mostra Solo Attivi" />
|
||||
<asp:HiddenField runat="server" ID="hfShowAll" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<asp:GridView ID="grView" runat="server" AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="idxCliente" DataSourceID="ods" CssClass="table table-striped table-sm" OnDataBound="grView_DataBound">
|
||||
@@ -205,13 +214,9 @@
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" OnInserting="recuperaFooter" DeleteMethod="deleteQuery" InsertMethod="insertQuery"
|
||||
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="GPW_data.DS_ApplicazioneTableAdapters.AnagClientiTableAdapter"
|
||||
OldValuesParameterFormatString="original_{0}" SelectMethod="getBySearch" TypeName="GPW_data.DS_ApplicazioneTableAdapters.AnagClientiTableAdapter"
|
||||
UpdateMethod="updateQuery"
|
||||
FilterExpression=" (RagSociale like '%{0}%') OR (indirizzo like '%{0}%') OR (citta like '%{0}%') OR (url like '%{0}%') OR (email like '%{0}%') OR (nota like '%{0}%') "
|
||||
OnUpdating="ods_Updating">
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter SessionField="valoreSearch" Type="String" />
|
||||
</FilterParameters>
|
||||
<DeleteParameters>
|
||||
<asp:Parameter Name="Original_idxCliente" Type="Int32" />
|
||||
</DeleteParameters>
|
||||
@@ -227,6 +232,10 @@
|
||||
<asp:Parameter Name="CF" Type="String" />
|
||||
<asp:Parameter Name="nota" Type="String" />
|
||||
</InsertParameters>
|
||||
<SelectParameters>
|
||||
<asp:SessionParameter DefaultValue="*" Name="searchVal" SessionField="valoreSearch" Type="String" />
|
||||
<asp:ControlParameter ControlID="hfShowAll" Name="showAll" PropertyName="Value" Type="Boolean" />
|
||||
</SelectParameters>
|
||||
<UpdateParameters>
|
||||
<asp:Parameter Name="RagSociale" Type="String" />
|
||||
<asp:Parameter Name="indirizzo" Type="String" />
|
||||
|
||||
@@ -12,54 +12,46 @@ namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
public partial class mod_adminClienti : System.Web.UI.UserControl
|
||||
{
|
||||
#region area standard (non modificare)
|
||||
#region Public Events
|
||||
|
||||
#region gestione eventi
|
||||
|
||||
public event EventHandler eh_resetSelezione;
|
||||
public event EventHandler eh_nuovoValore;
|
||||
|
||||
#endregion
|
||||
public event EventHandler eh_resetSelezione;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// effettua traduzione del lemma
|
||||
/// controllo stato licenze!
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(string lemma)
|
||||
public bool chkLicOk
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma);
|
||||
}
|
||||
/// <summary>
|
||||
/// caricamento
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
grView.PageSize = utils.pageSize;
|
||||
}
|
||||
/// <summary>
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
public void resetSelezione()
|
||||
{
|
||||
grView.SelectedIndex = -1;
|
||||
grView.DataBind();
|
||||
if (eh_resetSelezione != null)
|
||||
get
|
||||
{
|
||||
eh_resetSelezione(this, new EventArgs());
|
||||
return (licenzeGPW.checkLicenze);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// reset della selezione
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnReset_Click(object sender, EventArgs e)
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void Cmp_toggle_ehToggle(object sender, EventArgs e)
|
||||
{
|
||||
resetSelezione();
|
||||
hfShowAll.Value = $"{cmp_toggle.toggleValue}";
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
private void doUpdate()
|
||||
{
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// gestione evento richiesta nuovo valore (mostra footer, ...)
|
||||
/// </summary>
|
||||
@@ -80,26 +72,32 @@ 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
|
||||
/// elenco colonne del datagrid
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblCanc_click(object sender, EventArgs e)
|
||||
/// <returns></returns>
|
||||
protected DataColumnCollection colonneObj()
|
||||
{
|
||||
// annullo inserimento: nascondo footer, bind controlli...
|
||||
grView.FooterRow.Visible = false;
|
||||
DataColumnCollection colonne = null;
|
||||
using (
|
||||
DS_Applicazione.AnagClientiDataTable tabella = new DS_Applicazione.AnagClientiDataTable())
|
||||
{
|
||||
colonne = tabella.Columns;
|
||||
}
|
||||
return colonne;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// traduce gli header delle colonne
|
||||
/// </summary>
|
||||
@@ -110,7 +108,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
|
||||
@@ -130,57 +128,62 @@ namespace GPW_Admin.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region area CUSTOM (da modificare)
|
||||
|
||||
/// <summary>
|
||||
/// elenco colonne del datagrid
|
||||
/// annulla inserimento nuovo valore da footer
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected DataColumnCollection colonneObj()
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblCanc_click(object sender, EventArgs e)
|
||||
{
|
||||
DataColumnCollection colonne = null;
|
||||
using (
|
||||
DS_Applicazione.AnagClientiDataTable tabella = new DS_Applicazione.AnagClientiDataTable())
|
||||
{
|
||||
colonne = tabella.Columns;
|
||||
}
|
||||
return colonne;
|
||||
// annullo inserimento: nascondo footer, bind controlli...
|
||||
grView.FooterRow.Visible = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// determina se sia eliminabile il record (=non usato)
|
||||
/// inserisce nuovo valore da footer
|
||||
/// </summary>
|
||||
/// <param name="idxMaker"></param>
|
||||
/// <returns></returns>
|
||||
public bool delEnabled(object idxObj)
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblIns_click(object sender, EventArgs e)
|
||||
{
|
||||
bool answ = true;
|
||||
// solo se ha diritti scrittura controllo
|
||||
if (idxObj != null)
|
||||
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
|
||||
ods.Insert();
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
int trovati = 0;
|
||||
int idxCli = 0;
|
||||
_ = int.TryParse(idxObj.ToString(), out idxCli);
|
||||
trovati = DataProxy.DP.taAP.getByIdxCli(idxCli, true, true).Rows.Count;
|
||||
// controllo se ci sono record correlati...
|
||||
if (trovati > 0)
|
||||
if (e != null)
|
||||
{
|
||||
answ = false;
|
||||
// annullo insert se licenze sforate...
|
||||
e.Cancel = true;
|
||||
grView.EditIndex = -1;
|
||||
grView.DataBind();
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// controllo stato licenze!
|
||||
/// caricamento
|
||||
/// </summary>
|
||||
public bool chkLicOk
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
get
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
return (licenzeGPW.checkLicenze);
|
||||
hfShowAll.Value = $"{cmp_toggle.toggleValue}";
|
||||
}
|
||||
grView.PageSize = utils.pageSize;
|
||||
cmp_toggle.ehToggle += Cmp_toggle_ehToggle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
|
||||
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
|
||||
@@ -219,12 +222,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;
|
||||
}
|
||||
@@ -239,25 +245,58 @@ namespace GPW_Admin.WebUserControls
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// check licenze in fase di update...
|
||||
/// determina se sia eliminabile il record (=non usato)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
/// <param name="idxMaker"></param>
|
||||
/// <returns></returns>
|
||||
public bool delEnabled(object idxObj)
|
||||
{
|
||||
if (!licenzeGPW.checkLicenze)
|
||||
bool answ = true;
|
||||
// solo se ha diritti scrittura controllo
|
||||
if (idxObj != null)
|
||||
{
|
||||
if (e != null)
|
||||
int trovati = 0;
|
||||
int idxCli = 0;
|
||||
_ = int.TryParse(idxObj.ToString(), out idxCli);
|
||||
trovati = DataProxy.DP.taAP.getByIdxCli(idxCli, true, true).Rows.Count;
|
||||
// controllo se ci sono record correlati...
|
||||
if (trovati > 0)
|
||||
{
|
||||
// annullo insert se licenze sforate...
|
||||
e.Cancel = true;
|
||||
grView.EditIndex = -1;
|
||||
grView.DataBind();
|
||||
answ = false;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
public void resetSelezione()
|
||||
{
|
||||
grView.SelectedIndex = -1;
|
||||
grView.DataBind();
|
||||
if (eh_resetSelezione != null)
|
||||
{
|
||||
eh_resetSelezione(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// effettua traduzione del lemma
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(string lemma)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,24 @@ namespace GPW_Admin.WebUserControls
|
||||
public partial class mod_adminClienti
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Controllo cmp_toggle.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::GPW_Admin.WebUserControls.cmp_toggle cmp_toggle;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hfShowAll.
|
||||
/// </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 hfShowAll;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo grView.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user