75 lines
2.3 KiB
C#
75 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SteamWare;
|
|
using GPW_data;
|
|
|
|
namespace GPW.WebUserControls
|
|
{
|
|
public partial class mod_enrollByJumperAuthKey : System.Web.UI.UserControl
|
|
{
|
|
#region Protected Methods
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
// procedo alla ricerca di dati via sessione x User AuthKey
|
|
tryAutoEnroll();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// prova a fare auto enroll
|
|
/// </summary>
|
|
public void tryAutoEnroll()
|
|
{
|
|
// recupero dati da session
|
|
string UserAuthKey = "";
|
|
int idxDipendente = 0;
|
|
string userAgent = "";
|
|
bool fatto = false;
|
|
string DeviceName = "";
|
|
string IPv4 = "";
|
|
try
|
|
{
|
|
UserAuthKey = memLayer.ML.StringSessionObj("UserAuthKey");
|
|
idxDipendente = memLayer.ML.IntSessionObj("idxDipendente");
|
|
userAgent = Request.UserAgent;
|
|
}
|
|
catch
|
|
{ }
|
|
// se ci sono i dati effettua tentativo di AutoEnroll del device
|
|
if (idxDipendente > 0 && !string.IsNullOrEmpty(UserAuthKey))
|
|
{
|
|
DeviceName = Request.UserHostName;
|
|
IPv4 = Request.UserHostName;
|
|
fatto = DataProxy.DP.enrollDevice(UserAuthKey, IPv4, DeviceName, userAgent, idxDipendente);
|
|
if (fatto)
|
|
{
|
|
string CognomeNome = "USER ND";
|
|
try
|
|
{
|
|
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.getRowDip(idxDipendente);
|
|
CognomeNome = $"{rigaDip.Cognome} {rigaDip.Nome} [{idxDipendente}]";
|
|
}
|
|
catch
|
|
{ }
|
|
memLayer.ML.setSessionVal("cognomeNome", CognomeNome);
|
|
Response.Redirect("Timbrature.aspx");
|
|
}
|
|
else
|
|
{
|
|
// forzo logout
|
|
Response.Redirect("logout.aspx");
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |