Fix filtro dipendenti attivi

This commit is contained in:
Samuele E. Locatelli
2021-01-08 11:52:13 +01:00
parent 7be61c8a4a
commit 7e5ddfa0f1
4 changed files with 141 additions and 96 deletions
@@ -4,6 +4,12 @@
{ %>
<link href="~/css/Style.css" rel="stylesheet" type="text/css" />
<% } %>
<div class="d-flex flex-row-reverse text-right table-secondary">
<div class="p-2">
<asp:CheckBox runat="server" ID="chkshowAll" Text="Mostra tutti" OnCheckedChanged="chkshowAll_CheckedChanged" AutoPostBack="true" />
</div>
</div>
<div class="small">
<asp:GridView ID="grView" runat="server" AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="idxDipendente" DataSourceID="ods" CssClass="table table-sm table-striped" OnDataBound="grView_DataBound">
<EditRowStyle CssClass="table-primary" />
@@ -206,7 +212,7 @@
</asp:TemplateField>
</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.DipendentiTableAdapter" UpdateMethod="updateQuery" FilterExpression=" (Cognome like '%{0}%') OR (Nome like '%{0}%') OR (CF like '%{0}%') OR (matricola like '%{0}%') OR (email like '%{0}%') " OnUpdating="ods_Updating">
<asp:ObjectDataSource ID="ods" runat="server" OnInserting="recuperaFooter" DeleteMethod="deleteQuery" InsertMethod="insertQuery" OldValuesParameterFormatString="original_{0}" SelectMethod="getAttivi" TypeName="GPW_data.DS_ApplicazioneTableAdapters.DipendentiTableAdapter" UpdateMethod="updateQuery" FilterExpression=" (Cognome like '%{0}%') OR (Nome like '%{0}%') OR (CF like '%{0}%') OR (matricola like '%{0}%') OR (email like '%{0}%') " OnUpdating="ods_Updating">
<FilterParameters>
<asp:SessionParameter SessionField="valoreSearch" Type="String" />
</FilterParameters>
@@ -12,54 +12,31 @@ namespace GPW_Admin.WebUserControls
{
public partial class mod_adminDipendenti : 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.utentiAttivi < licenzeGPW.licenzeAttive);
}
}
/// <summary>
/// reset della selezione
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnReset_Click(object sender, EventArgs e)
{
resetSelezione();
}
#endregion Public Properties
#region Protected Methods
/// <summary>
/// gestione evento richiesta nuovo valore (mostra footer, ...)
/// </summary>
@@ -80,26 +57,43 @@ 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();
}
protected void chkshowAll_CheckedChanged(object sender, EventArgs e)
{
// in base a selezione cambio metodo ods
string selMethod = "GetData";
if (!chkshowAll.Checked)
{
selMethod = "getAttivi";
}
ods.SelectMethod = selMethod;
grView.DataBind();
}
/// <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.DipendentiDataTable tabella = new DS_Applicazione.DipendentiDataTable())
{
colonne = tabella.Columns;
}
return colonne;
}
/// <summary>
/// traduce gli header delle colonne
/// </summary>
@@ -110,7 +104,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,56 +124,57 @@ 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.DipendentiDataTable tabella = new DS_Applicazione.DipendentiDataTable())
{
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 (e != null)
{
int trovati = 0;
int idxDip = 0;
_ = int.TryParse(idxObj.ToString(), out idxDip);
trovati = DataProxy.DP.taTimb.getLastByDip(idxDip).Count;
// controllo se ci sono record correlati...
if (trovati > 0)
if (!licenzeGPW.checkLicenze)
{
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
{
return (licenzeGPW.utentiAttivi < licenzeGPW.licenzeAttive);
}
grView.PageSize = utils.pageSize;
}
/// <summary>
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
@@ -218,12 +213,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;
}
@@ -241,26 +239,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 (e != null)
bool answ = true;
// solo se ha diritti scrittura controllo
if (idxObj != null)
{
if (!licenzeGPW.checkLicenze)
int trovati = 0;
int idxDip = 0;
_ = int.TryParse(idxObj.ToString(), out idxDip);
trovati = DataProxy.DP.taTimb.getLastByDip(idxDip).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,15 @@ namespace GPW_Admin.WebUserControls
public partial class mod_adminDipendenti
{
/// <summary>
/// Controllo chkshowAll.
/// </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.CheckBox chkshowAll;
/// <summary>
/// Controllo grView.
/// </summary>
Vendored
+1 -1
View File
@@ -10,7 +10,7 @@ pipeline {
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=4133']) {
withEnv(['NEXT_BUILD_NUMBER=4134']) {
// env.versionNumber = VersionNumber(versionNumberString : '2.7.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '2.7.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'GPW'