68 lines
2.3 KiB
C#
68 lines
2.3 KiB
C#
using GPW_data;
|
|
using SteamWare;
|
|
using System;
|
|
|
|
namespace GPW.WebUserControls
|
|
{
|
|
public partial class mod_enrollByEmail : System.Web.UI.UserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
}
|
|
/// <summary>
|
|
/// salvo nuovo device...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnConferma_Click(object sender, EventArgs e)
|
|
{
|
|
// cerco se esista l'utente data la sua email...
|
|
int idxDipendente = 0;
|
|
string UserAuthKey = "";
|
|
string destinatario = "";
|
|
bool fatto = false;
|
|
DS_Applicazione.DipendentiRow dipendente = null;
|
|
try
|
|
{
|
|
dipendente = DataProxy.DP.taDipendenti.getByEmail(txtUserEmail.Text.Trim())[0];
|
|
idxDipendente = dipendente.idxDipendente;
|
|
UserAuthKey = dipendente.authKey;
|
|
destinatario = dipendente.email;
|
|
}
|
|
catch
|
|
{ }
|
|
if (!string.IsNullOrEmpty(destinatario) && idxDipendente > 0)
|
|
{
|
|
// invio email...
|
|
fatto = DataProxy.DP.sendUserAuthEmail(destinatario, UserAuthKey, idxDipendente);
|
|
if (fatto)
|
|
{
|
|
logger.lg.scriviLog(string.Format("Inviata mail x auth smart device: destinatario: {0}, authKey: {1}, idxDip: {2}", destinatario, UserAuthKey, idxDipendente), tipoLog.INFO);
|
|
lblWarning.Text = "Email inviata!";
|
|
lblWarning.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
lblWarning.Text = "ERRORE in invio email auth!";
|
|
lblWarning.Visible = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
lblWarning.Text = "Email non valida/dipendente non trovato!";
|
|
lblWarning.Visible = true;
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// resetto tutto
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAnnulla_Click(object sender, EventArgs e)
|
|
{
|
|
txtUserEmail.Text = "";
|
|
lblWarning.Visible = false;
|
|
}
|
|
}
|
|
} |