156 lines
6.3 KiB
C#
156 lines
6.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace ETS_Data
|
|
{
|
|
/// <summary>
|
|
/// classe proxy dati x PROJ-ETS
|
|
/// </summary>
|
|
public class DataProxy_ProjEts
|
|
{
|
|
#region area table adapters
|
|
|
|
/* Ds_ProjEts */
|
|
public Ds_ProjEtsTableAdapters.AnagProgettiTableAdapter taAP;
|
|
public Ds_ProjEtsTableAdapters.AnagFasiTableAdapter taAF;
|
|
public Ds_ProjEtsTableAdapters.DatiCommessaTableAdapter taDC;
|
|
public Ds_ProjEtsTableAdapters.DatiCommFornTableAdapter taDCF;
|
|
public Ds_ProjEtsTableAdapters.DatiCommIntegTableAdapter taDCI;
|
|
public Ds_ProjEtsTableAdapters.BdgtRisorseFasiTableAdapter taBRF;
|
|
public Ds_ProjEtsTableAdapters.AnagTipoRisorseTableAdapter taATR;
|
|
/* DS_utilsProjEts */
|
|
public DS_utilsProjEtsTableAdapters.v_selClientiTableAdapter taSelCli;
|
|
public DS_utilsProjEtsTableAdapters.v_selProgettiTableAdapter taSelPro;
|
|
public DS_utilsProjEtsTableAdapters.v_selCommesseTableAdapter taSelCom;
|
|
|
|
/// <summary>
|
|
/// init dei table adapters
|
|
/// </summary>
|
|
protected void initTA()
|
|
{
|
|
taAP = new Ds_ProjEtsTableAdapters.AnagProgettiTableAdapter();
|
|
taAF = new Ds_ProjEtsTableAdapters.AnagFasiTableAdapter();
|
|
taDC = new Ds_ProjEtsTableAdapters.DatiCommessaTableAdapter();
|
|
taDCF = new Ds_ProjEtsTableAdapters.DatiCommFornTableAdapter();
|
|
taDCI = new Ds_ProjEtsTableAdapters.DatiCommIntegTableAdapter();
|
|
taBRF = new Ds_ProjEtsTableAdapters.BdgtRisorseFasiTableAdapter();
|
|
taATR = new Ds_ProjEtsTableAdapters.AnagTipoRisorseTableAdapter();
|
|
taSelCli = new DS_utilsProjEtsTableAdapters.v_selClientiTableAdapter();
|
|
taSelPro = new DS_utilsProjEtsTableAdapters.v_selProgettiTableAdapter();
|
|
taSelCom = new DS_utilsProjEtsTableAdapters.v_selCommesseTableAdapter();
|
|
}
|
|
/// <summary>
|
|
/// effettua setup dei connection strings da web.config delal singola applicazione
|
|
/// </summary>
|
|
protected virtual void setupConnectionStringBase()
|
|
{
|
|
// connections del db
|
|
taAP.Connection.ConnectionString = utils.obj.confReadString("ETS_PROJConnectionString");
|
|
taAF.Connection.ConnectionString = utils.obj.confReadString("ETS_PROJConnectionString");
|
|
taDC.Connection.ConnectionString = utils.obj.confReadString("ETS_PROJConnectionString");
|
|
taDCF.Connection.ConnectionString = utils.obj.confReadString("ETS_PROJConnectionString");
|
|
taDCI.Connection.ConnectionString = utils.obj.confReadString("ETS_PROJConnectionString");
|
|
taBRF.Connection.ConnectionString = utils.obj.confReadString("ETS_PROJConnectionString");
|
|
taATR.Connection.ConnectionString = utils.obj.confReadString("ETS_PROJConnectionString");
|
|
taSelCli.Connection.ConnectionString = utils.obj.confReadString("ETS_PROJConnectionString");
|
|
taSelPro.Connection.ConnectionString = utils.obj.confReadString("ETS_PROJConnectionString");
|
|
taSelCom.Connection.ConnectionString = utils.obj.confReadString("ETS_PROJConnectionString");
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected DataProxy_ProjEts()
|
|
{
|
|
initTA();
|
|
setupConnectionStringBase();
|
|
}
|
|
/// <summary>
|
|
/// Singleton accesso a DataProxy
|
|
/// </summary>
|
|
public static DataProxy_ProjEts DP = new DataProxy_ProjEts();
|
|
|
|
#region utility public esposte
|
|
|
|
/// <summary>
|
|
/// invia una mail al destinatario x linkare nuovi devices tramite URL
|
|
/// </summary>
|
|
/// <param name="destinatario"></param>
|
|
/// <param name="UserAuthKey"></param>
|
|
/// <param name="idxDipendente"></param>
|
|
/// <returns></returns>
|
|
public bool sendUserAuthEmail(string destinatario, string UserAuthKey, int idxDipendente)
|
|
{
|
|
bool fatto = false;
|
|
string smtpCli = "";
|
|
string mittente = "";
|
|
string oggetto = "";
|
|
string userUrl = "";
|
|
string baseUrl = "";
|
|
string userWebUrl = "";
|
|
string baseWebUrl = "";
|
|
string corpo = "";
|
|
try
|
|
{
|
|
// compongo la stringa
|
|
smtpCli = utils.obj.confReadString("_smtpCli");
|
|
mittente = utils.obj.confReadString("_fromEmail");
|
|
oggetto = "Link autorizzazione device per GPW";
|
|
baseUrl = utils.obj.confReadString("baseUrl");
|
|
baseWebUrl = utils.obj.confReadString("baseWebUrl");
|
|
userUrl = string.Format("{2}jumper.aspx?UserAuthkey={0}&idxDipendente={1}", UserAuthKey, idxDipendente, baseUrl);
|
|
userWebUrl = string.Format("{2}jumper.aspx?UserAuthkey={0}&idxDipendente={1}", UserAuthKey, idxDipendente, baseWebUrl);
|
|
corpo = string.Format("Hai ricevuto questa email su richiesta tua o dell'Admin per poter procedere a registrare un (nuovo) devices con GPW:{0}<br/>Per proseguire clicca sul link seguente(rete interna):<br />{0}{0}{1}{0}{0}<br /><br />oppure sul link seguente (internet):<br />{0}{0}{2}{0}{0}<br /><br />Team GPW Steamware", Environment.NewLine, userUrl, userWebUrl);
|
|
#if false
|
|
gestEmail.ge.mandaEmail(mittente, destinatario, oggetto, corpo);
|
|
fatto = true;
|
|
#endif
|
|
}
|
|
catch
|
|
{ }
|
|
return fatto;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// idxDipendente in sessione
|
|
/// </summary>
|
|
public static int idxDipendente
|
|
{
|
|
get
|
|
{
|
|
int idx = 0;
|
|
try
|
|
{
|
|
idx = utils.obj.IntSessionObj("IdxDipendente");
|
|
}
|
|
catch
|
|
{ }
|
|
return idx;
|
|
}
|
|
set
|
|
{
|
|
utils.obj.setSessionVal("idxDipendente", value);
|
|
}
|
|
}
|
|
|
|
public string CognomeNomeByIdx(int idxDip)
|
|
{
|
|
string answ = "";
|
|
#if false
|
|
try
|
|
{
|
|
DS_Applicazione.DipendentiRow rigaDip = taDipendenti.getByIdx(idxDip)[0];
|
|
answ = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
|
}
|
|
catch
|
|
{ }
|
|
#endif
|
|
return answ;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|