394 lines
15 KiB
C#
394 lines
15 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Configuration;
|
|
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.Collections;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using System.Collections.Generic;
|
|
using PDFGenerator.BusinessLayer;
|
|
using DataAccessLayer;
|
|
|
|
namespace PDFGenerator.BusinessLayer.DataSection
|
|
{
|
|
public class DSFD76PatrimonioNonRappresentabileAssettClass : IDataSection
|
|
{
|
|
private ArrayList _parametriFiltro;
|
|
private bool _Filtra;
|
|
private bool HasColumnCtvNonCoperto;
|
|
private bool _flagS86;
|
|
private bool _flagS86BIS;
|
|
|
|
/// <summary>
|
|
/// Indica se è stato flaggato sull'albero la sezione S86
|
|
/// </summary>
|
|
public bool FlagS86
|
|
{
|
|
get { return _flagS86; }
|
|
set { _flagS86 = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Indica se è stato flaggato sull'albero la sezione S86BIS
|
|
/// </summary>
|
|
public bool FlagS86BIS
|
|
{
|
|
get { return _flagS86BIS; }
|
|
set { _flagS86BIS = value; }
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Costruttore
|
|
/// </summary>
|
|
public DSFD76PatrimonioNonRappresentabileAssettClass()
|
|
{
|
|
_parametriFiltro = new ArrayList();
|
|
_Filtra = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Costruttore
|
|
/// </summary>
|
|
/// <param name="modalitavisualizzazione"></param>
|
|
public DSFD76PatrimonioNonRappresentabileAssettClass(EmodalitaRappresentazione modalitavisualizzazione)
|
|
{
|
|
_modalitaRappresentazione = modalitavisualizzazione;
|
|
_parametriFiltro = new ArrayList();
|
|
_Filtra = false;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Modalità di visualizzazione:
|
|
/// La modalità normale mostra la colonna Intermediario(S76 in modalità normale),
|
|
/// La modalità alternativa mostra la colonna AreaProgetto(S76 in modalità alternativa).
|
|
/// Se non specificato di default viene impostata la modalità normale.
|
|
/// </summary>
|
|
public enum EmodalitaRappresentazione
|
|
{
|
|
normale,
|
|
alternativa
|
|
}
|
|
|
|
private EmodalitaRappresentazione _modalitaRappresentazione = EmodalitaRappresentazione.normale;
|
|
|
|
|
|
/// <summary>
|
|
/// Modalità di visualizzazione:
|
|
/// La modalità normale mostra la colonna Intermediario(S76 in modalità normale),
|
|
/// La modalità alternativa mostra la colonna AreaProgetto(S76 in modalità alternativa).
|
|
/// Se non specificato di default viene impostata la modalità normale.
|
|
/// </summary>
|
|
public EmodalitaRappresentazione modalitaRappresentazione
|
|
{
|
|
get { return _modalitaRappresentazione; }
|
|
set { _modalitaRappresentazione = value; }
|
|
}
|
|
|
|
|
|
public DataSectionResult getDataSection(List<SessionStruct> tabelleSessione, string querySql, DataThread dataThread)
|
|
{
|
|
DataSectionResult dsr = new DataSectionResult();
|
|
|
|
DataTable dt;
|
|
if (_modalitaRappresentazione == EmodalitaRappresentazione.normale)
|
|
{
|
|
dt = SectionManager.GetDataSection(tabelleSessione, querySql, dataThread);
|
|
}
|
|
else
|
|
{
|
|
dt = SectionManager.GetDataSection(tabelleSessione, querySql, dataThread);
|
|
if (_Filtra)
|
|
{
|
|
if (_parametriFiltro.Count > 0)
|
|
{
|
|
string parametriFiltro = "need_area in(";
|
|
for (int i = 0; i < _parametriFiltro.Count; i++)
|
|
{
|
|
parametriFiltro += "'" + _parametriFiltro[i].ToString() + "',";
|
|
}
|
|
|
|
parametriFiltro = parametriFiltro.Remove(parametriFiltro.Length - 1);
|
|
parametriFiltro += ")";
|
|
|
|
DataView dtFiltrata = new DataView(dt);
|
|
dtFiltrata.RowFilter = parametriFiltro;
|
|
dt = dtFiltrata.ToTable();
|
|
}
|
|
else
|
|
{
|
|
dt.Rows.Clear();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
DataRow dr;
|
|
Decimal ctvTotale = 0;
|
|
Decimal ctvTotaleNonCoperto = 0;
|
|
DataSetS76 ds76 = new DataSetS76();
|
|
|
|
List<PatrimonioNonRappresentabileAssettClass> _listaPNRAC = new List<PatrimonioNonRappresentabileAssettClass>();
|
|
|
|
ds76.ContoCorrente.Columns.Add(new DataColumn("Tipo_Prodotto", System.Type.GetType("System.String")));
|
|
|
|
foreach (DataRow r in dt.Rows)
|
|
{
|
|
// attraverso il metodo ClsFunzioniGeneriche recupero la data del contartto
|
|
|
|
dr = ds76.ContoCorrente.NewRow();
|
|
|
|
dr["Contratto"] = r["Contratto"];
|
|
dr["Tipo_Prodotto"] = r["Tipo_Prodotto"];
|
|
dr["Descrizione"] = r["Descrizione"];
|
|
dr["isAPC"] = r["isAPC"];
|
|
// SavingMap New
|
|
dr["<IMAGE>"] = string.Empty;
|
|
if (dr["Contratto"].ToString().IndexOf("VP") > 0 && dr["Tipo_Prodotto"].ToString().Trim() == "CC")
|
|
dr["<IMAGE>"] = WebConfigParameter.getParameter("SavingMap");
|
|
else
|
|
{
|
|
if (dr["Contratto"].ToString().IndexOf("FO") > 0)
|
|
{
|
|
if (isSavingMap(dataThread.Rete, dataThread.CodiceFiscale.Trim(), dr["Contratto"].ToString().Trim(), dataThread.Periodico))
|
|
dr["<IMAGE>"] = WebConfigParameter.getParameter("SavingMap");
|
|
}
|
|
}
|
|
// End SavingMap
|
|
if (dr["isAPC"].ToString() == "S")
|
|
{
|
|
dr["<IMAGE>"] = WebConfigParameter.getParameter("APC103");
|
|
dataThread.IsAPC103 = true;
|
|
}
|
|
switch (_modalitaRappresentazione)
|
|
{
|
|
case EmodalitaRappresentazione.normale:
|
|
dr["Intermediario"] = r["Intermediario"];
|
|
break;
|
|
|
|
case EmodalitaRappresentazione.alternativa:
|
|
dr["AreaProgetto"] = r["Area"].ToString();
|
|
//V se il progetto è progetto investimento non deve apparire la riga / progetto
|
|
string progetto = r["Progetto"].ToString();
|
|
if (r["Area"].ToString().ToUpper() == "INVESTIMENTO")
|
|
if (progetto != "Progetto investimento")
|
|
dr["AreaProgetto"] += " / " + progetto;
|
|
//
|
|
break;
|
|
}
|
|
dr["ControvaloreNonCoperto"] = r["Controvalore"];
|
|
|
|
dr["Controvalore"] = r["controvalore_contratto"];
|
|
dr["DataSottoscrizione"] = r["DataSottoscrizione"];
|
|
|
|
|
|
#region Getstione controvalore non coperto
|
|
decimal ctv = 0;
|
|
decimal ctvContratto = 0;
|
|
|
|
if (r["Controvalore"] != DBNull.Value)
|
|
ctv = Convert.ToDecimal(r["Controvalore"]);
|
|
|
|
if (r["controvalore_contratto"] != DBNull.Value)
|
|
ctvContratto = Convert.ToDecimal(r["controvalore_contratto"]);
|
|
|
|
|
|
if (ctv != ctvContratto)
|
|
HasColumnCtvNonCoperto = true;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
ds76.ContoCorrente.Rows.Add(dr);
|
|
ctvTotale += (Decimal)r["controvalore_contratto"];
|
|
ctvTotaleNonCoperto += (Decimal)r["Controvalore"];
|
|
}
|
|
|
|
/*** Fix per escludere il DataSet Tipizzato solo per la tabella ContoCorrente - 03/02/2023 - Pino ***/
|
|
//foreach (DataRow r in dt.Rows)
|
|
//{
|
|
// // attraverso il metodo ClsFunzioniGeneriche recupero la data del contartto
|
|
// PatrimonioNonRappresentabileAssettClass _clsPNRAC = new PatrimonioNonRappresentabileAssettClass();
|
|
|
|
// _clsPNRAC.Contratto = r["Contratto"].ToString();
|
|
// _clsPNRAC.Tipo_Prodotto = r["Tipo_Prodotto"].ToString();
|
|
// _clsPNRAC.Descrizione = r["Descrizione"].ToString();
|
|
// _clsPNRAC.isAPC = r["isAPC"].ToString();
|
|
|
|
// // SavingMap New
|
|
// _clsPNRAC.Image = string.Empty;
|
|
|
|
// if (_clsPNRAC.Contratto.IndexOf("VP") > 0 && _clsPNRAC.Tipo_Prodotto.Trim() == "CC")
|
|
// _clsPNRAC.Image = WebConfigParameter.getParameter("SavingMap");
|
|
// else
|
|
// {
|
|
// if (_clsPNRAC.Contratto.IndexOf("FO") > 0)
|
|
// {
|
|
// if (isSavingMap(dataThread.Rete, dataThread.CodiceFiscale.Trim(), _clsPNRAC.Contratto.Trim(), dataThread.Periodico))
|
|
// _clsPNRAC.Image = WebConfigParameter.getParameter("SavingMap");
|
|
// }
|
|
// }
|
|
// // End SavingMap
|
|
|
|
// if (_clsPNRAC.isAPC == "S")
|
|
// {
|
|
// _clsPNRAC.Image = WebConfigParameter.getParameter("APC103");
|
|
// dataThread.IsAPC103 = true;
|
|
// }
|
|
|
|
// switch (_modalitaRappresentazione)
|
|
// {
|
|
// case EmodalitaRappresentazione.normale:
|
|
// _clsPNRAC.Intermediario = r["Intermediario"].ToString();
|
|
// break;
|
|
|
|
// case EmodalitaRappresentazione.alternativa:
|
|
// _clsPNRAC.AreaProgetto = r["Area"].ToString();
|
|
// //V se il progetto è progetto investimento non deve apparire la riga / progetto
|
|
// string progetto = r["Progetto"].ToString();
|
|
// if (r["Area"].ToString().ToUpper() == "INVESTIMENTO")
|
|
// if (progetto != "Progetto investimento")
|
|
// _clsPNRAC.AreaProgetto += " / " + progetto;
|
|
// //
|
|
// break;
|
|
// }
|
|
|
|
// _clsPNRAC.ControvaloreNonCoperto = r["Controvalore"].ToString();
|
|
|
|
// _clsPNRAC.Controvalore = r["controvalore_contratto"].ToString();
|
|
// _clsPNRAC.DataSottoscrizione = r["DataSottoscrizione"].ToString();
|
|
|
|
// #region Getstione controvalore non coperto
|
|
// decimal ctv = 0;
|
|
// decimal ctvContratto = 0;
|
|
|
|
// if (r["Controvalore"] != DBNull.Value)
|
|
// ctv = Convert.ToDecimal(r["Controvalore"]);
|
|
|
|
// if (r["controvalore_contratto"] != DBNull.Value)
|
|
// ctvContratto = Convert.ToDecimal(r["controvalore_contratto"]);
|
|
|
|
|
|
// if (ctv != ctvContratto)
|
|
// HasColumnCtvNonCoperto = true;
|
|
|
|
// #endregion
|
|
|
|
|
|
// _listaPNRAC.Add(_clsPNRAC);
|
|
// ctvTotale += (Decimal)r["controvalore_contratto"];
|
|
// ctvTotaleNonCoperto += (Decimal)r["Controvalore"];
|
|
//}
|
|
//// Converto la lista in un datatable
|
|
//DataTable _dt = UtilityBusinessLayer.ToDataTable<PatrimonioNonRappresentabileAssettClass>(_listaPNRAC);
|
|
//_dt.TableName = "ContoCorrente";
|
|
//ds76.Tables.Add(_dt);
|
|
/************************************************************************************************************/
|
|
|
|
|
|
DataRow drTot = ds76.TotaleConti.NewRow();
|
|
drTot["Descrizione"] = "Totale Patrimonio non rappresentabile".ToUpper();
|
|
drTot["Valore"] = ctvTotale;
|
|
drTot["ValoreNonCoperto"] = ctvTotaleNonCoperto;
|
|
ds76.TotaleConti.Rows.Add(drTot);
|
|
|
|
// Aggiungo l'informazione per la parte grafica
|
|
if (ds76.ContoCorrente.ExtendedProperties.Contains("HasColumnCtvNonCoperto"))
|
|
ds76.ContoCorrente.ExtendedProperties["HasColumnCtvNonCoperto"] = HasColumnCtvNonCoperto;
|
|
else
|
|
ds76.ContoCorrente.ExtendedProperties.Add("HasColumnCtvNonCoperto", HasColumnCtvNonCoperto);
|
|
|
|
|
|
//Patrimonio non rappresentabile per asset class-
|
|
//se presente patrimonio non rappresentabile ed è stata selezionata solo la vista a livello di portafoglio complessivo,
|
|
//nella tabella non deve essere riportata la colonna Area/progetto
|
|
if (_flagS86 == false && _flagS86BIS == false)
|
|
ds76.ContoCorrente.AreaProgettoColumn.ExtendedProperties.Add("ToRemove", true);
|
|
|
|
dsr.DatiSezione = ds76;
|
|
dsr.Esito = ds76.ContoCorrente.Rows.Count;
|
|
|
|
return dsr;
|
|
|
|
}
|
|
|
|
public ArrayList ParametriFiltro
|
|
{
|
|
set
|
|
{
|
|
_Filtra = true;
|
|
_parametriFiltro = value;
|
|
}
|
|
}
|
|
public bool isSavingMap(string pRete, string pCodFis, string pContratto, bool pPeriodico)
|
|
{
|
|
//dataThread.Rete, dataThread.CodiceFiscale, dr.Contratto, dr.Tipo_Prodotto, dataThread.Periodico
|
|
var parametri = new List<Parametro>
|
|
{
|
|
new Parametro
|
|
{
|
|
Direction = ParameterDirection.Input,
|
|
DbType = DbType.String,
|
|
ParameterName = "Rete",
|
|
Value = pRete
|
|
},
|
|
new Parametro
|
|
{
|
|
Direction = ParameterDirection.Input,
|
|
DbType = DbType.String,
|
|
ParameterName = "CodFis",
|
|
Value = pCodFis
|
|
},
|
|
new Parametro
|
|
{
|
|
Direction = ParameterDirection.Input,
|
|
DbType = DbType.String,
|
|
ParameterName = "CodConf",
|
|
Value = pContratto
|
|
}
|
|
};
|
|
string sSql = "";
|
|
|
|
if (pPeriodico)
|
|
sSql = "[C6MartPeriodico].[PL_SavingMap]";
|
|
else
|
|
sSql = "[C6Mart].[PL_SavingMap]";
|
|
|
|
DataAccessDE dataAccess = new DataAccessDE(DBProvider.SqlServerStampeC6);
|
|
DataTable dt = dataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServerStampeC6, sSql, parametri);
|
|
|
|
if ((dt == null) || (dt.Rows.Count == 0))
|
|
return false;
|
|
else
|
|
{
|
|
if ((dt.Rows[0][0].ToString() == "0"))
|
|
return false;
|
|
else
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
public class PatrimonioNonRappresentabileAssettClass
|
|
{
|
|
public string DataSottoscrizione { get; set; }
|
|
public string Contratto { get; set; }
|
|
public string Descrizione { get; set; }
|
|
public string isAPC { get; set; }
|
|
public string Image { get; set; }
|
|
public string Intermediario { get; set; }
|
|
public string AreaProgetto { get; set; }
|
|
public string Controvalore { get; set; }
|
|
public string ControvaloreNonCoperto { get; set; }
|
|
public string Tipo_Prodotto { get; set; }
|
|
|
|
}
|
|
}
|