Fix condizioni editing ed attivazione dipendenti appena inseriti/modificati
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
<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:LinkButton runat="server" ID="lbtSelect" OnClick="lbtSelect_Click" 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="lbtSelect" OnClick="lbtSelect_Click" CssClass="btn btn-sm btn-info" CausesValidation="False" CommandName="Select" ToolTip='<%# traduci("Select") %>' Visible='<%# checkDataAssunzione(Eval("dataAssunzione")) %>'><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") %>' Visible='<%# checkFreeEdit(Eval("idxDipendente")) %>'><i class="fa fa-edit" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton runat="server" ID="lbtTicket" CssClass="btn btn-sm btn-warning" CausesValidation="False" CommandName="Select" OnClick="lbtTicket_Click" ToolTip='<%# traduci("Unlock") %>' Visible='<%# !checkFreeEdit(Eval("idxDipendente")) %>'><i class="fa fa-question-circle" aria-hidden="true"></i></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
@@ -248,6 +248,7 @@
|
||||
<asp:CheckBox ID="chkattivoKO" runat="server" Checked='<%# Eval("attivo") %>' Enabled="false" CssClass="table-danger p-1" Visible='<%# !checkLic(Eval("idxDipendente")) %>' />
|
||||
</div>
|
||||
<div class="col-9 text-right small">
|
||||
<asp:Label runat="server" ID="lblErrorData" Visible='<%# !checkDataAssunzione(Eval("dataAssunzione")) %>' CssClass="text-danger">!!!</asp:Label>
|
||||
<asp:Label ID="lbldataAssunzione" runat="server" Text='<%# Eval("dataAssunzione","{0:dd/MM/yyyy}") %>' />
|
||||
<br />
|
||||
<asp:Label ID="lbldataCessazione" runat="server" Text='<%# Eval("dataCessazione","{0:dd/MM/yyyy}") %>' />
|
||||
|
||||
@@ -193,7 +193,10 @@ namespace GPW_Admin.WebUserControls
|
||||
|
||||
protected void grView_RowEditing(object sender, GridViewEditEventArgs e)
|
||||
{
|
||||
resetSelezione();
|
||||
if (grView.SelectedIndex >= 0)
|
||||
{
|
||||
resetSelezione();
|
||||
}
|
||||
}
|
||||
|
||||
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@@ -332,8 +335,6 @@ namespace GPW_Admin.WebUserControls
|
||||
}
|
||||
else
|
||||
{
|
||||
// disattivo la licenza corrente...
|
||||
var localUserList = licenzeGPW.getDipAttivi();
|
||||
// cerco!
|
||||
if (e.InputParameters["Original_idxDipendente"] != null)
|
||||
{
|
||||
@@ -342,36 +343,44 @@ namespace GPW_Admin.WebUserControls
|
||||
int.TryParse(origIdxDip, out idxDip);
|
||||
if (idxDip > 0)
|
||||
{
|
||||
// disattivo la licenza corrente...
|
||||
var localUserList = licenzeGPW.getDipAttivi();
|
||||
var currUser = localUserList.Where(x => x.idxDipendente == idxDip).FirstOrDefault();
|
||||
|
||||
// verifico SE sia disponibile licenza...
|
||||
var activationsList = licenzeGPW.ListaAttivazioni;
|
||||
var currHash = DataProxy.DP.hashCodImpiego(currUser);
|
||||
var currAct = activationsList.Where(x => x.CodImpiego == currHash).FirstOrDefault();
|
||||
|
||||
bool fatto = true;
|
||||
if (currAct != null)
|
||||
{
|
||||
// riesegue controllo ed disattiva
|
||||
Dictionary<string, string> ParamList = new Dictionary<string, string>();
|
||||
ParamList.Add(currAct.CodImpiego, currAct.Chiave);
|
||||
bool fatto = licenzeGPW.tryDeactivation(ParamList).Result;
|
||||
if (fatto)
|
||||
{
|
||||
DataProxy.DP.taDipendenti.updateActive(false, idxDip);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// annullo update se attivazione NON trovata...
|
||||
e.Cancel = true;
|
||||
grView.EditIndex = -1;
|
||||
grView.DataBind();
|
||||
fatto = licenzeGPW.tryDeactivation(ParamList).Result;
|
||||
}
|
||||
// indico disattivato...
|
||||
e.InputParameters["attivo"] = "false";
|
||||
licenzeGPW.resetDipAttivi();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Verifica data assunzione valida = ultimi 60 anni...
|
||||
/// </summary>
|
||||
/// <param name="dtAss"></param>
|
||||
/// <returns></returns>
|
||||
public bool checkDataAssunzione(object dtAss)
|
||||
{
|
||||
bool answ = false;
|
||||
DateTime oggi = DateTime.Today;
|
||||
DateTime dataAss = oggi.AddYears(-100);
|
||||
DateTime.TryParse($"{dtAss}", out dataAss);
|
||||
answ = (oggi.Subtract(dataAss).TotalDays < 365 * 60);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// caricamento
|
||||
|
||||
@@ -690,6 +690,11 @@ namespace GPW_data
|
||||
return answ;
|
||||
}
|
||||
|
||||
public static void resetDipAttivi()
|
||||
{
|
||||
memLayer.ML.setRSV(rkeyDipAct, "", 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua refresh ActivationInfo con chiamata remota (sovrascrivendo info locali Redis)
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user