Files
gpw_testci/GPW/WebUserControls/mod_enrollByEmail.ascx.cs
2021-03-26 17:17:28 +01:00

63 lines
2.0 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_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 = "";
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 (destinatario != "" && idxDipendente > 0)
{
// invio email...
DataProxy.DP.sendUserAuthEmail(destinatario, UserAuthKey, idxDipendente);
logger.lg.scriviLog(string.Format("Inviata mail x auth smart device: destinatario: {0}, authKey: {1}, idxDip: {2}", destinatario, UserAuthKey, idxDipendente), tipoLog.INFO);
}
else
{
lblWarning.Text = "Email non valida/dipendente non trovato!";
lblWarning.Visible = false;
}
}
/// <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;
}
}
}