2025-04-15 12:10:19 +02:00

95 lines
3.6 KiB
C#

using System;
using System.Web;
using System.Net;
using bancafideuram.nac.ads4ws;
public partial class InitForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e) {
if (Debug.iSDebug) {
txb_PB.Text = Debug.Agente;
txb_CodiceCliente.Text = Debug.Codfis;
txb_Rete.Text = Debug.Rete;
txb_PB_Nucleo.Text = Debug.Agente;
txb_Chiave_Nucleo.Text = Debug.ChiaveNucleo;
txb_Rete_Nucleo.Text = Debug.Rete;
}
}
protected void btn_Ok_Click(object sender, EventArgs e)
{
Session.RemoveAll();
string codPB = this.txb_PB.Text.Trim();
string tipoRete = this.txb_Rete.Text.ToUpper().Trim();
string codCliente = (this.txb_CodiceCliente.Text).ToUpper().Trim();
string codAssistente = this.txb_CodiceAssistente.Text.ToUpper().Trim();
string token = string.Empty;
codAssistente = string.IsNullOrEmpty(codAssistente) ? codPB : codAssistente;
//set cookie
HttpCookie cookie = new HttpCookie("UserID");
String strHostName = Dns.GetHostName();
IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);
IPAddress[] addr = ipEntry.AddressList;
cookie.Value = addr[0].ToString();
Response.Cookies.Add(cookie);
#region Frames.aspx
string initialURI = WebConfigParameter.getParameter("URI");
string command = "window.open(\" " + initialURI + "?codPB=" + codPB + "&codCliente=" + codCliente + "&codAs=" + codAssistente + "&token=" + token + "&tipoRete=" + tipoRete + "\");";
ClientScript.RegisterClientScriptBlock(typeof(string), "one",
"<script language=\"javascript\">" + "\n" +
"<!--" + "\n" +
command + "\n" +
"//-->" + "\n" +
"</script>");
#endregion
}
protected void btn_Ok_Nucleo_Click(object sender, EventArgs e)
{
string codPB = this.txb_PB_Nucleo.Text.Trim();
string tipoRete = this.txb_Rete_Nucleo.Text.ToUpper().Trim();
string chiaveNucleo = (this.txb_Chiave_Nucleo.Text).ToUpper().Trim();
string initialURI = "reportNucleiFamiliari.aspx";
//reportNucleiFamiliari.aspx?chiaveNucleo=646&codPB=001016&tipoRete=F&token=
//http://localhost/SeiReportEvoluzione/reportNucleiFamiliari.aspx?chiaveNucleo=646&codPB=001016&tipoRete=F&token=
string command = "window.open(\" " + initialURI + "?codPB=" + codPB + "&chiaveNucleo=" + chiaveNucleo + "&token=" + "&tipoRete=" + tipoRete + "\");";
ClientScript.RegisterClientScriptBlock(typeof(string), "one",
"<script language=\"javascript\">" + "\n" +
"<!--" + "\n" +
command + "\n" +
"//-->" + "\n" +
"</script>");
}
private bool GetAutorizzazioni(string UserId, string CodApp)
{
bool utenteAutorizzato = false;
Ads4wsImpl asd4web = new Ads4wsImpl();
asd4web.Url = WebConfigParameter.getParameter("hp_sei.ads4ws");
GetAutorizzazioniResponse risposta = asd4web.getAutorizzazione(UserId, CodApp);
if (risposta.Applicazione.attiva == true)
utenteAutorizzato = true;
return utenteAutorizzato;
}
}