Merge branch 'release/FixNavigaizoneFasiAndRegenAuthKey'

This commit is contained in:
Samuele Locatelli
2022-02-09 10:55:27 +01:00
14 changed files with 160 additions and 71 deletions
@@ -2,7 +2,7 @@
<div class="shortcuts">
<div class="row">
<div class="col-12">
<div class="col-12 textCondens">
<asp:Repeater ID="menu" runat="server" DataSourceID="XmlMenu">
<ItemTemplate>
<asp:Repeater ID="voci" runat="server" DataSource='<%# XPathSelect("voce") %>'>
+11 -11
View File
@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
// <auto-generated>
// This code was generated by a tool.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GPW_Admin.WebUserControls
@@ -15,20 +15,20 @@ namespace GPW_Admin.WebUserControls
{
/// <summary>
/// Controllo menu.
/// menu control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater menu;
/// <summary>
/// Controllo XmlMenu.
/// XmlMenu control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.XmlDataSource XmlMenu;
}
+1 -1
View File
@@ -2,7 +2,7 @@
<asp:HiddenField runat="server" ID="hfAnonym" />
<nav class="navbar navbar-expand-lg navbar-dark bg-dark text-light py-1 fixed-top">
<a class="navbar-brand" href="/menu">GPW <i class="fa fa-code" aria-hidden="true"></i></a>
<a class="navbar-brand" href="menu">GPW <i class="fa fa-code" aria-hidden="true"></i></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
@@ -200,10 +200,6 @@ namespace GPW_Admin.WebUserControls
if (oggi.Subtract(assunto).TotalDays > 60)
{
// recupero record utente
#if false
var tabDip = DataProxy.DP.taDipendenti.getByIdx(idxDipSel);
if (tabDip != null && tabDip.Rows.Count == 1)
#endif
if (DataProxy.DP.getRowDip(idxDipSel) != null)
{
// verifica sia sbloccabile la licenza (online)
@@ -25,6 +25,9 @@
<div class="px-2">
<asp:LinkButton runat="server" ID="lbtShowTickets" CssClass="btn btn-outline-secondary" OnClick="lbtShowTickets_Click"><i class="fa fa-ticket" aria-hidden="true"></i> Ticket aperti&nbsp;<span class="badge"><%: numTickets %></span></asp:LinkButton>
</div>
<div class="px-2">
<asp:LinkButton runat="server" ID="lbtRegenUserKey" CssClass="btn btn-warning" ToolTip="Rigenerazione di tutte le AuthKey SMART degli utenti" OnClick="lbtRegenUserKey_Click">Rigenera AuthKeys&nbsp;<i class="fa fa-key" aria-hidden="true"></i></asp:LinkButton>
</div>
</div>
</div>
<div class="p-2">
@@ -266,6 +266,23 @@ namespace GPW_Admin.WebUserControls
grView.DataBind();
}
protected void lbtRegenUserKey_Click(object sender, EventArgs e)
{
// rigenera TUTTE le userkey utente
var elencoDip = licenzeGPW.getDipAttivi().ToList();
// ciclo x ogni utente...
foreach (var dipendente in elencoDip)
{
DateTime adesso = DateTime.Now;
string newKey = $"{dipendente.CF}-{adesso:yyMMdd-HHmmss}";
string md5UserAuthKey = SteamCrypto.EncryptString(newKey, "AuthGPW");
// aggiorno su DB
DataProxy.DP.taDipendenti.stp_Dip_setAuthKey(dipendente.idxDipendente, md5UserAuthKey);
// chiama resync dati licenza (cod impiego / codAuth)
bool fatto = licenzeGPW.tryRefreshActivation(DataProxy.DP.hashCodImpiego(dipendente), md5UserAuthKey).Result;
}
}
/// <summary>
/// Richiesta selezione utente
/// </summary>
@@ -350,11 +367,8 @@ namespace GPW_Admin.WebUserControls
grView.EditIndex = -1;
grView.DataBind();
}
}
}
}
}
}
@@ -59,6 +59,15 @@ namespace GPW_Admin.WebUserControls
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtShowTickets;
/// <summary>
/// lbtRegenUserKey control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lbtRegenUserKey;
/// <summary>
/// chkshowAll control.
/// </summary>
+2 -4
View File
@@ -12,14 +12,12 @@
<asp:HyperLink runat="server" ID="hlReturnProj" NavigateUrl="~/progetti" CssClass="btn btn-block btn-warning"><i class="fa fa-arrow-left" aria-hidden="true"></i> Progetti</asp:HyperLink>
</div>
<div class="col-4">
<uc1:mod_filtro ID="filtroCli" runat="server" filterChekText="filtroCliente" comboWidth="150" changeCheckVisible="false"
isChecked="true" />
<uc1:mod_filtro ID="filtroCli" runat="server" filterChekText="filtroCliente" comboWidth="150" changeCheckVisible="false" isChecked="true" />
<asp:ObjectDataSource ID="odsClienti" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="GPW_data.DS_UtilityTableAdapters.v_selClientiTableAdapter"></asp:ObjectDataSource>
</div>
<div class="col-6">
<uc1:mod_filtro ID="filtroPrj" runat="server" filterChekText="filtroProgetto" comboWidth="200" changeCheckEnabled="false"
changeCheckVisible="false" isChecked="true" />
<uc1:mod_filtro ID="filtroPrj" runat="server" filterChekText="filtroProgetto" comboWidth="200" changeCheckEnabled="false" changeCheckVisible="false" isChecked="true" />
<asp:ObjectDataSource ID="odsProj" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByConditio"
TypeName="GPW_data.DS_UtilityTableAdapters.v_selProgettiTableAdapter">
<SelectParameters>
@@ -146,6 +146,7 @@ namespace GPW_Admin.WebUserControls
set
{
memLayer.ML.setSessionVal(string.Format("idxProj_{0}", sessionUid), value);
filtroPrj.valore = $"{value}";
}
}
@@ -98,6 +98,30 @@ namespace GPW_Admin.WebUserControls
}
}
protected int idxCliSel
{
get
{
return memLayer.ML.IntSessionObj("idxCli_sel");
}
set
{
memLayer.ML.setSessionVal("idxCli_sel", $"{value}");
}
}
protected int idxProjSel
{
get
{
return memLayer.ML.IntSessionObj("idxProgetto_sel");
}
set
{
memLayer.ML.setSessionVal("idxProgetto_sel", $"{value}");
}
}
#endregion Protected Properties
#region Public Properties
@@ -178,14 +202,7 @@ namespace GPW_Admin.WebUserControls
/// <param name="e"></param>
private 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);
}
idxCliSel = filtroCli.isChecked ? filtroCli.valoreInt : 0;
// salvo!
var tempFilt = currFiltProj;
tempFilt.filtCli = filtroCli.isChecked;
@@ -245,6 +262,7 @@ namespace GPW_Admin.WebUserControls
showVuoti = currFilt.showEmpty;
showOnlyStarred = currFilt.onlyStarred;
filtroCli.isChecked = currFilt.filtCli;
idxCliSel = filtroCli.isChecked ? filtroCli.valoreInt : 0;
filtroGrp.isChecked = currFilt.filtGrp;
// se deselezionato --> svuoto
if (!currFilt.filtGrp)
@@ -386,35 +404,21 @@ namespace GPW_Admin.WebUserControls
if (e != null)
{
// salvo progetto sel
memLayer.ML.setSessionVal("idxProgetto_sel", e.Keys["idxProgetto"]);
saveProjSel(e.Keys["idxProgetto"]);
// quale comando?
string _comando = "";
if (SteamWare.memLayer.ML.isInSessionObject("nextObjCommand"))
if (memLayer.ML.isInSessionObject("nextObjCommand"))
{
_comando = SteamWare.memLayer.ML.StringSessionObj("nextObjCommand");
SteamWare.memLayer.ML.emptySessionVal("nextObjCommand");
_comando = memLayer.ML.StringSessionObj("nextObjCommand");
memLayer.ML.emptySessionVal("nextObjCommand");
}
// verifico il tipo di richiesta (clona o update normale)
switch (_comando)
{
case "dettFasi":
// salvo idxCli...
int idxCli = 0;
try
{
idxCli = DataProxy.DP.taAP.getByIdxPrj(memLayer.ML.IntSessionObj("idxProgetto_sel"))[0].idxCliente;
}
catch
{ }
memLayer.ML.setSessionVal("idxCli_sel", idxCli);
// preseleziono filtro cliente...
var tempFilt = currFiltProj;
tempFilt.filtCli = true;
currFiltProj = tempFilt;
filtroCli.valore = $"{idxCli}";
Response.Redirect("fasi");
// blocco update!
e.Cancel = true;
Response.Redirect("fasi");
break;
default:
@@ -431,7 +435,9 @@ namespace GPW_Admin.WebUserControls
/// <param name="e"></param>
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
memLayer.ML.setSessionVal("idxProgetto_sel", grView.SelectedDataKey["idxProgetto"]);
int idxProj = 0;
int.TryParse($"{grView.SelectedDataKey["idxProgetto"]}", out idxProj);
mod_dettaglioProgetto1.IdxProgetto = idxProj;
mod_dettaglioProgetto1.Visible = true;
raiseEvent();
}
@@ -580,6 +586,42 @@ namespace GPW_Admin.WebUserControls
}
}
/// <summary>
/// Effettua salvataggio dati x progetto selezionato in sessione (cliente + progetto)
/// </summary>
/// <param name="idxProj"></param>
/// <returns></returns>
protected bool saveProjSel(object idxProj)
{
bool fatto = false;
if (idxProj != null)
{
int idxProgetto = 0;
int.TryParse($"{idxProj}", out idxProgetto);
if (idxProgetto > 0)
{
try
{
// salvo progetto sel
idxProjSel = idxProgetto;
// salvo idxCli...
int idxCli = 0;
try
{
idxCli = DataProxy.DP.taAP.getByIdxPrj(idxProgetto)[0].idxCliente;
idxCliSel = idxCli;
}
catch
{ }
fatto = true;
}
catch
{ }
}
}
return fatto;
}
#endregion Protected Methods
#region Public Methods
@@ -92,18 +92,19 @@
</div>
</div>
</div>
<div class="row">
<%--<div class="row">
<div class="col-12">
<asp:Button runat="server" ID="btnFasi" Text="Dettaglio Fasi" OnClick="btnFasi_Click" CssClass="btn btn-sm btn-success btn-block" />
</div>
</div>
</div>--%>
</div>
</div>
</ItemTemplate>
</asp:FormView>
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="GPW_data.DS_UtilityTableAdapters.stp_statsProjTableAdapter">
<SelectParameters>
<asp:SessionParameter DefaultValue="0" Name="idxProgetto" SessionField="idxProgetto_sel" Type="Int32" />
<asp:ControlParameter ControlID="hfIdxProgetto" DefaultValue="0" Name="idxProgetto" PropertyName="Value" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</asp:ObjectDataSource>
<asp:HiddenField runat="server" ID="hfIdxProgetto" />
@@ -21,6 +21,22 @@ namespace GPW_Admin.WebUserControls
/// </summary>
public string _paginaCorrente { get; set; }
public int IdxProgetto
{
get
{
//memLayer.ML.IntSessionObj("idxProgetto_sel")
int answ = 0;
int.TryParse(hfIdxProgetto.Value, out answ);
return answ;
}
set
{
hfIdxProgetto.Value = $"{value}";
}
}
#endregion Public Properties
#region Protected Methods
@@ -32,7 +48,7 @@ namespace GPW_Admin.WebUserControls
/// <param name="e"></param>
protected void btnFasi_Click(object sender, EventArgs e)
{
Response.Redirect("fasi.aspx");
Response.Redirect("fasi");
}
/// <summary>
@@ -46,7 +62,7 @@ namespace GPW_Admin.WebUserControls
{
// chiamo update attivo/non attivo...
CheckBox chkBox = (CheckBox)sender;
DataProxy.DP.taAP.updateAttivo(chkBox.Checked, memLayer.ML.IntSessionObj("idxProgetto_sel"));
DataProxy.DP.taAP.updateAttivo(chkBox.Checked, IdxProgetto);
fmView.DataBind();
if (eh_nuovoValore != null)
{
@@ -66,7 +82,7 @@ namespace GPW_Admin.WebUserControls
{
// chiamo update attivo/non attivo...
CheckBox chkBox = (CheckBox)sender;
DataProxy.DP.taAP.updateStarred(chkBox.Checked, memLayer.ML.IntSessionObj("idxProgetto_sel"));
DataProxy.DP.taAP.updateStarred(chkBox.Checked, IdxProgetto);
fmView.DataBind();
if (eh_nuovoValore != null)
{
@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
// <auto-generated>
// This code was generated by a tool.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GPW_Admin.WebUserControls
@@ -15,21 +15,30 @@ namespace GPW_Admin.WebUserControls
{
/// <summary>
/// Controllo fmView.
/// fmView control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.FormView fmView;
/// <summary>
/// Controllo ods.
/// ods control.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
/// <summary>
/// hfIdxProgetto control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfIdxProgetto;
}
}
+1 -1
View File
@@ -19,8 +19,8 @@ namespace GPW_Admin
protected void Page_Load(object sender, EventArgs e)
{
// imposto fasi selezionate!
mod_adminFasi1.idxProgetto = memLayer.ML.IntSessionObj("idxProgetto_sel");
mod_adminFasi1.idxCliente = memLayer.ML.IntSessionObj("idxCli_sel");
mod_adminFasi1.idxProgetto = memLayer.ML.IntSessionObj("idxProgetto_sel");
mod_pageSize.eh_nuovaSize += Mod_pageSize_eh_nuovaSize;
}