Merge branch 'release/ObfuscatedDll'
This commit is contained in:
Binary file not shown.
Binary file not shown.
+73966
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<!--This config file was generated by Dotfuscator. Please use the Dotfuscator Config Editor to modify.-->
|
||||
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.5.dtd">
|
||||
<dotfuscator version="2.3">
|
||||
<global>
|
||||
<option>suppressildasm</option>
|
||||
<option>debugauto</option>
|
||||
</global>
|
||||
<input>
|
||||
<loadpaths>
|
||||
<option>prepend</option>
|
||||
<file dir="C:\Users\samuele\source\repos\GPW\GPW_Admin\bin" />
|
||||
</loadpaths>
|
||||
<asmlist>
|
||||
<inputassembly refid="fe709033-8c28-40e3-a29f-81aaee8478ec">
|
||||
<option>honoroas</option>
|
||||
<option>stripoa</option>
|
||||
<option>library</option>
|
||||
<option>transformxaml</option>
|
||||
<file dir="${configdir}\GPW_Admin\bin" name="GPW_data.dll" />
|
||||
</inputassembly>
|
||||
<inputassembly refid="5ebfaf82-8520-4818-bd03-e77494e9a493">
|
||||
<option>honoroas</option>
|
||||
<option>stripoa</option>
|
||||
<option>library</option>
|
||||
<option>transformxaml</option>
|
||||
<file dir="${configdir}\GPW_Admin\bin" name="SteamWare.dll" />
|
||||
</inputassembly>
|
||||
<inputassembly refid="c2fc219b-44ad-4901-af2c-26515b886f8a">
|
||||
<option>honoroas</option>
|
||||
<option>stripoa</option>
|
||||
<option>library</option>
|
||||
<option>transformxaml</option>
|
||||
<file dir="${configdir}\GPW_Admin\obj\Release" name="GPW_Admin.dll" />
|
||||
</inputassembly>
|
||||
</asmlist>
|
||||
</input>
|
||||
<output>
|
||||
<file dir="${configdir}\Dotfuscated" />
|
||||
</output>
|
||||
<renaming>
|
||||
<option>xmlserialization</option>
|
||||
<mapping>
|
||||
<mapoutput overwrite="true">
|
||||
<file dir="${configdir}\Dotfuscated" name="Map.xml" />
|
||||
</mapoutput>
|
||||
</mapping>
|
||||
<referencerulelist>
|
||||
<referencerule rulekey="{6655B10A-FD58-462d-8D4F-5B1316DFF0FF}" />
|
||||
<referencerule rulekey="{7D9C8B02-2383-420f-8740-A9760394C2C1}" />
|
||||
<referencerule rulekey="{229FD6F8-5BCC-427b-8F72-A7A413ECDF1A}" />
|
||||
<referencerule rulekey="{2B7E7C8C-A39A-4db8-9DFC-6AFD38509061}" />
|
||||
<referencerule rulekey="{494EA3BA-B947-44B5-BEE8-A11CC85AAF9B}" />
|
||||
<referencerule rulekey="{89769974-93E9-4e71-8D92-BE70E855ACFC}" />
|
||||
<referencerule rulekey="{4D81E604-A545-4631-8B6D-C3735F793F80}" />
|
||||
<referencerule rulekey="{62bd3899-7d53-4336-8ca2-4e5dbae187d5}" />
|
||||
</referencerulelist>
|
||||
</renaming>
|
||||
<sos />
|
||||
<smartobfuscation>
|
||||
<smartobfuscationreport verbosity="all" overwrite="false" />
|
||||
</smartobfuscation>
|
||||
</dotfuscator>
|
||||
@@ -42,13 +42,22 @@ namespace GPW_Admin
|
||||
/// <summary>
|
||||
/// controllo stato licenze!
|
||||
/// </summary>
|
||||
public bool chkLicOk
|
||||
{
|
||||
get => (licenzeGPW.checkLicenze && licenzeGPW.checkPayload);
|
||||
}
|
||||
public bool chkLicOk => doChkLicOk();
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// controllo stato licenze!
|
||||
/// </summary>
|
||||
private bool doChkLicOk()
|
||||
{
|
||||
return (licenzeGPW.checkLicenze && licenzeGPW.checkPayload);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<IISExpressUseClassicPipelineMode>false</IISExpressUseClassicPipelineMode>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
<NameOfLastUsedPublishProfile>IIS02</NameOfLastUsedPublishProfile>
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
<Use64BitIISExpress />
|
||||
<IISExpressSSLPort />
|
||||
<UseGlobalApplicationHostFile />
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
|
||||
@@ -50,16 +50,22 @@ namespace GPW_Commesse
|
||||
/// <summary>
|
||||
/// controllo stato licenze!
|
||||
/// </summary>
|
||||
public bool chkLicOk
|
||||
{
|
||||
get
|
||||
{
|
||||
return (licenzeGPW.checkLicenze);
|
||||
}
|
||||
}
|
||||
public bool chkLicOk => doChkLicOk();
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// controllo stato licenze!
|
||||
/// </summary>
|
||||
private bool doChkLicOk()
|
||||
{
|
||||
return (licenzeGPW.checkLicenze);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Use64BitIISExpress />
|
||||
<IISExpressSSLPort />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
|
||||
<WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<div class="text-center">
|
||||
<asp:LinkButton runat="server" ID="lbShowTemp" CausesValidation="False" CommandName="Select" CommandArgument='<%# Eval("Data") %>' CssClass="btn btn-outline-secondary btn-sm" OnClick="lbShowTemp_Click" Visible='<%# gtZero(Eval("h_lav")) || gtZero(Eval("h_com")) %>' ToolTip="Dettaglio registrazione temperatura">
|
||||
<asp:LinkButton runat="server" ID="lbShowTemp" CausesValidation="False" CommandName="Select" CommandArgument='<%# Eval("Data") %>' CssClass="btn btn-outline-secondary btn-sm" OnClick="lbShowTemp_Click" Visible='<%# gtZero(Eval("h_lav")) || gtZero(Eval("h_com")) || Eval("Check19").ToString() != "" %>' ToolTip="Dettaglio registrazione temperatura">
|
||||
<i runat="server" visible='<%# !gtZero(Eval("tempRil")) %>' class="fa fa-thermometer-empty text-danger" aria-hidden="true"></i>
|
||||
<i runat="server" visible='<%# gtZero(Eval("tempRil")) %>' class="fa fa-thermometer text-success" aria-hidden="true"></i>
|
||||
<i runat="server" visible='<%# betweenVal(Eval("tempRil"),37.1, 37.5) %>' class="fa fa-exclamation-triangle text-warning" aria-hidden="true"></i>
|
||||
@@ -152,7 +152,7 @@
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<div class="text-center">
|
||||
<asp:LinkButton runat="server" ID="lbShowCheck" CausesValidation="False" CommandName="Select" CommandArgument='<%# Eval("Data") %>' CssClass="btn btn-outline-secondary btn-sm" OnClick="lbShowCheck_Click" Visible='<%# gtZero(Eval("h_lav")) || gtZero(Eval("h_com")) %>' ToolTip="Dettaglio scansione GreenPass">
|
||||
<asp:LinkButton runat="server" ID="lbShowCheck" CausesValidation="False" CommandName="Select" CommandArgument='<%# Eval("Data") %>' CssClass="btn btn-outline-secondary btn-sm" OnClick="lbShowCheck_Click" Visible='<%# gtZero(Eval("h_lav")) || gtZero(Eval("h_com")) || Eval("Check19").ToString() != "" %>' ToolTip="Dettaglio scansione GreenPass">
|
||||
<i runat="server" visible='<%# Eval("Check19").ToString() == "" %>' class="fa fa-certificate text-danger" aria-hidden="true"></i>
|
||||
<i runat="server" visible='<%# Eval("Check19").ToString() != "" %>' class="fa fa-certificate text-success" aria-hidden="true"></i>
|
||||
</asp:LinkButton>
|
||||
|
||||
@@ -42,6 +42,20 @@ namespace GPW_Commesse.WebUserControls
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
protected bool checkVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
bool.TryParse(hfShowCheck.Value, out answ);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfShowCheck.Value = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determina se visualizzare entrambe le schede...
|
||||
/// </summary>
|
||||
@@ -71,20 +85,6 @@ namespace GPW_Commesse.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
protected bool checkVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
bool.TryParse(hfShowCheck.Value, out answ);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfShowCheck.Value = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
@@ -160,6 +160,11 @@ namespace GPW_Commesse.WebUserControls
|
||||
raiseEvent(ucEvType.Reset);
|
||||
}
|
||||
|
||||
private void Cmp_dailyCheck_ehCancel(object sender, EventArgs e)
|
||||
{
|
||||
closeShowCheck();
|
||||
}
|
||||
|
||||
private void cmp_rilTemp_ehCancel(object sender, EventArgs e)
|
||||
{
|
||||
closeEditTemp();
|
||||
@@ -206,21 +211,6 @@ namespace GPW_Commesse.WebUserControls
|
||||
raiseEvent(ucEvType.ReqUpdateParent);
|
||||
}
|
||||
|
||||
private void showCheck(string dataRif)
|
||||
{
|
||||
CultureInfo ita = new CultureInfo("it-IT");
|
||||
cmp_dailyCheck.dataFrom = Convert.ToDateTime(dataRif, ita).AddDays(-3);
|
||||
cmp_dailyCheck.dataTo = Convert.ToDateTime(dataRif, ita);
|
||||
//salvo in sessione dati x detail timbrature
|
||||
memLayer.ML.setSessionVal("idxDip_det", DataProxy.idxDipendente);
|
||||
// imposto modalità
|
||||
checkVisible = true;
|
||||
activeMode = modoCommesse.showCheck;
|
||||
showPanels();
|
||||
|
||||
raiseEvent(ucEvType.ReqUpdateParent);
|
||||
}
|
||||
|
||||
private void editTimbr(string dataRif)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
@@ -271,6 +261,21 @@ namespace GPW_Commesse.WebUserControls
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
private void showCheck(string dataRif)
|
||||
{
|
||||
CultureInfo ita = new CultureInfo("it-IT");
|
||||
cmp_dailyCheck.dataFrom = Convert.ToDateTime(dataRif, ita).AddDays(-2);
|
||||
cmp_dailyCheck.dataTo = Convert.ToDateTime(dataRif, ita).AddDays(1);
|
||||
//salvo in sessione dati x detail timbrature
|
||||
memLayer.ML.setSessionVal("idxDip_det", DataProxy.idxDipendente);
|
||||
// imposto modalità
|
||||
checkVisible = true;
|
||||
activeMode = modoCommesse.showCheck;
|
||||
showPanels();
|
||||
|
||||
raiseEvent(ucEvType.ReqUpdateParent);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
@@ -288,22 +293,6 @@ namespace GPW_Commesse.WebUserControls
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// edit temperatura rilevata
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lbShowTemp_Click(object sender, EventArgs e)
|
||||
{
|
||||
string dataRif = ((LinkButton)sender).CommandArgument;
|
||||
activeMode = modoCommesse.editRilTemp;
|
||||
// verifico se dip sia attivo...
|
||||
if (DataProxy.currDipIsActive && DataProxy.currDipHasPayloadActive)
|
||||
{
|
||||
editTemp(dataRif);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// visualizzazione controlli C19
|
||||
/// </summary>
|
||||
@@ -320,6 +309,21 @@ namespace GPW_Commesse.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// edit temperatura rilevata
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lbShowTemp_Click(object sender, EventArgs e)
|
||||
{
|
||||
string dataRif = ((LinkButton)sender).CommandArgument;
|
||||
activeMode = modoCommesse.editRilTemp;
|
||||
// verifico se dip sia attivo...
|
||||
if (DataProxy.currDipIsActive && DataProxy.currDipHasPayloadActive)
|
||||
{
|
||||
editTemp(dataRif);
|
||||
}
|
||||
}
|
||||
|
||||
protected void lbtShowAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -373,7 +377,7 @@ namespace GPW_Commesse.WebUserControls
|
||||
{
|
||||
activeMode = modoCommesse.elenco;
|
||||
intervalloDate periodo = new intervalloDate();
|
||||
periodo.fine = DateTime.Now.AddDays(1);
|
||||
periodo.fine = DateTime.Today.AddDays(1);
|
||||
periodo.inizio = periodo.fine.AddDays(memLayer.ML.confReadInt("defDayFrom"));
|
||||
mod_periodoAnalisi1.intervalloAnalisi = periodo;
|
||||
// salvo link in HF
|
||||
@@ -417,11 +421,6 @@ namespace GPW_Commesse.WebUserControls
|
||||
cmp_dailyCheck.ehCancel += Cmp_dailyCheck_ehCancel;
|
||||
}
|
||||
|
||||
private void Cmp_dailyCheck_ehCancel(object sender, EventArgs e)
|
||||
{
|
||||
closeShowCheck();
|
||||
}
|
||||
|
||||
protected void showCharts(bool doShow)
|
||||
{
|
||||
divRilTemp.Visible = doShow;
|
||||
|
||||
@@ -130,7 +130,7 @@ public partial class mod_periodoAnalisi : System.Web.UI.UserControl
|
||||
oraFine = Convert.ToInt32(ddlOraFine.SelectedValue);
|
||||
}
|
||||
_intervallo.inizio = Convert.ToDateTime(txtInizio.Text).AddHours(oraInizio);
|
||||
_intervallo.fine = Convert.ToDateTime(txtFine.Text).AddHours(oraFine);
|
||||
_intervallo.fine = Convert.ToDateTime(txtFine.Text).AddHours(oraFine).AddDays(1);
|
||||
verificaCoerenzaDate();
|
||||
int _durataMin;
|
||||
_durataMin = Convert.ToInt32(txtDurataMin.Text);
|
||||
|
||||
+78
-60
@@ -45,48 +45,27 @@ namespace GPW_data
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Protected Constructors
|
||||
#region Private Constructors
|
||||
|
||||
protected DataProxy()
|
||||
private DataProxy()
|
||||
{
|
||||
initTA();
|
||||
setupConnectionStringBase();
|
||||
}
|
||||
|
||||
#endregion Protected Constructors
|
||||
#endregion Private Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se il dip corrente ha un record valido in payload
|
||||
/// </summary>
|
||||
public static bool currDipHasPayloadActive
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = licenzeGPW.userPayloadOk(idxDipendente);
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static bool currDipHasPayloadActive => _currDipHasPayloadActive();
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se il dip corrente sia attivo
|
||||
/// </summary>
|
||||
public static bool currDipIsActive
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DP.taDipendenti.getByIdx(idxDipendente)[0];
|
||||
answ = rigaDip.attivo;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static bool currDipIsActive => _currDipIsActive();
|
||||
|
||||
/// <summary>
|
||||
/// idxDipendente in sessione
|
||||
@@ -112,12 +91,79 @@ namespace GPW_data
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se il dip corrente ha un record valido in payload
|
||||
/// </summary>
|
||||
private static bool _currDipHasPayloadActive()
|
||||
{
|
||||
bool answ = licenzeGPW.userPayloadOk(idxDipendente);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se il dip corrente sia attivo
|
||||
/// </summary>
|
||||
private static bool _currDipIsActive()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DP.taDipendenti.getByIdx(idxDipendente)[0];
|
||||
answ = rigaDip.attivo;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se il dip RICHIESTO sia attivo
|
||||
/// </summary>
|
||||
/// <param name="_idxDipendente"></param>
|
||||
/// <returns></returns>
|
||||
private bool checkDipIsActive(int _idxDipendente)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DP.taDipendenti.getByIdx(_idxDipendente)[0];
|
||||
answ = rigaDip.attivo;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcola HASH del codice impiego
|
||||
/// </summary>
|
||||
/// <param name="rigaDip"></param>
|
||||
/// <returns></returns>
|
||||
private string getHashCodImpiego(DS_Applicazione.DipendentiRow rigaDip)
|
||||
{
|
||||
string hash = "";
|
||||
string answ = "";
|
||||
if (rigaDip != null)
|
||||
{
|
||||
answ = $"{rigaDip.idxDipendente}|{rigaDip.Cognome}.{rigaDip.Nome}|{rigaDip.CF}|{rigaDip.dataAssunzione:yyyyMMdd}|{rigaDip.email}|{rigaDip.matricola}";
|
||||
}
|
||||
// hashing!
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
byte[] InputBytes = Encoding.UTF8.GetBytes(answ);
|
||||
var byteHash = md5.ComputeHash(InputBytes);
|
||||
hash = BitConverter.ToString(byteHash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// init dei table adapters
|
||||
/// </summary>
|
||||
protected void initTA()
|
||||
private void initTA()
|
||||
{
|
||||
taAnCli = new DS_ApplicazioneTableAdapters.AnagClientiTableAdapter();
|
||||
taTimb = new DS_ApplicazioneTableAdapters.TimbratureTableAdapter();
|
||||
@@ -149,7 +195,7 @@ namespace GPW_data
|
||||
/// <summary>
|
||||
/// effettua setup dei connection strings da web.config delal singola applicazione
|
||||
/// </summary>
|
||||
protected virtual void setupConnectionStringBase()
|
||||
private void setupConnectionStringBase()
|
||||
{
|
||||
string connGPW = memLayer.ML.confReadString("GPWConnectionString");
|
||||
// connections del db
|
||||
@@ -180,7 +226,7 @@ namespace GPW_data
|
||||
taExpComm.Connection.ConnectionString = connGPW;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
@@ -202,18 +248,7 @@ namespace GPW_data
|
||||
/// </summary>
|
||||
/// <param name="_idxDipendente"></param>
|
||||
/// <returns></returns>
|
||||
public bool dipIsActive(int _idxDipendente)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DP.taDipendenti.getByIdx(_idxDipendente)[0];
|
||||
answ = rigaDip.attivo;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
public bool dipIsActive(int _idxDipendente) => checkDipIsActive(_idxDipendente);
|
||||
|
||||
/// <summary>
|
||||
/// effettua enroll del device
|
||||
@@ -300,24 +335,7 @@ namespace GPW_data
|
||||
/// </summary>
|
||||
/// <param name="rigaDip"></param>
|
||||
/// <returns></returns>
|
||||
public string hashCodImpiego(DS_Applicazione.DipendentiRow rigaDip)
|
||||
{
|
||||
string hash = "";
|
||||
string answ = "";
|
||||
if (rigaDip != null)
|
||||
{
|
||||
answ = $"{rigaDip.idxDipendente}|{rigaDip.Cognome}.{rigaDip.Nome}|{rigaDip.CF}|{rigaDip.dataAssunzione:yyyyMMdd}|{rigaDip.email}|{rigaDip.matricola}";
|
||||
}
|
||||
// hashing!
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
byte[] InputBytes = Encoding.UTF8.GetBytes(answ);
|
||||
var byteHash = md5.ComputeHash(InputBytes);
|
||||
hash = BitConverter.ToString(byteHash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
public string hashCodImpiego(DS_Applicazione.DipendentiRow rigaDip) => getHashCodImpiego(rigaDip);
|
||||
|
||||
/// <summary>
|
||||
/// invia una mail al destinatario x linkare nuovi devices tramite URL
|
||||
|
||||
+346
-330
@@ -15,32 +15,34 @@ namespace GPW_data
|
||||
{
|
||||
public class licenzeGPW
|
||||
{
|
||||
#region Protected Fields
|
||||
#region Private Fields
|
||||
|
||||
private static string _applicazione = memLayer.ML.confReadString("appName");
|
||||
|
||||
/// <summary>
|
||||
/// Url di base chiamate API gestione licenze
|
||||
/// </summary>
|
||||
//protected static string apiUrl = "https://localhost:44351/";
|
||||
protected static string apiUrl = "https://liman.egalware.com/ELM.API/";
|
||||
//private static string apiUrl = "https://localhost:44351/";
|
||||
private static string apiUrl = "https://liman.egalware.com/ELM.API/";
|
||||
|
||||
protected static string rkeyActInfo = memLayer.ML.redHash($"LiMan:ActInfo");
|
||||
private static string rkeyActInfo = memLayer.ML.redHash($"LiMan:ActInfo");
|
||||
|
||||
protected static string rkeyAppInfo = memLayer.ML.redHash($"LiMan:AppInfo");
|
||||
private static string rkeyAppInfo = memLayer.ML.redHash($"LiMan:AppInfo");
|
||||
|
||||
protected static string rkeyLicInfo = memLayer.ML.redHash($"LiMan:LicInfo");
|
||||
private static string rkeyLicInfo = memLayer.ML.redHash($"LiMan:LicInfo");
|
||||
|
||||
protected static string rkeyPayload = memLayer.ML.redHash($"LiMan:Payload");
|
||||
private static string rkeyPayload = memLayer.ML.redHash($"LiMan:Payload");
|
||||
|
||||
protected static string rkeyVetoRefPayL = memLayer.ML.redHash($"LiMan:VetoRefPayL");
|
||||
private static string rkeyVetoRefPayL = memLayer.ML.redHash($"LiMan:VetoRefPayL");
|
||||
|
||||
#endregion Protected Fields
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Properties
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Durata cache statica locale dati licenza, random circa 1 h
|
||||
/// </summary>
|
||||
protected static int LicCacheTTL
|
||||
private static int LicCacheTTL
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -49,354 +51,347 @@ namespace GPW_data
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
#endregion Private Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// nome applicazione sw
|
||||
/// </summary>
|
||||
public static string applicazione
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = memLayer.ML.confReadString("appName");
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static string applicazione => _applicazione;
|
||||
|
||||
/// <summary>
|
||||
/// numero di licenze attive da info online
|
||||
/// </summary>
|
||||
public static int attivazioniOnline
|
||||
{
|
||||
get
|
||||
{
|
||||
return InfoApplicativo.NumLicenzeAttive;
|
||||
}
|
||||
}
|
||||
public static int attivazioniOnline => _attivazioniOnline();
|
||||
|
||||
/// <summary>
|
||||
/// chaive licenza
|
||||
/// </summary>
|
||||
public static string authKey
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
// controllo su db...
|
||||
try
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valString;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static string authKey => _authKey();
|
||||
|
||||
/// <summary>
|
||||
/// verifica se numero licenze copre utenti attivi...
|
||||
/// </summary>
|
||||
public static bool checkLicenze
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// effettua refresh attivazioni...
|
||||
var fatto = RefreshActInfo().Result;
|
||||
answ = utentiAttivi <= licenzeAttive;
|
||||
if (!answ && memLayer.ML.confReadInt("_logLevel") > 5)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("WARNING licenze: utenti attivi {0} / licenziati {1}", utentiAttivi, licenzeAttive), tipoLog.WARNING);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static bool checkLicenze => _checkLicenze();
|
||||
|
||||
/// <summary>
|
||||
/// verifica se il payload delle licenze attivate sia valido (con server online)
|
||||
/// </summary>
|
||||
public static bool checkPayload
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
string currPayload = "";
|
||||
tryCheckPayloadOnline(ref answ, ref currPayload);
|
||||
|
||||
// se OK resetto counter, altrimenti incremento
|
||||
if (!answ)
|
||||
{
|
||||
bool okRefreshPayload = string.IsNullOrEmpty(memLayer.ML.getRSV(rkeyVetoRefPayL));
|
||||
if (okRefreshPayload)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
// richiedo update payload impostando TTL a 1 sec...
|
||||
memLayer.ML.setRSV(rkeyPayload, "", 1);
|
||||
var okApp = RefreshAppInfo().Result;
|
||||
var okLic = RefreshActInfo().Result;
|
||||
var okAct = RefreshLicInfo().Result;
|
||||
var okPld = RefreshPayload().Result;
|
||||
|
||||
// evito ricalcolo x 5 sec...
|
||||
memLayer.ML.setRSV(rkeyVetoRefPayL, "Veto", 5);
|
||||
sw.Stop();
|
||||
logger.lg.scriviLog($"Trovato payload non valido, effettuato reset variabili in {sw.ElapsedMilliseconds} ms");
|
||||
|
||||
sw.Start();
|
||||
tryCheckPayloadOnline(ref answ, ref currPayload);
|
||||
sw.Stop();
|
||||
logger.lg.scriviLog($"Rivalutato payload con esito {answ} in {sw.ElapsedMilliseconds} ms");
|
||||
}
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Info applicativo corrente (da cache con eventuale recupero online...)
|
||||
/// </summary>
|
||||
public static LiManObj.ApplicativoDTO InfoApplicativo
|
||||
{
|
||||
get
|
||||
{
|
||||
LiManObj.ApplicativoDTO answ = new LiManObj.ApplicativoDTO();
|
||||
// cerco da cache
|
||||
string rawData = memLayer.ML.getRSV(rkeyLicInfo);
|
||||
// se no ci fosse --> refresh online!
|
||||
if (string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
var fatto = RefreshAppInfo().Result;
|
||||
if (fatto)
|
||||
{
|
||||
rawData = memLayer.ML.getRSV(rkeyLicInfo);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
try
|
||||
{
|
||||
// verifico se ho 1 risultato o molti...se inizia per "[" è molti
|
||||
if (rawData.StartsWith("["))
|
||||
{
|
||||
// POTREBBE darmi + di 1 risultato, prendo + recente...
|
||||
List<LiManObj.ApplicativoDTO> infoList = JsonConvert.DeserializeObject<List<LiManObj.ApplicativoDTO>>(rawData);
|
||||
if (infoList != null)
|
||||
{
|
||||
answ = infoList.OrderByDescending(x => x.Scadenza).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<LiManObj.ApplicativoDTO>(rawData);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static bool checkPayload => _checkPayload();
|
||||
|
||||
/// <summary>
|
||||
/// nome installazione sw
|
||||
/// </summary>
|
||||
public static string installazione
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey("installazione")[0].valString;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore recupero chiave installazione da AKV: {0}", exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static string installazione => _installazione();
|
||||
|
||||
/// <summary>
|
||||
/// numero di licenze attive sul sw (SE CONFORMI A CHIAVE) altrimenti da dll steamware
|
||||
/// numero di licenze attive sul sw (SE CONFORMI A CHIAVE)
|
||||
/// </summary>
|
||||
public static int licenzeAttive
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
int licenzeMax = licenseMan.getLicenseNum(installazione, applicazione);
|
||||
// verifico dato su DB sia valido... expiry date con quel numero sia > della data odierna
|
||||
if (scadenzaLicenza >= DateTime.Today)
|
||||
{
|
||||
answ = licenzeDb;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = licenzeMax;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static int licenzeAttive => _licenzeAttive();
|
||||
|
||||
/// <summary>
|
||||
/// numero di licenze attive su DB (NON verificate!)
|
||||
/// </summary>
|
||||
public static int licenzeDb
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
// controllo su db...
|
||||
try
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valInt;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static int licenzeDb => _licenzeDb();
|
||||
|
||||
/// <summary>
|
||||
/// numero di licenze disponibili da info online
|
||||
/// </summary>
|
||||
public static int licenzeOnline
|
||||
{
|
||||
get
|
||||
{
|
||||
return InfoApplicativo.NumLicenze;
|
||||
}
|
||||
}
|
||||
public static int licenzeOnline => _licenzeOnline();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco attivazioni attuali
|
||||
/// </summary>
|
||||
public static List<LiManObj.AttivazioneDTO> ListaAttivazioni
|
||||
{
|
||||
get
|
||||
{
|
||||
List<LiManObj.AttivazioneDTO> answ = new List<LiManObj.AttivazioneDTO>();
|
||||
// cerco da cache
|
||||
string rawData = memLayer.ML.getRSV(rkeyActInfo);
|
||||
// se no ci fosse --> refresh online!
|
||||
if (string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
var fatto = RefreshActInfo().Result;
|
||||
if (fatto)
|
||||
{
|
||||
rawData = memLayer.ML.getRSV(rkeyActInfo);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<List<LiManObj.AttivazioneDTO>>(rawData);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static List<LiManObj.AttivazioneDTO> ListaAttivazioni => _ListaAttivazioni();
|
||||
|
||||
/// <summary>
|
||||
/// Chaive Licenza Master
|
||||
/// Chiave Licenza Master
|
||||
/// </summary>
|
||||
public static string MasterKey
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valString;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore recupero chiave MasterKey da AKV: {0}", exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static string MasterKey => _MasterKey();
|
||||
|
||||
/// <summary>
|
||||
/// modalità applicazione (pagina test.aspx)
|
||||
/// </summary>
|
||||
public static string modApp
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey("appMode")[0].valString;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore recupero chiave appMode da AKV: {0}", exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static string modApp => _modApp();
|
||||
|
||||
/// <summary>
|
||||
/// scadenza licenze x applicativo
|
||||
/// </summary>
|
||||
public static DateTime scadenzaLicenza
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = licenseMan.expiryDateByAuthKey(installazione, applicazione, DataProxy.DP.taAKV.getByKey(installazione)[0].valInt, DataProxy.DP.taAKV.getByKey(installazione)[0].valString);
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static DateTime scadenzaLicenza => _scadenzaLicenza();
|
||||
|
||||
/// <summary>
|
||||
/// numero di utenti attivi
|
||||
/// </summary>
|
||||
public static int utentiAttivi
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = DataProxy.DP.taDipendenti.getAttivi(false).Count;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public static int utentiAttivi => _utentiAttivi();
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static void tryCheckPayloadOnline(ref bool answ, ref string currPayload)
|
||||
/// <summary>
|
||||
/// numero di licenze attive da info online
|
||||
/// </summary>
|
||||
private static int _attivazioniOnline()
|
||||
{
|
||||
return InfoApplicativo().NumLicenzeAttive;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// chaive licenza
|
||||
/// </summary>
|
||||
private static string _authKey()
|
||||
{
|
||||
string answ = "";
|
||||
// controllo su db...
|
||||
try
|
||||
{
|
||||
// cerco payload licenze locale...
|
||||
currPayload = memLayer.ML.getRSV(rkeyPayload);
|
||||
// se no ci fosse --> refresh online!
|
||||
if (string.IsNullOrEmpty(currPayload))
|
||||
{
|
||||
currPayload = calcPayload();
|
||||
memLayer.ML.setRSV(rkeyPayload, currPayload, LicCacheTTL);
|
||||
}
|
||||
// confronto payload calc con quello della licenza
|
||||
answ = InfoApplicativo.Payload == currPayload;
|
||||
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valString;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
/// <summary>
|
||||
/// verifica se numero licenze copre utenti attivi...
|
||||
/// </summary>
|
||||
private static bool _checkLicenze()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// effettua refresh attivazioni...
|
||||
var fatto = RefreshActInfo().Result;
|
||||
answ = utentiAttivi <= licenzeAttive;
|
||||
if (!answ && memLayer.ML.confReadInt("_logLevel") > 5)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("WARNING licenze: utenti attivi {0} / licenziati {1}", utentiAttivi, licenzeAttive), tipoLog.WARNING);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
#region Protected Methods
|
||||
/// <summary>
|
||||
/// verifica se il payload delle licenze attivate sia valido (con server online)
|
||||
/// </summary>
|
||||
private static bool _checkPayload()
|
||||
{
|
||||
bool answ = false;
|
||||
string currPayload = "";
|
||||
tryCheckPayloadOnline(ref answ, ref currPayload);
|
||||
|
||||
protected static string calcPayload()
|
||||
// se OK resetto counter, altrimenti incremento
|
||||
if (!answ)
|
||||
{
|
||||
bool okRefreshPayload = string.IsNullOrEmpty(memLayer.ML.getRSV(rkeyVetoRefPayL));
|
||||
if (okRefreshPayload)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
// richiedo update payload impostando TTL a 1 sec...
|
||||
memLayer.ML.setRSV(rkeyPayload, "", 1);
|
||||
var okApp = RefreshAppInfo().Result;
|
||||
var okLic = RefreshActInfo().Result;
|
||||
var okAct = RefreshLicInfo().Result;
|
||||
var okPld = RefreshPayload().Result;
|
||||
|
||||
// evito ricalcolo x 5 sec...
|
||||
memLayer.ML.setRSV(rkeyVetoRefPayL, "Veto", 5);
|
||||
sw.Stop();
|
||||
logger.lg.scriviLog($"Trovato payload non valido, effettuato reset variabili in {sw.ElapsedMilliseconds} ms");
|
||||
|
||||
sw.Start();
|
||||
tryCheckPayloadOnline(ref answ, ref currPayload);
|
||||
sw.Stop();
|
||||
logger.lg.scriviLog($"Rivalutato payload con esito {answ} in {sw.ElapsedMilliseconds} ms");
|
||||
}
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// nome installazione sw
|
||||
/// </summary>
|
||||
private static string _installazione()
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey("installazione")[0].valString;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore recupero chiave installazione da AKV: {0}", exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// numero di licenze attive sul sw (SE CONFORMI A CHIAVE)
|
||||
/// </summary>
|
||||
private static int _licenzeAttive()
|
||||
{
|
||||
int answ = 0;
|
||||
int licenzeMax = licenseMan.getLicenseNum(installazione, applicazione);
|
||||
// verifico dato su DB sia valido... expiry date con quel numero sia > della data odierna
|
||||
if (scadenzaLicenza >= DateTime.Today)
|
||||
{
|
||||
answ = licenzeDb;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = licenzeMax;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// numero di licenze attive su DB (NON verificate!)
|
||||
/// </summary>
|
||||
private static int _licenzeDb()
|
||||
{
|
||||
int answ = 0;
|
||||
// controllo su db...
|
||||
try
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valInt;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// numero di licenze disponibili da info online
|
||||
/// </summary>
|
||||
private static int _licenzeOnline()
|
||||
{
|
||||
return InfoApplicativo().NumLicenze;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco attivazioni attuali
|
||||
/// </summary>
|
||||
private static List<LiManObj.AttivazioneDTO> _ListaAttivazioni()
|
||||
{
|
||||
List<LiManObj.AttivazioneDTO> answ = new List<LiManObj.AttivazioneDTO>();
|
||||
// cerco da cache
|
||||
string rawData = memLayer.ML.getRSV(rkeyActInfo);
|
||||
// se no ci fosse --> refresh online!
|
||||
if (string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
var fatto = RefreshActInfo().Result;
|
||||
if (fatto)
|
||||
{
|
||||
rawData = memLayer.ML.getRSV(rkeyActInfo);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<List<LiManObj.AttivazioneDTO>>(rawData);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiave Licenza Master
|
||||
/// </summary>
|
||||
private static string _MasterKey()
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valString;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore recupero chiave MasterKey da AKV: {0}", exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// modalità applicazione (pagina test.aspx)
|
||||
/// </summary>
|
||||
private static string _modApp()
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey("appMode")[0].valString;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore recupero chiave appMode da AKV: {0}", exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// scadenza licenze x applicativo
|
||||
/// </summary>
|
||||
private static DateTime _scadenzaLicenza()
|
||||
{
|
||||
DateTime answ = licenseMan.expiryDateByAuthKey(installazione, applicazione, DataProxy.DP.taAKV.getByKey(installazione)[0].valInt, DataProxy.DP.taAKV.getByKey(installazione)[0].valString);
|
||||
return answ;
|
||||
}
|
||||
|
||||
private static bool _userPayloadOk(int idxDip)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// recupero riga dip
|
||||
var userTab = DataProxy.DP.taDipendenti.getByIdx(idxDip);
|
||||
if (userTab != null && userTab.Count > 0)
|
||||
{
|
||||
var userRow = userTab[0];
|
||||
// calcolo suo codice...
|
||||
var codImpCurr = DataProxy.DP.hashCodImpiego(userRow);
|
||||
// cerco dip tra elenco json
|
||||
var userLocalList = ListaAttivazioni;
|
||||
var foundRec = userLocalList.Where(x => x.CodImpiego == codImpCurr);
|
||||
answ = foundRec.Count() > 0;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// numero di utenti attivi
|
||||
/// </summary>
|
||||
private static int _utentiAttivi()
|
||||
{
|
||||
int answ = DataProxy.DP.taDipendenti.getAttivi(false).Count;
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcolo Hash data stringa input
|
||||
/// </summary>
|
||||
/// <param name="rawData"></param>
|
||||
/// <returns></returns>
|
||||
private static string calcHash(string rawData)
|
||||
{
|
||||
string hash = "";
|
||||
// hashing!
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
byte[] InputBytes = Encoding.UTF8.GetBytes(rawData);
|
||||
var byteHash = md5.ComputeHash(InputBytes);
|
||||
hash = BitConverter.ToString(byteHash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
private static string calcPayload()
|
||||
{
|
||||
string answ = "";
|
||||
// costruisco stringa da elenco impieghi...
|
||||
@@ -428,28 +423,71 @@ namespace GPW_data
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
/// <summary>
|
||||
/// Info applicativo corrente (da cache con eventuale recupero online...)
|
||||
/// </summary>
|
||||
private static LiManObj.ApplicativoDTO InfoApplicativo()
|
||||
{
|
||||
LiManObj.ApplicativoDTO answ = new LiManObj.ApplicativoDTO();
|
||||
// cerco da cache
|
||||
string rawData = memLayer.ML.getRSV(rkeyLicInfo);
|
||||
// se no ci fosse --> refresh online!
|
||||
if (string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
var fatto = RefreshAppInfo().Result;
|
||||
if (fatto)
|
||||
{
|
||||
rawData = memLayer.ML.getRSV(rkeyLicInfo);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
try
|
||||
{
|
||||
// verifico se ho 1 risultato o molti...se inizia per "[" è molti
|
||||
if (rawData.StartsWith("["))
|
||||
{
|
||||
// POTREBBE darmi + di 1 risultato, prendo + recente...
|
||||
List<LiManObj.ApplicativoDTO> infoList = JsonConvert.DeserializeObject<List<LiManObj.ApplicativoDTO>>(rawData);
|
||||
if (infoList != null)
|
||||
{
|
||||
answ = infoList.OrderByDescending(x => x.Scadenza).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<LiManObj.ApplicativoDTO>(rawData);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private static void tryCheckPayloadOnline(ref bool answ, ref string currPayload)
|
||||
{
|
||||
try
|
||||
{
|
||||
// cerco payload licenze locale...
|
||||
currPayload = memLayer.ML.getRSV(rkeyPayload);
|
||||
// se no ci fosse --> refresh online!
|
||||
if (string.IsNullOrEmpty(currPayload))
|
||||
{
|
||||
currPayload = calcPayload();
|
||||
memLayer.ML.setRSV(rkeyPayload, currPayload, LicCacheTTL);
|
||||
}
|
||||
// confronto payload calc con quello della licenza
|
||||
answ = InfoApplicativo().Payload == currPayload;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Calcolo Hash data stringa input
|
||||
/// </summary>
|
||||
/// <param name="rawData"></param>
|
||||
/// <returns></returns>
|
||||
public static string calcHash(string rawData)
|
||||
{
|
||||
string hash = "";
|
||||
// hashing!
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
byte[] InputBytes = Encoding.UTF8.GetBytes(rawData);
|
||||
var byteHash = md5.ComputeHash(InputBytes);
|
||||
hash = BitConverter.ToString(byteHash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica attivazione licenza dato codice impiego
|
||||
/// </summary>
|
||||
@@ -741,29 +779,7 @@ namespace GPW_data
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
public static bool userPayloadOk(int idxDip)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// recupero riga dip
|
||||
var userTab = DataProxy.DP.taDipendenti.getByIdx(idxDip);
|
||||
if (userTab != null && userTab.Count > 0)
|
||||
{
|
||||
var userRow = userTab[0];
|
||||
// calcolo suo codice...
|
||||
var codImpCurr = DataProxy.DP.hashCodImpiego(userRow);
|
||||
// cerco dip tra elenco json
|
||||
var userLocalList = ListaAttivazioni;
|
||||
var foundRec = userLocalList.Where(x => x.CodImpiego == codImpCurr);
|
||||
answ = foundRec.Count() > 0;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
return answ;
|
||||
}
|
||||
public static bool userPayloadOk(int idxDip) => _userPayloadOk(idxDip);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
+9
-9
@@ -156,7 +156,7 @@ namespace GPW_data
|
||||
DS_Applicazione.stp_DipendentiAndAnomalieDataTable tabDipAndAnom = new DS_Applicazione.stp_DipendentiAndAnomalieDataTable();
|
||||
DS_Applicazione.TimbratureExplDataTable tabTimbExpl = new DS_Applicazione.TimbratureExplDataTable();
|
||||
DS_Applicazione.TE_RA_ExplDataTable tabTimbRegAtt = new DS_Applicazione.TE_RA_ExplDataTable();
|
||||
DateTime adesso = DateTime.Now;
|
||||
DateTime oggi = DateTime.Today;
|
||||
int gg2Chk = memLayer.ML.confReadInt("gg2Chk");
|
||||
int gg2ChkCont = memLayer.ML.confReadInt("gg2ChkCont");
|
||||
int gg2ChkOreCaricate = memLayer.ML.confReadInt("gg2ChkOreCaricate");
|
||||
@@ -164,7 +164,7 @@ namespace GPW_data
|
||||
// (A) recupero mancate approvazioni, mando solo ad admin
|
||||
if (memLayer.ML.confReadBool("checkAnomAppr"))
|
||||
{
|
||||
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), true, false, false);
|
||||
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, oggi.AddDays(-gg2Chk), oggi, true, false, false);
|
||||
// se ho trovato record...
|
||||
if (tabTimbExpl.Rows.Count > 0)
|
||||
{
|
||||
@@ -193,8 +193,8 @@ namespace GPW_data
|
||||
// (B) recupero errori entrate/uscite, mando ad admin + utenti
|
||||
if (memLayer.ML.confReadBool("checkAnomTimb"))
|
||||
{
|
||||
tabDipAndAnom = DataProxy.DP.taDipAnom.GetData(adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
|
||||
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
|
||||
tabDipAndAnom = DataProxy.DP.taDipAnom.GetData(oggi.AddDays(-gg2Chk), oggi.AddHours(1), false, true, false);
|
||||
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, oggi.AddDays(-gg2Chk), oggi.AddHours(1), false, true, false);
|
||||
// se ho trovato record...
|
||||
if (tabTimbExpl.Rows.Count > 0)
|
||||
{
|
||||
@@ -227,7 +227,7 @@ namespace GPW_data
|
||||
{
|
||||
if (!string.IsNullOrEmpty(rigaDip.email))
|
||||
{
|
||||
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(rigaDip.idxDipendente, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
|
||||
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(rigaDip.idxDipendente, oggi.AddDays(-gg2Chk), oggi.AddHours(1), false, true, false);
|
||||
// reimposto testo
|
||||
if (memLayer.ML.confReadBool("includeDirectUrl"))
|
||||
{
|
||||
@@ -255,8 +255,8 @@ namespace GPW_data
|
||||
// (C) recupero errori mancata copertura orario, mando ad admin
|
||||
if (memLayer.ML.confReadBool("checkAnomOreLav"))
|
||||
{
|
||||
tabDipAndAnom = DataProxy.DP.taDipAnom.GetData(adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, false, true);
|
||||
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, false, true);
|
||||
tabDipAndAnom = DataProxy.DP.taDipAnom.GetData(oggi.AddDays(-gg2Chk), oggi.AddHours(1), false, false, true);
|
||||
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, oggi.AddDays(-gg2Chk), oggi.AddHours(1), false, false, true);
|
||||
// se ho trovato record...
|
||||
if (tabTimbExpl.Rows.Count > 0)
|
||||
{
|
||||
@@ -286,7 +286,7 @@ namespace GPW_data
|
||||
// (D) recupero errori copertura ore lavorate / ore caricate a commessa...
|
||||
if (memLayer.ML.confReadBool("checkAnomOreLavComm"))
|
||||
{
|
||||
tabTimbRegAtt = DataProxy.DP.taTimbRegAtt.GetData(0, adesso.AddDays(-gg2ChkOreCaricate), adesso.AddHours(1), false, true, memLayer.ML.confReadInt("maxErrMin"), memLayer.ML.confReadInt("maxErrPlus"));
|
||||
tabTimbRegAtt = DataProxy.DP.taTimbRegAtt.GetData(0, oggi.AddDays(-gg2ChkOreCaricate), oggi.AddHours(1), false, true, memLayer.ML.confReadInt("maxErrMin"), memLayer.ML.confReadInt("maxErrPlus"));
|
||||
// sulla tabella seleziono SE NON E' OK colonna okLavCom
|
||||
if (((DS_Applicazione.TE_RA_ExplRow[])tabTimbRegAtt.Select(" okLavCom = 0 ")).Length > 0)
|
||||
{
|
||||
@@ -315,7 +315,7 @@ namespace GPW_data
|
||||
// (E) cerco anomalie x orario continuato (no Pausa Pranzo, solo 1 IN, 1 OUT)
|
||||
if (memLayer.ML.confReadBool("checkAnomContinuato"))
|
||||
{
|
||||
tabTimbExpl = DataProxy.DP.taTimbExpl.getContinuato(0, adesso.AddDays(-gg2ChkCont), adesso.AddHours(1));
|
||||
tabTimbExpl = DataProxy.DP.taTimbExpl.getContinuato(0, oggi.AddDays(-gg2ChkCont), oggi.AddHours(1));
|
||||
// se ho trovato record...
|
||||
if (tabTimbExpl.Rows.Count > 0)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
|
||||
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
|
||||
Reference in New Issue
Block a user