fix errore sel permessi
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user