323 lines
12 KiB
C#
323 lines
12 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Configuration;
|
|
using System.Collections;
|
|
using System.Web;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.WebControls.WebParts;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Threading;
|
|
using System.Collections.Generic;
|
|
|
|
public partial class RicercaHD : System.Web.UI.Page
|
|
{
|
|
protected string nominativoUtente = "";
|
|
protected string rete = "";
|
|
protected string codicePB = "";
|
|
protected string cognomePB = "";
|
|
protected string nomePB = "";
|
|
protected string codiceFiscale = "";
|
|
protected string cognomeCliente = "";
|
|
protected string nomeCliente = "";
|
|
protected DataTable queryConContratti = null;
|
|
protected string tipoReport = "";
|
|
private bool confermaPushed = false;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
Utente utente = GetUtenteAutorizzato.getUtenteHDUS();
|
|
if (!utente.UtenteAutorizzatoApplicazione)
|
|
throw new Exception("Utente non abilitato:" + utente.UserId);
|
|
else
|
|
nominativoUtente = utente.Nome + " " + utente.Cognome;
|
|
}
|
|
protected void Ricerca_Click(object sender, EventArgs e)
|
|
{
|
|
//this.lbl_Message.Text = "";
|
|
|
|
DataTable dtDg = GetData();
|
|
queryConContratti = dtDg;
|
|
dg.CurrentPageIndex = 0;
|
|
dg.DataSource = dtDg;
|
|
dg.DataBind();
|
|
dg.Visible = true;
|
|
dg.SelectedIndex = -1;
|
|
Conferma.Visible = false;
|
|
//this.lbl_Message.ForeColor = System.Drawing.Color.Black;
|
|
//this.lbl_Message.Text = "Sono stati trovati " + dtDg.Rows.Count + " record con il criterio di ricerca prescelto.";
|
|
}
|
|
protected void dg_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Conferma.Visible = (dg.SelectedItem != null);
|
|
}
|
|
protected void dg_PageIndex(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
|
|
{
|
|
dg.CurrentPageIndex = e.NewPageIndex;
|
|
dg.DataSource = GetData();
|
|
dg.DataBind();
|
|
|
|
//cambiaPagina(e.NewPageIndex);
|
|
}
|
|
|
|
private DataTable GetData()
|
|
{
|
|
|
|
List<Parametro> parametri = new List<Parametro>();
|
|
|
|
Parametro codicePb = new Parametro();
|
|
codicePb.ParameterName = "CodicePB";
|
|
codicePb.DbType = DbType.String;
|
|
codicePb.Value = GetValueParameter(TXCodicePB.Text);
|
|
parametri.Add(codicePb);
|
|
|
|
Parametro nomePb = new Parametro();
|
|
nomePb.ParameterName = "NomePB";
|
|
nomePb.DbType = DbType.String;
|
|
nomePb.Value = GetValueParameter(TXNomePB.Text);
|
|
parametri.Add(nomePb);
|
|
|
|
Parametro cognomePb = new Parametro();
|
|
cognomePb.ParameterName = "CognomePB";
|
|
cognomePb.DbType = DbType.String;
|
|
cognomePb.Value = GetValueParameter(TXCognomePB.Text);
|
|
parametri.Add(cognomePb);
|
|
|
|
Parametro cofdiceFiscale = new Parametro();
|
|
cofdiceFiscale.ParameterName = "CFCliente";
|
|
cofdiceFiscale.DbType = DbType.String;
|
|
cofdiceFiscale.Value = GetValueParameter(TXCodiceFiscale.Text);
|
|
parametri.Add(cofdiceFiscale);
|
|
|
|
Parametro nomeCliente = new Parametro();
|
|
nomeCliente.ParameterName = "NomeCliente";
|
|
nomeCliente.DbType = DbType.String;
|
|
nomeCliente.Value = GetValueParameter(TXNomeCliente.Text);
|
|
parametri.Add(nomeCliente);
|
|
|
|
Parametro cognomeCliente = new Parametro();
|
|
cognomeCliente.ParameterName = "CognomeCliente";
|
|
cognomeCliente.DbType = DbType.String;
|
|
cognomeCliente.Value = GetValueParameter(TXCognomeCliente.Text);
|
|
parametri.Add(cognomeCliente);
|
|
|
|
Parametro rete = new Parametro();
|
|
rete.ParameterName = "Rete";
|
|
rete.DbType = DbType.String;
|
|
rete.Value = GetValueParameter(DDRete.SelectedValue);
|
|
parametri.Add(rete);
|
|
|
|
DataTable dtDgData = DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServer, "C6_S_QueryRicerca", parametri);
|
|
//dtDgData.TableName = "dati";
|
|
//cofdiceFiscale.ParameterName = "cod_fiscale";
|
|
|
|
//DataTable queryCodiceContratto = DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServerStampeC6, "C6Mart.getCodiceContratto", parametri);
|
|
//DataSet ds = new DataSet();
|
|
|
|
//ds.Tables.Add(dtDgData);
|
|
//queryCodiceContratto.TableName = "queryContratto";
|
|
//ds.Tables.Add(queryCodiceContratto);
|
|
|
|
//DataRelation drel = new DataRelation("joinApplicativo", dtDgData.Columns["CodiceFiscale"], queryCodiceContratto.Columns["cod_fiscale"]);
|
|
//ds.Relations.Add(drel);
|
|
|
|
//DataTable T_JOIN = new DataTable("Joinedtable");
|
|
//T_JOIN.Columns.Add("codicePB", typeof(String));
|
|
//T_JOIN.Columns.Add("NomePB", typeof(String));
|
|
//T_JOIN.Columns.Add("CognomePB", typeof(String));
|
|
//T_JOIN.Columns.Add("rete", typeof(String));
|
|
//T_JOIN.Columns.Add("CodiceFiscale", typeof(String));
|
|
//T_JOIN.Columns.Add("NomeCliente", typeof(String));
|
|
//T_JOIN.Columns.Add("CognomeCliente", typeof(String));
|
|
//T_JOIN.Columns.Add("CodiceContratto", typeof(String));
|
|
//T_JOIN.Columns.Add("TipoReport", typeof(String));
|
|
|
|
////ds.Tables.Add(T_JOIN);
|
|
|
|
//DataRow joinTuple = null;
|
|
//foreach (DataRow dr1 in dtDgData.Rows)
|
|
//{
|
|
|
|
// //DataRow parent = dr.GetParentRow("joinApplicativo");
|
|
// //DataRow current = T_JOIN.NewRow();
|
|
// //// Just add all the columns' data in "dr" to the New table.
|
|
|
|
// foreach (DataRow dr2 in queryCodiceContratto.Rows)
|
|
// {
|
|
// if (dr1["CodiceFiscale"].ToString() == dr2["cod_fiscale"].ToString())
|
|
// {
|
|
// joinTuple = T_JOIN.NewRow();
|
|
// joinTuple["codicePB"] = dr1["codicePB"];
|
|
// joinTuple["NomePB"] = dr1["NomePB"];
|
|
// joinTuple["CognomePB"] = dr1["CognomePB"];
|
|
// joinTuple["rete"] = dr1["rete"];
|
|
// joinTuple["CodiceFiscale"] = dr1["CodiceFiscale"];
|
|
// joinTuple["NomeCliente"] = dr1["NomeCliente"];
|
|
// joinTuple["CognomeCliente"] = dr1["CognomeCliente"];
|
|
// joinTuple["CodiceContratto"] = dr2["CodiceContratto"];
|
|
// joinTuple["TipoReport"] = dr1["TipoReport"];
|
|
// T_JOIN.Rows.Add(joinTuple);
|
|
// }
|
|
// }
|
|
|
|
// Add the column that is not present in the child, which is present in the parent.
|
|
|
|
|
|
|
|
//}
|
|
|
|
return dtDgData;
|
|
|
|
}
|
|
|
|
private object GetValueParameter(string value)
|
|
{
|
|
if (String.IsNullOrEmpty(value))
|
|
{
|
|
return DBNull.Value;
|
|
}
|
|
else
|
|
{
|
|
return value.Trim();
|
|
}
|
|
}
|
|
|
|
//protected void Conferma_Click(object sender, EventArgs e)
|
|
//{
|
|
// DataGridItem dgItem = dg.SelectedItem;
|
|
// string rete = dgItem.Cells[0].Text;
|
|
// string codicePB = dgItem.Cells[1].Text;
|
|
// string codiceFiscale = dgItem.Cells[2].Text;
|
|
// string cognomeCliente = dgItem.Cells[3].Text;
|
|
// string nomeCliente = dgItem.Cells[4].Text;
|
|
// //metto le informazione in sessione
|
|
// GetUtenteAutorizzato.setDatiHDUS(rete, codicePB, codiceFiscale, cognomeCliente, nomeCliente);
|
|
// //Server.Transfer("../ArchivioDocumenti.aspx");
|
|
// Response.Redirect("../ArchivioDocumenti.aspx");
|
|
//}
|
|
protected void ConfermaFuoriUPanel_Click(object sender, EventArgs e)
|
|
{
|
|
confermaPushed = true;
|
|
DataGridItem dgItem = dg.SelectedItem;
|
|
rete = dgItem.Cells[0].Text;
|
|
codicePB = dgItem.Cells[1].Text;
|
|
cognomePB = dgItem.Cells[2].Text;
|
|
nomePB = dgItem.Cells[3].Text;
|
|
codiceFiscale = dgItem.Cells[4].Text;
|
|
cognomeCliente = dgItem.Cells[5].Text;
|
|
nomeCliente = dgItem.Cells[6].Text;
|
|
tipoReport = dgItem.Cells[7].Text;
|
|
//metto le informazione in sessione
|
|
|
|
|
|
List<Parametro> parametri = new List<Parametro>();
|
|
Parametro cofdiceFiscale = new Parametro();
|
|
cofdiceFiscale.ParameterName = "codicefiscale";
|
|
cofdiceFiscale.DbType = DbType.String;
|
|
cofdiceFiscale.Value = GetValueParameter(codiceFiscale);
|
|
parametri.Add(cofdiceFiscale);
|
|
|
|
Parametro _rete = new Parametro();
|
|
_rete.ParameterName = "Rete";
|
|
_rete.DbType = DbType.String;
|
|
_rete.Value = GetValueParameter(DDRete.SelectedValue);
|
|
parametri.Add(_rete);
|
|
|
|
Parametro pb = new Parametro();
|
|
pb.ParameterName = "codicePB";
|
|
pb.DbType = DbType.String;
|
|
pb.Value = GetValueParameter(codicePB);
|
|
parametri.Add(pb);
|
|
|
|
DataTable queryCodiceContratto = DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServerStampeC6, "C6Mart.getCodiceContratto", parametri);
|
|
// Server.Transfer("../frames.aspx");
|
|
string contr = "";
|
|
if (queryCodiceContratto.Rows.Count > 0)
|
|
contr = queryCodiceContratto.Rows[0]["codiceContratto"].ToString();
|
|
GetUtenteAutorizzato.setDatiHDUS(rete, codicePB, cognomePB, nomePB, codiceFiscale, cognomeCliente, nomeCliente, tipoReport, contr);
|
|
|
|
|
|
string logo = "";
|
|
if (rete == "S")
|
|
logo = "Images/logoSeiNEWspi.gif";
|
|
else
|
|
logo = "Images/logoBancaFideuram.gif";
|
|
//V Modifica in quanto se c'era un cognome accentato non entrava in archiviodocumenti in quanto andava in errore il js
|
|
char Apostrofo = '\'';
|
|
if (nomeCliente.Contains(Apostrofo.ToString()))
|
|
{
|
|
int posizione = nomeCliente.IndexOf(Apostrofo);
|
|
string parteAnteriore = nomeCliente.Substring(0, posizione);
|
|
string partePosteriore = nomeCliente.Substring(posizione + 1);
|
|
|
|
parteAnteriore += "\\'";
|
|
nomeCliente = parteAnteriore + partePosteriore;
|
|
}
|
|
|
|
|
|
string[] temp = cognomeCliente.Split(' ');
|
|
cognomeCliente = string.Empty;
|
|
|
|
foreach (string cog in temp)
|
|
if (cog.Contains(Apostrofo.ToString()))
|
|
{
|
|
|
|
int posizione = cog.IndexOf(Apostrofo);
|
|
string parteAnteriore = cog.Substring(0, posizione);
|
|
string partePosteriore = cog.Substring(posizione + 1);
|
|
|
|
parteAnteriore += "\\'";
|
|
cognomeCliente += parteAnteriore + partePosteriore + " ";
|
|
}
|
|
else
|
|
cognomeCliente += cog + " ";
|
|
//End of foreach
|
|
cognomeCliente = cognomeCliente.Trim();
|
|
if (nomePB.Contains(Apostrofo.ToString()))
|
|
{
|
|
int posizione = nomePB.IndexOf(Apostrofo);
|
|
string parteAnteriore = nomePB.Substring(0, posizione);
|
|
string partePosteriore = nomePB.Substring(posizione + 1);
|
|
|
|
parteAnteriore += "\\'";
|
|
nomePB = parteAnteriore + partePosteriore;
|
|
}
|
|
|
|
if (cognomePB.Contains(Apostrofo.ToString()))
|
|
{
|
|
int posizione = cognomePB.IndexOf(Apostrofo);
|
|
string parteAnteriore = cognomePB.Substring(0, posizione);
|
|
string partePosteriore = cognomePB.Substring(posizione + 1);
|
|
|
|
parteAnteriore += "\\'";
|
|
cognomePB = parteAnteriore + partePosteriore;
|
|
}
|
|
|
|
//
|
|
string command = "ScriviInTop('" + nominativoUtente + "','" + nomePB + "','" + cognomePB + "','" + nomeCliente + "','" + cognomeCliente + "','" + codiceFiscale + "','" + logo + "');";
|
|
command += "window.location='ArchivioDocumenti.aspx';";
|
|
ClientScript.RegisterStartupScript(typeof(string), "pppppp", "<script language=\"javascript\" type=\"text/javascript\">" + "\n" + "<!--" + "\n" + command + "\n" + "//-->" + "\n" + "</script>");
|
|
//Response.Redirect("../ArchivioDocumenti.aspx");
|
|
}
|
|
protected void dg_ItemDataBound(object sender, DataGridItemEventArgs e)
|
|
{
|
|
|
|
|
|
|
|
if (!confermaPushed && (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item))
|
|
{
|
|
LinkButton lb;
|
|
|
|
for (int i = 0; i < dg.Columns.Count; ++i)
|
|
{
|
|
if (e.Item.Cells[i].Controls.Count == 1)
|
|
{
|
|
lb = (LinkButton)e.Item.Cells[i].Controls[0];
|
|
if (lb is LinkButton)
|
|
lb.CssClass = "noLinkUnderline";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|