commit 57fc26d4eb304715cb05d76d82833d97c2c5b1bc Author: SmartRootsSrl Date: Fri Mar 27 11:54:38 2026 +0100 Initial commit: ASP.NET Web Forms intranet project Co-Authored-By: Claude Sonnet 4.6 diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..b803573 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,9 @@ +{ + "permissions": { + "allow": [ + "mcp__plugin_context-mode_context-mode__ctx_batch_execute", + "mcp__plugin_context-mode_context-mode__ctx_execute_file", + "mcp__plugin_context-mode_context-mode__ctx_search" + ] + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1a32b02 --- /dev/null +++ b/.gitignore @@ -0,0 +1,54 @@ +# SVN - keep SVN working copy metadata out of git +.svn/ + +# Visual Studio +.vs/ +*.user +*.suo +*.userosscache +*.sln.docstates + +# Build output +[Dd]ebug/ +[Rr]elease/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# NuGet +packages/ +*.nupkg +*.snupkg +project.lock.json +project.fragment.lock.json +artifacts/ +!**/[Pp]ackages/build/ + +# Publish profiles output +PublishOutput/ +publish/ + +# ASP.NET +App_Data/ +*.pubxml.user + +# Rider +.idea/ + +# Windows +Thumbs.db +Desktop.ini +$RECYCLE.BIN/ + +# Temp files +*.tmp +*.temp +*.bak +*.cache +~$* diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..2e2157e --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,49 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Build & Run + +This is an **ASP.NET Web Forms** project targeting **.NET Framework 4.7.2**. Build and run via Visual Studio 2022: + +- **Build:** `msbuild OlympiaIntranet.sln` or use VS Build menu +- **Run:** F5 in Visual Studio (IIS Express, port defined in `launchSettings`) +- **Publish:** Use publish profiles in `Properties/PublishProfiles/` — separate profiles for TEST and PROD environments + +There are no automated tests in this solution. + +## Architecture + +### Project Type +ASP.NET Web Forms (not MVC/Blazor). Each page is an `.aspx` file with a paired `.aspx.cs` code-behind. The solution is a single project (`OlympiaIntranet.csproj`). + +### Authentication +OWIN cookie-based auth configured in `App_Start/Startup.cs` via `Microsoft.AspNet.Identity`. Login page is `SignIn.aspx`. Forms auth timeout is 240 minutes. Cookie domain is configurable via `AppSettings["CookieDomain"]` in `Web.config`. + +### Data Access +Two patterns coexist: +- **LINQ to SQL** via `DataClasses1DataContext` — primary ORM, maps to `FirstSolutionDB`. Context and entity definitions live in `DataClasses1.designer.cs`. +- **Raw ADO.NET** — `SqlConnection`/`SqlCommand`/`SqlDataAdapter`/`SqlBulkCopy` used directly in many pages. +- **MySQL** access via `MySqlConnector` (namespace `MySqlConnector`) for specific data sources. +- Entity Framework 6.4.4 is installed but minimally used. + +Connection string is stored in `Properties.Settings.Default.SqlConnection`. + +### Shared Utilities +`CommonClass` (in the root namespace) holds shared data access helpers, bulk copy operations, and common query execution methods. Check here before duplicating data access logic. + +### Key Dependencies +- **DevExpress v23.2** — UI controls (grids, charts); configured in `Web.config` under `devExpress` section +- **ClosedXML** — Excel export +- **PDFsharp** — PDF generation +- **Newtonsoft.Json** — JSON serialization +- **LumenWorks CSV reader** — CSV parsing + +### Page Organization +43 ASPX pages covering: +- Financial dashboards: `DashboardControlli`, `MonitorVaR`, `Mifir`, `Margini` +- Fund management: `Fondi`, `ElencoTitoli`, `EsposizioneTitoli`, `RankingFondi` +- Portfolio/Asset: `GPMAssetAllocation`, `GPMDispRendRisk`, `Reconciliator` +- Reports: `ReportAllFunds`, `ReportPortfoglioApi` + +Static assets (CSS, JS, fonts, images) are in their respective top-level folders. Third-party frontend libraries are under `vendor/`. diff --git a/OlympiaIntranet.sln b/OlympiaIntranet.sln new file mode 100644 index 0000000..8a45a1f --- /dev/null +++ b/OlympiaIntranet.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.34928.147 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OlympiaIntranet", "OlympiaIntranet\OlympiaIntranet.csproj", "{343269B8-30DD-430E-8A63-B55DC1209097}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {343269B8-30DD-430E-8A63-B55DC1209097}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {343269B8-30DD-430E-8A63-B55DC1209097}.Debug|Any CPU.Build.0 = Debug|Any CPU + {343269B8-30DD-430E-8A63-B55DC1209097}.Release|Any CPU.ActiveCfg = Release|Any CPU + {343269B8-30DD-430E-8A63-B55DC1209097}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4F2D9DA5-5059-46B4-A491-530EBBD68707} + VisualSVNWorkingCopyRoot = . + EndGlobalSection +EndGlobal diff --git a/OlympiaIntranet/AUM.aspx b/OlympiaIntranet/AUM.aspx new file mode 100644 index 0000000..58e7def --- /dev/null +++ b/OlympiaIntranet/AUM.aspx @@ -0,0 +1,437 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AUM.aspx.cs" Inherits="OlympiaIntranet.AUMPage" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data.Linq" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + +
+ <%--
+ Responsive image +
+
--%> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ +<%-- + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
--%> + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/OlympiaIntranet/AUM.aspx.cs b/OlympiaIntranet/AUM.aspx.cs new file mode 100644 index 0000000..c573982 --- /dev/null +++ b/OlympiaIntranet/AUM.aspx.cs @@ -0,0 +1,603 @@ +using DevExpress.Export; +using DevExpress.Spreadsheet; +using DevExpress.SpreadsheetSource.Implementation; +using DevExpress.Web; +using DevExpress.XtraEditors; +using DevExpress.XtraPrinting; +using DevExpress.XtraPrintingLinks; +using MySqlConnector; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class AUMPage : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + } + + protected void ASPxRibbon1_CommandExecuted(object source, DevExpress.Web.RibbonCommandExecutedEventArgs e) + { + // Selezionato pulsante Refresh + if (e.Item.Name == "loadGrid") + { + RibbonTemplateItem template = (RibbonTemplateItem)ASPxRibbon1.Tabs[0].Groups[0].Items.FindByName("ribbonTemplate"); + ASPxDateEdit deDataInizio = template.FindControl("dataInizio") as ASPxDateEdit; + if (String.IsNullOrEmpty(deDataInizio.Text)) + { + CommonClass.MessageBox(this, "Inserire data inizio!"); + return; + } + + ASPxDateEdit deDataFine = template.FindControl("dataFine") as ASPxDateEdit; + if (String.IsNullOrEmpty(deDataFine.Text)) + { + CommonClass.MessageBox(this, "Inserire data fine!"); + return; + } + + // recupero il valore del ribbondateedit dataInizio + //DateTime dataInizio = Convert.ToDateTime(ribDataInizio.Value); + Session["data_inizio"] = deDataInizio.Date; + + // recupero il valore del ribbondateedit dataFine + //DateTime dataFine = Convert.ToDateTime(ribDataFine.Value); + Session["data_fine"] = deDataFine.Date; + + + // Verifica che dataInizio sia minore di dataFine + if (deDataInizio.Date > deDataFine.Date) + { + CommonClass.MessageBox(this, "Data inizio deve essere minore di Data fine!"); + return; + } + + // Se i controlli sono passati allora linka datasource a grdiview... + //gvGestioniPatrimoniali.DataSourceID = "SqlDSGestioniPatrimoniali"; + //gvGestioniPatrimoniali.KeyFieldName = "PORTAFOGLIO"; + //gvGestioniPatrimoniali.DataBind(); + + gvGPMConsuntivo.DataSourceID = "SqlDSGPMConsuntivo"; + gvGPMConsuntivo.KeyFieldName = "PORTAFOGLIO"; + gvGPMConsuntivo.DataBind(); + + gvGPMForecast.DataSourceID = "SqlDSGPMForecast"; + gvGPMForecast.KeyFieldName = "PORTAFOGLIO"; + gvGPMForecast.DataBind(); + + gvFondi.DataSourceID = "SqlDSFondi"; + gvFondi.DataBind(); + + gvDettaglioFondi.DataSourceID = "SqlDSDettaglioFondi"; + gvDettaglioFondi.DataBind(); + + } + // Selezionato pulsante Export in Excel + if (e.Item.Name == "exportExcel") + { + // Ref link: https://www.devexpress.com/Support/Center/Question/Details/T327338/aspxgridview-export-multiple-grids-to-the-same-excel-file + PrintingSystem ps = new PrintingSystem(); + + // Esporta griglia GPMForecast + PrintableComponentLink link0 = new PrintableComponentLink(ps); + ExporterGPMForecast.ExportSelectedRowsOnly = false; + string reportHeader0 = string.Format(@"Estrazione GPM Forecast dal {0} al {1} \par Tot. AUM Iniziale: {2:n2} \par Tot. AUM Finale: {3:n2} \par", Convert.ToDateTime(Session["data_inizio"]).ToString("dd/MM/yyyy"), Convert.ToDateTime(Session["data_fine"]).ToString("dd/MM/yyyy"), Convert.ToDouble(tbTotAumInizialePtf_GPMForecast.Text), Convert.ToDouble(tbTotAumFinalePtf_GPMForecast.Text)); + ExporterGPMForecast.ReportHeader = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl{\f0\fnil\fcharset0 Tahoma;}{\f1\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\b\f0\fs28 " + reportHeader0 + @"\b0\f1\fs20\par}"; + link0.Component = ExporterGPMForecast; + + // Esporta griglia GPMConsuntivo + PrintableComponentLink link1 = new PrintableComponentLink(ps); + ExporterGPMConsuntivo.ExportSelectedRowsOnly = false; + string reportHeader1 = string.Format(@"Estrazione GPM Consuntivo dal {0} al {1} \par Tot. AUM Iniziale: {2:n2} \par Tot. AUM Finale: {3:n2} \par", Convert.ToDateTime(Session["data_inizio"]).ToString("dd/MM/yyyy"), Convert.ToDateTime(Session["data_fine"]).ToString("dd/MM/yyyy"), Convert.ToDouble(tbTotAumInizialePtf_GPMConsuntivo.Text), Convert.ToDouble(tbTotAumFinalePtf_GPMConsuntivo.Text)); + ExporterGPMConsuntivo.ReportHeader = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl{\f0\fnil\fcharset0 Tahoma;}{\f1\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\b\f0\fs28 " + reportHeader1 + @"\b0\f1\fs20\par}"; + link1.Component = ExporterGPMConsuntivo; + + // Esporta griglia Fondi + PrintableComponentLink link2 = new PrintableComponentLink(ps); + ExporterFondi.ExportSelectedRowsOnly = false; + string reportHeader2 = string.Format(@"Estrazione Fondi dal {0} al {1} \par Tot. AUM Iniziale: {2:n2} \par Tot. AUM Finale: {3:n2} \par Delta: {4:n2} \par Raccolta Netta: {5:n2} \par", + Convert.ToDateTime(Session["data_inizio"]).ToString("dd/MM/yyyy"), + Convert.ToDateTime(Session["data_fine"]).ToString("dd/MM/yyyy"), + Convert.ToDouble(tbTotAumInizialeFondi.Text), + Convert.ToDouble(tbTotAumFinaleFondi.Text), + Convert.ToDouble(tbDelta.Text), + Convert.ToDouble(tbRaccoltaNetta.Text) + ); + ExporterFondi.ReportHeader = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl{\f0\fnil\fcharset0 Tahoma;}{\f1\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\b\f0\fs28 " + reportHeader2 + @"\b0\f1\fs20\par}"; + link2.Component = ExporterFondi; + + // Esporta griglia Dettaglio Fondi + PrintableComponentLink link3 = new PrintableComponentLink(ps); + ExporterDettaglioFondi.ExportSelectedRowsOnly = false; + link3.Component = ExporterDettaglioFondi; + + CompositeLink compositeLink = new CompositeLink(ps); + compositeLink.Links.AddRange(new object[] { link0, link1, link2, link3 }); + compositeLink.CreatePageForEachLink(); + + string fileName = string.Format("{0}_{1}", DateTime.Now.ToString("yyyyMMdd_HHmm"), "AUM.xlsx"); + using (MemoryStream stream = new MemoryStream()) + { + XlsxExportOptionsEx options = new XlsxExportOptionsEx(); + options.ExportMode = XlsxExportMode.SingleFilePageByPage; + options.ExportType = ExportType.WYSIWYG; + compositeLink.PrintingSystemBase.ExportToXlsx(stream, options); + Response.Clear(); + Response.Buffer = false; + Response.AppendHeader("Content-Type", "application/xlsx"); + Response.AppendHeader("Content-Transfer-Encoding", "binary"); + Response.AppendHeader("Content-Disposition", $"attachment; filename={fileName}"); + stream.Position = 0; + + Workbook workbook = new Workbook(); + workbook.LoadDocument(stream,DevExpress.Spreadsheet.DocumentFormat.OpenXml); + DevExpress.Spreadsheet.WorksheetCollection worksheets = workbook.Worksheets; + workbook.Worksheets[0].Name = "GPM Forecast"; + workbook.Worksheets[1].Name = "GPM Consuntivo"; + workbook.Worksheets[2].Name = "Fondi"; + workbook.Worksheets[3].Name = "Dettaglio Fondi"; + using (MemoryStream outputStream = new MemoryStream()) + { + workbook.SaveDocument(outputStream, DevExpress.Spreadsheet.DocumentFormat.OpenXml); + Response.BinaryWrite(outputStream.ToArray()); + Response.End(); + } + } + ps.Dispose(); + } + } + + void WriteToResponse(string fileName, bool saveAsFile, string fileFormat, MemoryStream stream) + { + if (Page == null || Page.Response == null) + return; + + string disposition = saveAsFile ? "attachment" : "inline"; + Page.Response.Clear(); + Page.Response.Buffer = false; + Page.Response.AppendHeader("Content-Type", string.Format("application/{0}", fileFormat)); + Page.Response.AppendHeader("Content-Transfer-Encoding", "binary"); + Page.Response.AppendHeader("Content-Disposition", string.Format("{0}; filename={1}", disposition, fileName)); + Page.Response.BinaryWrite(stream.ToArray()); + Page.Response.End(); + } + + + #region DATABOUND + //protected void gvAnagraficaFondi_DataBound(object sender, EventArgs e) + //{ + // ASPxGridView gridview = sender as ASPxGridView; + // foreach (GridViewColumn column in gridview.Columns) + // { + // if (column is GridViewDataColumn) + // column.Caption = ((GridViewDataColumn)column).FieldName; + // } + //} + + protected void gvDettaglioFondi_DataBound(object sender, EventArgs e) + { + // ref : https://www.devexpress.com/Support/Center/Question/Details/Q585537/aspxgridview-autogeneratecolumns-true-field-name-start-with-lower-case-letter-insert-a + // Evita che a runtime le colonne con maiuscole nella query vengono scritte con lo spazio (ad esempio codiceIsin -> codice Isin) + // questo poi crea un problema andando a esportare l'excel dove serve che le colonne siano le stesse della query. + ASPxGridView gridview = sender as ASPxGridView; + foreach (GridViewColumn column in gridview.Columns) + { + if (column is GridViewDataColumn) + column.Caption = ((GridViewDataColumn)column).FieldName; + } + + // Effettua formattazione colonne a runtime.. + if (gridview.Columns.Count > 0) + { + foreach (GridViewDataColumn dataCol in gridview.DataColumns) + { + List listHeader = new List(); // Contiene tutte le colonne che non sono pivot dalla query + listHeader.Add("PORTAFOGLIO"); + listHeader.Add("TITOLO"); + listHeader.Add("NOME"); + listHeader.Add("DIVISA"); + listHeader.Add("DEPOSITARIA"); + listHeader.Add("GESTORE"); + listHeader.Add("CONSULENTE"); + listHeader.Add("ADVISOR"); + + bool IsColPivot = !listHeader.Any(s => dataCol.Caption.Contains(s)); // Se la colonna è pivot... + if (IsColPivot == true) dataCol.PropertiesEdit.DisplayFormatString = "N2"; // .. allora viene formattata con decimali e migliaia + } + } + } + + protected void gvGestioniPatrimoniali_DataBound(object sender, EventArgs e) + { + // ref : https://www.devexpress.com/Support/Center/Question/Details/Q585537/aspxgridview-autogeneratecolumns-true-field-name-start-with-lower-case-letter-insert-a + // Evita che a runtime le colonne con maiuscole nella query vengono scritte con lo spazio (ad esempio codiceIsin -> codice Isin) + // questo poi crea un problema andando a esportare l'excel dove serve che le colonne siano le stesse della query. + //ASPxGridView gridview = sender as ASPxGridView; + //foreach (GridViewColumn column in gridview.Columns) + //{ + // if (column is GridViewDataColumn) + // column.Caption = ((GridViewDataColumn)column).FieldName; + //} + + //// Effettua formattazione colonne a runtime.. + //if (gridview.Columns.Count > 0) + //{ + // gridview.DataColumns["DATA APERTURA"].PropertiesEdit.DisplayFormatString = "dd/MM/yyyy"; + // gridview.DataColumns["DATA CHIUSURA"].PropertiesEdit.DisplayFormatString = "dd/MM/yyyy"; + // gridview.DataColumns["AUM INIZIALE"].PropertiesEdit.DisplayFormatString = "N2"; + // gridview.DataColumns["AUM FINALE"].PropertiesEdit.DisplayFormatString = "N2"; + // gridview.DataColumns["AUM MEDIO"].PropertiesEdit.DisplayFormatString = "N2"; + // gridview.DataColumns["COMM DI GESTIONE"].PropertiesEdit.DisplayFormatString = "P2"; + // gridview.DataColumns["COMM PERFORMANCE"].PropertiesEdit.DisplayFormatString = "P2"; + + // // Calcola Totali AUM INIZIALE e AUM FINALE ma non li mostra nel footer + // gridview.TotalSummary.Clear(); + // gridview.Settings.ShowFooter = false; + // ASPxSummaryItem totPatrimonioPrec = new ASPxSummaryItem(); + // totPatrimonioPrec.FieldName = "AUM INIZIALE"; + // totPatrimonioPrec.SummaryType = DevExpress.Data.SummaryItemType.Sum; + // gridview.TotalSummary.Add(totPatrimonioPrec); + // tbTotAumInizialePtf_GPM.DisplayFormatString = "n2"; + // tbTotAumInizialePtf_GPM.Text = gridview.GetTotalSummaryValue(totPatrimonioPrec).ToString(); + + // ASPxSummaryItem totPatrimonioOggi = new ASPxSummaryItem(); + // totPatrimonioOggi.FieldName = "AUM FINALE"; + // totPatrimonioOggi.SummaryType = DevExpress.Data.SummaryItemType.Sum; + // gridview.TotalSummary.Add(totPatrimonioOggi); + // tbTotAumFinalePtf_GPM.DisplayFormatString = "n2"; + // tbTotAumFinalePtf_GPM.Text = gridview.GetTotalSummaryValue(totPatrimonioOggi).ToString(); + //} + } + + protected void gvFondi_DataBound(object sender, EventArgs e) + { + // ref : https://www.devexpress.com/Support/Center/Question/Details/Q585537/aspxgridview-autogeneratecolumns-true-field-name-start-with-lower-case-letter-insert-a + // Evita che a runtime le colonne con maiuscole nella query vengono scritte con lo spazio (ad esempio codiceIsin -> codice Isin) + // questo poi crea un problema andando a esportare l'excel dove serve che le colonne siano le stesse della query. + ASPxGridView gridview = sender as ASPxGridView; + foreach (GridViewColumn column in gridview.Columns) + { + if (column is GridViewDataColumn) + column.Caption = ((GridViewDataColumn)column).FieldName; + } + + // Effettua formattazione colonne a runtime.. + if (gridview.Columns.Count > 0) + { + gridview.DataColumns["AUM INIZIALE"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["AUM FINALE"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["SUBQUOTES"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["REDQUOTES"].PropertiesEdit.DisplayFormatString = "N2"; + + // Cancella totali e non li disabilita sulla griglia + gridview.TotalSummary.Clear(); + gridview.Settings.ShowFooter = false; + + // Calcolo Totale AUM Iniziale + ASPxSummaryItem totPatrimonioPrec = new ASPxSummaryItem(); + totPatrimonioPrec.FieldName = "AUM INIZIALE"; + totPatrimonioPrec.SummaryType = DevExpress.Data.SummaryItemType.Sum; + gridview.TotalSummary.Add(totPatrimonioPrec); + tbTotAumInizialeFondi.DisplayFormatString = "n2"; + tbTotAumInizialeFondi.Text = gridview.GetTotalSummaryValue(totPatrimonioPrec).ToString(); + + // Calcolo Totale AUM Finale + ASPxSummaryItem totPatrimonioOggi = new ASPxSummaryItem(); + totPatrimonioOggi.FieldName = "AUM FINALE"; + totPatrimonioOggi.SummaryType = DevExpress.Data.SummaryItemType.Sum; + gridview.TotalSummary.Add(totPatrimonioOggi); + tbTotAumFinaleFondi.DisplayFormatString = "n2"; + tbTotAumFinaleFondi.Text = gridview.GetTotalSummaryValue(totPatrimonioOggi).ToString(); + + // Calcolo Delta + tbDelta.DisplayFormatString = "n2"; + //tbDelta.Text = (Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioPrec)) - Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioOggi))).ToString(); + tbDelta.Text = (Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioOggi)) - Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioPrec))).ToString(); + + // Calcolo Totale Subquotes (per calcolare Raccolta Netta) + ASPxSummaryItem totSubquotes = new ASPxSummaryItem(); + totSubquotes.FieldName = "SUBQUOTES"; + totSubquotes.SummaryType = DevExpress.Data.SummaryItemType.Sum; + gridview.TotalSummary.Add(totSubquotes); + + + // Calcolo Totale Redquotes (per calcolare Raccolta Netta) + ASPxSummaryItem totRedquotes = new ASPxSummaryItem(); + totRedquotes.FieldName = "REDQUOTES"; + totRedquotes.SummaryType = DevExpress.Data.SummaryItemType.Sum; + gridview.TotalSummary.Add(totRedquotes); + + // Calcolo Raccolta Netta + tbRaccoltaNetta.DisplayFormatString = "n2"; + tbRaccoltaNetta.Text = (Convert.ToDouble(gridview.GetTotalSummaryValue(totSubquotes)) + Convert.ToDouble(gridview.GetTotalSummaryValue(totRedquotes))).ToString(); + } + + } + + protected void gvGPMForecast_DataBound(object sender, EventArgs e) + { + // ref : https://www.devexpress.com/Support/Center/Question/Details/Q585537/aspxgridview-autogeneratecolumns-true-field-name-start-with-lower-case-letter-insert-a + // Evita che a runtime le colonne con maiuscole nella query vengono scritte con lo spazio (ad esempio codiceIsin -> codice Isin) + // questo poi crea un problema andando a esportare l'excel dove serve che le colonne siano le stesse della query. + ASPxGridView gridview = sender as ASPxGridView; + foreach (GridViewColumn column in gridview.Columns) + { + if (column is GridViewDataColumn) + column.Caption = ((GridViewDataColumn)column).FieldName; + } + + // Effettua formattazione colonne a runtime.. + if (gridview.Columns.Count > 0) + { + gridview.DataColumns["DATA APERTURA"].PropertiesEdit.DisplayFormatString = "dd/MM/yyyy"; + gridview.DataColumns["DATA CHIUSURA"].PropertiesEdit.DisplayFormatString = "dd/MM/yyyy"; + gridview.DataColumns["DATA FINE CALCOLO PERFORMANCE"].PropertiesEdit.DisplayFormatString = "dd/MM/yyyy"; + gridview.DataColumns["AUM INIZIALE"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["AUM FINALE"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["AUM MEDIO"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["COMM DI GESTIONE"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["COMM PERFORMANCE"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["RETRO GESTORE"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["RETRO ADVISOR"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["RETRO CONSULENTE"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["RETRO TOTALE"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["QUOTA IN ANNUA"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["QUOTA OUT ANNUA"].PropertiesEdit.DisplayFormatString = "N2"; + + // Calcola Totali AUM INIZIALE e AUM FINALE ma non li mostra nel footer + gridview.TotalSummary.Clear(); + gridview.Settings.ShowFooter = false; + ASPxSummaryItem totPatrimonioPrec = new ASPxSummaryItem(); + totPatrimonioPrec.FieldName = "AUM INIZIALE"; + totPatrimonioPrec.SummaryType = DevExpress.Data.SummaryItemType.Sum; + gridview.TotalSummary.Add(totPatrimonioPrec); + tbTotAumInizialePtf_GPMForecast.DisplayFormatString = "n2"; + tbTotAumInizialePtf_GPMForecast.Text = gridview.GetTotalSummaryValue(totPatrimonioPrec).ToString(); + + ASPxSummaryItem totPatrimonioOggi = new ASPxSummaryItem(); + totPatrimonioOggi.FieldName = "AUM FINALE"; + totPatrimonioOggi.SummaryType = DevExpress.Data.SummaryItemType.Sum; + gridview.TotalSummary.Add(totPatrimonioOggi); + tbTotAumFinalePtf_GPMForecast.DisplayFormatString = "n2"; + tbTotAumFinalePtf_GPMForecast.Text = gridview.GetTotalSummaryValue(totPatrimonioOggi).ToString(); + + // Calcola Totale Aum Finale per OLYMPIA (ITA) + decimal totAumFinaleITA = CalcolaSommaSocieta(gridview, "OLYMPIAITA"); + tbTotAumFinaleITA_GPMForecast.Text = $"{totAumFinaleITA:n2}"; + + // Calcola Totale Aum Finale per OLYMPIA (UK) + decimal totAumFinaleUK = CalcolaSommaSocieta(gridview, "OLYMPIA"); + tbTotAumFinaleUK_GPMForecast.Text = $"{totAumFinaleUK:n2}"; + + // Calcolo Delta + tbDelta_GPMForecast.DisplayFormatString = "n2"; + //tbDelta_GPMForecast.Text = (Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioPrec)) - Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioOggi))).ToString(); + tbDelta_GPMForecast.Text = (Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioOggi)) - Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioPrec))).ToString(); + + // Calcolo Totale CASHIN (per calcolare Raccolta Netta) + ASPxSummaryItem TotCashIN = CreaSummaryItem("CASH IN"); + gridview.TotalSummary.Add(TotCashIN); + double CashIN = Convert.ToDouble(gridview.GetTotalSummaryValue(TotCashIN)); + + // Calcolo Totale TRANSFERIN (per calcolare Raccolta Netta) + ASPxSummaryItem TotTransferIN = CreaSummaryItem("TRANSFER IN"); + gridview.TotalSummary.Add(TotTransferIN); + double TransferIN = Convert.ToDouble(gridview.GetTotalSummaryValue(TotTransferIN)); + + // Calcolo Totale WITHDRAWAL (per calcolare Raccolta Netta) + ASPxSummaryItem TotWithdrawal = CreaSummaryItem("WITHDRAWAL"); + gridview.TotalSummary.Add(TotWithdrawal); + double Withdrawal = Convert.ToDouble(gridview.GetTotalSummaryValue(TotWithdrawal)); + + // Calcolo Totale TRANSFEROUT (per calcolare Raccolta Netta) + ASPxSummaryItem TotTransferOUT = CreaSummaryItem("TRANSFER OUT"); + gridview.TotalSummary.Add(TotTransferOUT); + double TransferOUT = Convert.ToDouble(gridview.GetTotalSummaryValue(TotTransferOUT)); + + // Calcolo Raccolta Netta + tbRaccoltaNetta_GPMForecast.DisplayFormatString = "n2"; + tbRaccoltaNetta_GPMForecast.Text = $"{CashIN + TransferIN + Withdrawal + TransferOUT}"; + + // Carica Commissioni Performance in maturazione + //string query = CommonClass.ExecSql("GDN_CommissioniPerformanceEuro"); // Rileva testo query per poi eseguirla in db MySql + string CommPerformance = CommonClass.ExecSql("[os_GDN_ID568_A]"); + //DataTable dt = CommonClass.execQuery_Datatable_MySql(query, Properties.Settings.Default.mySqlConnection); + + tbCommPerfInMaturazione.DisplayFormatString = "n2"; + //tbCommPerfInMaturazione.Text = $"{dt.Rows[0][0].ToString()}"; + tbCommPerfInMaturazione.Text = $"{CommPerformance}"; + + } + } + + protected void gvGPMConsuntivo_DataBound(object sender, EventArgs e) + { + // ref : https://www.devexpress.com/Support/Center/Question/Details/Q585537/aspxgridview-autogeneratecolumns-true-field-name-start-with-lower-case-letter-insert-a + // Evita che a runtime le colonne con maiuscole nella query vengono scritte con lo spazio (ad esempio codiceIsin -> codice Isin) + // questo poi crea un problema andando a esportare l'excel dove serve che le colonne siano le stesse della query. + ASPxGridView gridview = sender as ASPxGridView; + foreach (GridViewColumn column in gridview.Columns) + { + if (column is GridViewDataColumn) + column.Caption = ((GridViewDataColumn)column).FieldName; + } + + // Effettua formattazione colonne a runtime.. + if (gridview.Columns.Count > 0) + { + gridview.DataColumns["DATA APERTURA"].PropertiesEdit.DisplayFormatString = "dd/MM/yyyy"; + gridview.DataColumns["DATA CHIUSURA"].PropertiesEdit.DisplayFormatString = "dd/MM/yyyy"; + gridview.DataColumns["DATA FINE CALCOLO PERFORMANCE"].PropertiesEdit.DisplayFormatString = "dd/MM/yyyy"; + gridview.DataColumns["AUM INIZIALE"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["AUM FINALE"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["AUM MEDIO TRIM PREC"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["COMM DI GESTIONE"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["COMM PERFORMANCE"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["RETRO GESTORE"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["RETRO ADVISOR"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["RETRO CONSULENTE"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["RETRO TOTALE"].PropertiesEdit.DisplayFormatString = "P2"; + gridview.DataColumns["QUOTA IN TRIM PREC"].PropertiesEdit.DisplayFormatString = "N2"; + gridview.DataColumns["QUOTA OUT TRIM PREC"].PropertiesEdit.DisplayFormatString = "N2"; + + // Calcola Totali AUM INIZIALE e AUM FINALE ma non li mostra nel footer + gridview.TotalSummary.Clear(); + gridview.Settings.ShowFooter = false; + ASPxSummaryItem totPatrimonioPrec = new ASPxSummaryItem(); + totPatrimonioPrec.FieldName = "AUM INIZIALE"; + totPatrimonioPrec.SummaryType = DevExpress.Data.SummaryItemType.Sum; + gridview.TotalSummary.Add(totPatrimonioPrec); + tbTotAumInizialePtf_GPMConsuntivo.DisplayFormatString = "n2"; + tbTotAumInizialePtf_GPMConsuntivo.Text = gridview.GetTotalSummaryValue(totPatrimonioPrec).ToString(); + + ASPxSummaryItem totPatrimonioOggi = new ASPxSummaryItem(); + totPatrimonioOggi.FieldName = "AUM FINALE"; + totPatrimonioOggi.SummaryType = DevExpress.Data.SummaryItemType.Sum; + gridview.TotalSummary.Add(totPatrimonioOggi); + tbTotAumFinalePtf_GPMConsuntivo.DisplayFormatString = "n2"; + tbTotAumFinalePtf_GPMConsuntivo.Text = gridview.GetTotalSummaryValue(totPatrimonioOggi).ToString(); + + // Calcola Totale Aum Finale per OLYMPIA (ITA) + decimal totAumFinaleITA = CalcolaSommaSocieta(gridview, "OLYMPIAITA"); + tbTotAumFinaleITA_GPMConsuntivo.Text = $"{totAumFinaleITA:n2}"; + + // Calcola Totale Aum Finale per OLYMPIA (UK) + decimal totAumFinaleUK = CalcolaSommaSocieta(gridview, "OLYMPIA"); + tbTotAumFinaleUK_GPMConsuntivo.Text = $"{totAumFinaleUK:n2}"; + + // Calcolo Delta + tbDelta_GPMConsuntivo.DisplayFormatString = "n2"; + //tbDelta_GPMConsuntivo.Text = (Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioPrec)) - Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioOggi))).ToString(); + tbDelta_GPMConsuntivo.Text = (Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioOggi)) - Convert.ToDouble(gridview.GetTotalSummaryValue(totPatrimonioPrec))).ToString(); + + + // Calcolo Totale CASHIN (per calcolare Raccolta Netta) + ASPxSummaryItem TotCashIN = CreaSummaryItem("CASH IN"); + gridview.TotalSummary.Add(TotCashIN); + double CashIN = Convert.ToDouble(gridview.GetTotalSummaryValue(TotCashIN)); + + // Calcolo Totale TRANSFERIN (per calcolare Raccolta Netta) + ASPxSummaryItem TotTransferIN = CreaSummaryItem("TRANSFER IN"); + gridview.TotalSummary.Add(TotTransferIN); + double TransferIN = Convert.ToDouble(gridview.GetTotalSummaryValue(TotTransferIN)); + + // Calcolo Totale WITHDRAWAL (per calcolare Raccolta Netta) + ASPxSummaryItem TotWithdrawal = CreaSummaryItem("WITHDRAWAL"); + gridview.TotalSummary.Add(TotWithdrawal); + double Withdrawal = Convert.ToDouble(gridview.GetTotalSummaryValue(TotWithdrawal)); + + // Calcolo Totale TRANSFEROUT (per calcolare Raccolta Netta) + ASPxSummaryItem TotTransferOUT = CreaSummaryItem("TRANSFER OUT"); + gridview.TotalSummary.Add(TotTransferOUT); + double TransferOUT = Convert.ToDouble(gridview.GetTotalSummaryValue(TotTransferOUT)); + + // Calcolo Raccolta Netta + tbRaccoltaNetta_GPMConsuntivo.DisplayFormatString = "n2"; + tbRaccoltaNetta_GPMConsuntivo.Text = $"{CashIN + TransferIN + Withdrawal + TransferOUT}"; + } + } + + private ASPxSummaryItem CreaSummaryItem(string FieldName) + { + ASPxSummaryItem summaryItem = new ASPxSummaryItem(); + summaryItem.FieldName = FieldName; + summaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; + return summaryItem; + } + + private decimal CalcolaSommaSocieta(ASPxGridView gridView, string Societa) + { + decimal sommaAum = 0; + + for (int i = 0; i < gridView.VisibleRowCount; i++) + { + object societaObj = gridView.GetRowValues(i, "SOCIETA"); + object aumFinaleObj = gridView.GetRowValues(i, "AUM FINALE"); + + if (societaObj != null && aumFinaleObj != null) + { + string societaGridView = societaObj.ToString(); + + if (societaGridView == Societa) + { + if (decimal.TryParse(aumFinaleObj.ToString(), out decimal aumFinale)) + { + sommaAum += aumFinale; + } + } + } + } + + return sommaAum; + + } + + #endregion + + #region SELECTING + protected void SqlDSGestioniPatrimoniali_Selecting(object sender, SqlDataSourceSelectingEventArgs e) + { + e.Command.CommandTimeout = 0; // disabilita timeout , aspetta finchè non finisce elaborazione + } + + protected void SqlDSFondi_Selecting(object sender, SqlDataSourceSelectingEventArgs e) + { + e.Command.CommandTimeout = 0; // disabilita timeout , aspetta finchè non finisce elaborazione + } + + protected void SqlDSDettaglioFondi_Selecting(object sender, SqlDataSourceSelectingEventArgs e) + { + e.Command.CommandTimeout = 0; // disabilita timeout , aspetta finchè non finisce elaborazione + } + + protected void SqlDSGPMConsuntivo_Selecting(object sender, SqlDataSourceSelectingEventArgs e) + { + e.Command.CommandTimeout = 0; // disabilita timeout , aspetta finchè non finisce elaborazione + } + + protected void SqlDSGPMForecast_Selecting(object sender, SqlDataSourceSelectingEventArgs e) + { + e.Command.CommandTimeout = 0; // disabilita timeout , aspetta finchè non finisce elaborazione + } + #endregion + + protected void ASPxRibbon1_Init(object sender, EventArgs e) + { + if (!IsPostBack) + { + // Trovo il Group "Filtri" + RibbonGroup gruppoFiltri = ASPxRibbon1.Tabs[0].Groups.FindByName("Filtri"); + + if (gruppoFiltri != null) + { + // Trovo il TemplateItem + RibbonTemplateItem template = gruppoFiltri.Items.FindByName("ribbonTemplate") as RibbonTemplateItem; + + if (template != null) + { + ASPxDateEdit dataInizio = template.FindControl("dataInizio") as ASPxDateEdit; + ASPxDateEdit dataFine = template.FindControl("dataFine") as ASPxDateEdit; + + if (dataInizio != null) + dataInizio.Date = new DateTime(DateTime.Now.Year, 1, 1); + + if (dataFine != null) + dataFine.Date = CommonClass.AddBusinessDays(DateTime.Today,-1); + } + } + } + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/AUM.aspx.designer.cs b/OlympiaIntranet/AUM.aspx.designer.cs new file mode 100644 index 0000000..abbcfe5 --- /dev/null +++ b/OlympiaIntranet/AUM.aspx.designer.cs @@ -0,0 +1,611 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class AUMPage + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxRibbon1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRibbon ASPxRibbon1; + + /// + /// pageControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPageControl pageControl; + + /// + /// ASPxLabel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel1; + + /// + /// tbTotAumInizialeFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotAumInizialeFondi; + + /// + /// ASPxPanel29 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel29; + + /// + /// ASPxLabel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel2; + + /// + /// tbTotAumFinaleFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotAumFinaleFondi; + + /// + /// ASPxPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel1; + + /// + /// ASPxLabel3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel3; + + /// + /// tbDelta control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbDelta; + + /// + /// ASPxPanel4 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel4; + + /// + /// ASPxLabel4 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel4; + + /// + /// tbRaccoltaNetta control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbRaccoltaNetta; + + /// + /// ASPxPanel5 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel5; + + /// + /// gvFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvFondi; + + /// + /// gvDettaglioFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvDettaglioFondi; + + /// + /// ASPxLabel5 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel5; + + /// + /// tbTotAumInizialePtf_GPMConsuntivo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotAumInizialePtf_GPMConsuntivo; + + /// + /// ASPxPanel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel2; + + /// + /// ASPxLabel6 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel6; + + /// + /// tbTotAumFinalePtf_GPMConsuntivo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotAumFinalePtf_GPMConsuntivo; + + /// + /// ASPxPanel13 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel13; + + /// + /// label2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel label2; + + /// + /// tbDelta_GPMConsuntivo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbDelta_GPMConsuntivo; + + /// + /// ASPxPanel14 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel14; + + /// + /// label1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel label1; + + /// + /// tbRaccoltaNetta_GPMConsuntivo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbRaccoltaNetta_GPMConsuntivo; + + /// + /// ASPxPanel6 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel6; + + /// + /// ASPxLabel9 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel9; + + /// + /// tbTotAumFinaleITA_GPMConsuntivo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotAumFinaleITA_GPMConsuntivo; + + /// + /// ASPxPanel7 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel7; + + /// + /// ASPxLabel10 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel10; + + /// + /// tbTotAumFinaleUK_GPMConsuntivo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotAumFinaleUK_GPMConsuntivo; + + /// + /// ASPxPanel11 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel11; + + /// + /// gvGPMConsuntivo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvGPMConsuntivo; + + /// + /// ASPxLabel7 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel7; + + /// + /// tbTotAumInizialePtf_GPMForecast control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotAumInizialePtf_GPMForecast; + + /// + /// ASPxPanel3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel3; + + /// + /// ASPxLabel8 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel8; + + /// + /// tbTotAumFinalePtf_GPMForecast control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotAumFinalePtf_GPMForecast; + + /// + /// ASPxPanel15 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel15; + + /// + /// ASPxLabel13 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel13; + + /// + /// tbDelta_GPMForecast control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbDelta_GPMForecast; + + /// + /// ASPxPanel16 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel16; + + /// + /// ASPxLabel14 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel14; + + /// + /// tbRaccoltaNetta_GPMForecast control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbRaccoltaNetta_GPMForecast; + + /// + /// ASPxPanel8 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel8; + + /// + /// ASPxLabel11 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel11; + + /// + /// tbTotAumFinaleITA_GPMForecast control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotAumFinaleITA_GPMForecast; + + /// + /// ASPxPanel9 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel9; + + /// + /// ASPxLabel12 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel12; + + /// + /// tbTotAumFinaleUK_GPMForecast control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotAumFinaleUK_GPMForecast; + + /// + /// ASPxLabel15 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel15; + + /// + /// tbCommPerfInMaturazione control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbCommPerfInMaturazione; + + /// + /// ASPxPanel10 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel10; + + /// + /// gvGPMForecast control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvGPMForecast; + + /// + /// SqlDSGestioniPatrimoniali control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGestioniPatrimoniali; + + /// + /// SqlDSGPMConsuntivo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGPMConsuntivo; + + /// + /// SqlDSGPMForecast control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGPMForecast; + + /// + /// SqlDSFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSFondi; + + /// + /// SqlDSDettaglioFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSDettaglioFondi; + + /// + /// ExporterGPMConsuntivo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ExporterGPMConsuntivo; + + /// + /// ExporterGPMForecast control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ExporterGPMForecast; + + /// + /// ExporterFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ExporterFondi; + + /// + /// ExporterDettaglioFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ExporterDettaglioFondi; + } +} diff --git a/OlympiaIntranet/AndamentoRaccolta.aspx b/OlympiaIntranet/AndamentoRaccolta.aspx new file mode 100644 index 0000000..cd38c31 --- /dev/null +++ b/OlympiaIntranet/AndamentoRaccolta.aspx @@ -0,0 +1,159 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AndamentoRaccolta.aspx.cs" Inherits="OlympiaIntranet.AndamentoRaccolta" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data.Linq" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ <%-- + + + + + --%> + + + + +
+ + diff --git a/OlympiaIntranet/AndamentoRaccolta.aspx.cs b/OlympiaIntranet/AndamentoRaccolta.aspx.cs new file mode 100644 index 0000000..b21857a --- /dev/null +++ b/OlympiaIntranet/AndamentoRaccolta.aspx.cs @@ -0,0 +1,344 @@ +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using DevExpress.XtraPrintingLinks; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using MySqlConnector; +using System.Data.SqlClient; +using System.Data; +using System.Globalization; +using System.Threading; +using DevExpress.Spreadsheet; + +namespace OlympiaIntranet +{ + public partial class AndamentoRaccolta : System.Web.UI.Page + { + protected void Page_Init(object sender, EventArgs e) + { + // Imposta la cultura per la pagina specifica + CultureInfo ci = new CultureInfo("en-US"); + ci.NumberFormat.NumberGroupSeparator = "."; + ci.NumberFormat.NumberDecimalSeparator = ","; + Thread.CurrentThread.CurrentCulture = ci; + Thread.CurrentThread.CurrentUICulture = ci; + } + + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + else + { + if (!IsPostBack) + { + BindGridView(gvRaccoltaGestori, "GDN_RaccoltaGestori"); + BindGridView(gvRaccoltaConsulenti, "GDN_RaccoltaConsulenti"); + BindGridView(gvSituazioneConti, "GDN_RaccoltaConsulenti_NumConti"); + } + } + + + } + protected void ASPxRibbon1_CommandExecuted(object source, DevExpress.Web.RibbonCommandExecutedEventArgs e) + { + // Selezionato pulsante Refresh + if (e.Item.Name == "loadGrid") + { + RibbonTemplateItem template = (RibbonTemplateItem)ASPxRibbon1.Tabs[0].Groups[0].Items.FindByName("ribbonTemplate"); + ASPxDateEdit deDataInizio = template.FindControl("dataInizio") as ASPxDateEdit; + if (String.IsNullOrEmpty(deDataInizio.Text)) + { + CommonClass.MessageBox(this, "Inserire data inizio!"); + return; + } + + ASPxDateEdit deDataFine = template.FindControl("dataFine") as ASPxDateEdit; + if (String.IsNullOrEmpty(deDataFine.Text)) + { + CommonClass.MessageBox(this, "Inserire data fine!"); + return; + } + + // recupero il valore del ribbondateedit dataInizio + Session["data_inizio"] = deDataInizio.Date; + + // recupero il valore del ribbondateedit dataFine + Session["data_fine"] = deDataFine.Date; + + + // Verifica che dataInizio sia minore di dataFine + if (deDataInizio.Date > deDataFine.Date) + { + CommonClass.MessageBox(this, "Data inizio deve essere minore di Data fine!"); + return; + } + + // Se i controlli sono passati allora linka datasource a grdiview... + //gvRaccoltaConsulenti.DataSourceID = "SqlDSRaccoltaConsulenti"; + //gvRaccoltaConsulenti.KeyFieldName = "ID"; + //gvRaccoltaConsulenti.DataBind(); + // Nota del 05-02-2025: ho dovuto implementare la chiamata lato codice altrimenti usando il Datasource non funzionava perchè l'sp GDN_RaccoltaConsulenti utilizza una query dinamica e non veniva riconosciuta la tabella temporanea #GDNConsulenti! + //BindGridView(); + BindGridView(gvRaccoltaGestori, "GDN_RaccoltaGestori"); + BindGridView(gvRaccoltaConsulenti, "GDN_RaccoltaConsulenti"); + BindGridView(gvSituazioneConti, "GDN_RaccoltaConsulenti_NumConti"); + + } + // Selezionato pulsante Export in Excel + if (e.Item.Name == "exportExcel") + { + + // Preparazione esportatori + BindGridView(gvRaccoltaConsulenti, "GDN_RaccoltaConsulenti"); + BindGridView(gvRaccoltaGestori, "GDN_RaccoltaGestori"); + + // Ref link: https://www.devexpress.com/Support/Center/Question/Details/T327338/aspxgridview-export-multiple-grids-to-the-same-excel-file + PrintingSystem ps = new PrintingSystem(); + + // Esporta griglia Raccolta Gestori + PrintableComponentLink link0 = new PrintableComponentLink(ps); + ExporterRaccoltaGestori.ExportSelectedRowsOnly = false; + string reportHeader0 = string.Format(@"Estrazione Raccolta Gestori dal {0} al {1}", Convert.ToDateTime(Session["data_inizio"]).ToString("dd/MM/yyyy"), Convert.ToDateTime(Session["data_fine"]).ToString("dd/MM/yyyy")); + ExporterRaccoltaGestori.ReportHeader = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl{\f0\fnil\fcharset0 Tahoma;}{\f1\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\b\f0\fs28 " + reportHeader0 + @"\b0\f1\fs20\par}"; + link0.Component = ExporterRaccoltaGestori; + + // Esporta griglia Raccolta Consulenti + PrintableComponentLink link1 = new PrintableComponentLink(ps); + ExporterRaccoltaConsulenti.ExportSelectedRowsOnly = false; + string reportHeader1 = string.Format(@"Estrazione Raccolta Consulenti dal {0} al {1}", Convert.ToDateTime(Session["data_inizio"]).ToString("dd/MM/yyyy"), Convert.ToDateTime(Session["data_fine"]).ToString("dd/MM/yyyy")); + ExporterRaccoltaConsulenti.ReportHeader = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl{\f0\fnil\fcharset0 Tahoma;}{\f1\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\b\f0\fs28 " + reportHeader1 + @"\b0\f1\fs20\par}"; + link1.Component = ExporterRaccoltaConsulenti; + + + // Compone excel unico + CompositeLink compositeLink = new CompositeLink(ps); + compositeLink.Links.AddRange(new object[] { link0, link1 }); + compositeLink.CreatePageForEachLink(); + + string fileName = string.Format("{0}_{1}", DateTime.Now.ToString("yyyyMMdd_HHmm"), "Andamento Raccolta.xlsx"); + using (MemoryStream stream = new MemoryStream()) + { + XlsxExportOptionsEx options = new XlsxExportOptionsEx(); + options.ExportMode = XlsxExportMode.SingleFilePageByPage; + options.ExportType = ExportType.WYSIWYG; + compositeLink.PrintingSystemBase.ExportToXlsx(stream, options); + Response.Clear(); + Response.Buffer = false; + Response.AppendHeader("Content-Type", "application/xlsx"); + Response.AppendHeader("Content-Transfer-Encoding", "binary"); + Response.AppendHeader("Content-Disposition", $"attachment; filename={fileName}"); + stream.Position = 0; + + Workbook workbook = new Workbook(); + workbook.LoadDocument(stream, DevExpress.Spreadsheet.DocumentFormat.OpenXml); + DevExpress.Spreadsheet.WorksheetCollection worksheets = workbook.Worksheets; + workbook.Worksheets[0].Name = "Raccolta Gestori"; + workbook.Worksheets[1].Name = "Raccolta Consulenti"; + using (MemoryStream outputStream = new MemoryStream()) + { + workbook.SaveDocument(outputStream, DevExpress.Spreadsheet.DocumentFormat.OpenXml); + Response.BinaryWrite(outputStream.ToArray()); + Response.End(); + } + } + ps.Dispose(); + } + } + + private DataTable GetDynamicData(string query, DateTime DataInizio, DateTime DataFine) + { + //string query = "GDN_RaccoltaConsulenti"; + + using (SqlConnection conn = new SqlConnection(OlympiaIntranet.Properties.Settings.Default.SqlConnection)) + { + using (SqlCommand cmd = new SqlCommand(query, conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + + // Aggiungi i parametri + cmd.Parameters.Add(new SqlParameter("@DataInizio", SqlDbType.Date) { Value = DataInizio }); + cmd.Parameters.Add(new SqlParameter("@DataFine", SqlDbType.Date) { Value = DataFine }); + + using (SqlDataAdapter da = new SqlDataAdapter(cmd)) + { + DataTable dt = new DataTable(); + da.Fill(dt); + return dt; + } + } + } + } + + private void BindGridView(ASPxGridView gridview, string query) + { + if ((Session["data_inizio"] is null) || (Session["data_fine"] is null)) return; + DataTable dt = GetDynamicData(query,(DateTime)Session["data_inizio"], (DateTime)Session["data_fine"]); + gridview.DataSource = dt; + + gridview.Columns.Clear(); + + foreach (DataColumn column in dt.Columns) + { + if (column.ColumnName != "ID") + { + GridViewDataTextColumn gridColumn = new GridViewDataTextColumn(); + gridColumn.FieldName = column.ColumnName; + gridColumn.Caption = column.ColumnName; + gridview.Columns.Add(gridColumn); + gridview.Settings.ShowFooter = true; + } + } + + gridview.DataBind(); + } + + + protected void gvRaccoltaConsulenti_DataBound(object sender, EventArgs e) + { + // ref : https://www.devexpress.com/Support/Center/Question/Details/Q585537/aspxgridview-autogeneratecolumns-true-field-name-start-with-lower-case-letter-insert-a + // Evita che a runtime le colonne con maiuscole nella query vengono scritte con lo spazio (ad esempio codiceIsin -> codice Isin) + // questo poi crea un problema andando a esportare l'excel dove serve che le colonne siano le stesse della query. + DataBound(sender); + + // Totale Conti Aperti + DataTable dtContiAperti = GetDynamicData("GDN_RaccoltaConsulenti_ContiAperti", (DateTime)Session["data_inizio"], (DateTime)Session["data_fine"]); + tbTotContiAperti.Text = dtContiAperti.Rows[0][0].ToString(); + + // Totale Conti Chiusi + DataTable dtContiChiusi = GetDynamicData("GDN_RaccoltaConsulenti_ContiChiusi", (DateTime)Session["data_inizio"], (DateTime)Session["data_fine"]); + tbTotContiChiusi.Text = dtContiChiusi.Rows[0][0].ToString(); + } + + protected void gvRaccoltaConsulenti_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) + { + CustomSummaryCalculate(sender, e); + } + + protected void gvRaccoltaConsulenti_HtmlFooterCellPrepared(object sender, ASPxGridViewTableFooterCellEventArgs e) + { + HtmlFooterCellPrepared(e); + } + + private static void HtmlFooterCellPrepared(ASPxGridViewTableFooterCellEventArgs e) + { + if (e.Column is GridViewDataColumn dataColumn && dataColumn.FieldName != "ID" && dataColumn.FieldName != "Mese") + { + e.Cell.Text = e.Cell.Text.Replace("Sum=", ""); // Rimuove 'Sum=' dal testo del footer + e.Cell.Style["font-weight"] = "bold"; // Imposta il testo in grassetto + } + ; + if (e.Column is GridViewDataColumn dataColumn1 && dataColumn1.FieldName == "Mese") + { + e.Cell.Text = e.Cell.Text = "Totale"; // Rimuove 'Sum=' dal testo del footer + e.Cell.Style["font-weight"] = "bold"; // Imposta il testo in grassetto + } + ; + } + + protected void gvRaccoltaConsulenti_SummaryDisplayText(object sender, ASPxGridViewSummaryDisplayTextEventArgs e) + { + SummaryDisplayText(e); + } + + private static void SummaryDisplayText(ASPxGridViewSummaryDisplayTextEventArgs e) + { + if (e.Item.FieldName != "Mese" && e.Item.FieldName != "ID" && e.Item.SummaryType == DevExpress.Data.SummaryItemType.Sum) + { + e.Text = string.Format("{0:N0}", e.Value); + } + } + + protected void gvRaccoltaGestori_DataBound(object sender, EventArgs e) + { + // ref : https://www.devexpress.com/Support/Center/Question/Details/Q585537/aspxgridview-autogeneratecolumns-true-field-name-start-with-lower-case-letter-insert-a + // Evita che a runtime le colonne con maiuscole nella query vengono scritte con lo spazio (ad esempio codiceIsin -> codice Isin) + // questo poi crea un problema andando a esportare l'excel dove serve che le colonne siano le stesse della query. + DataBound(sender); + } + + private void DataBound(object sender) + { + double TotRaccolta = 0; + ASPxGridView gridview = sender as ASPxGridView; + + if (gridview.Columns.Count > 0) + { + gridview.TotalSummary.Clear(); + foreach (GridViewColumn column in gridview.Columns) + { + if (column is GridViewDataColumn) + { + if (column.Name != "ID" && column.Name != "Mese") + { + ASPxSummaryItem summaryItem = new ASPxSummaryItem(); + summaryItem.FieldName = ((GridViewDataColumn)column).FieldName; + summaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; + summaryItem.DisplayFormat = "{0}"; // Rimuove 'Sum=' + gridview.TotalSummary.Add(summaryItem); + + ((GridViewDataColumn)column).PropertiesEdit.DisplayFormatString = "N0"; + + // Calcola totale per tutte le colonne presenti (il valore fra Gestori e Consulenti è lo stesso!) + TotRaccolta += Convert.ToDouble(gridview.GetTotalSummaryValue(summaryItem)); + } + } + + } + + tbTotaleRaccolta.Text = $"{TotRaccolta:N0}"; + } + } + + protected void gvRaccoltaGestori_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) + { + CustomSummaryCalculate(sender, e); + } + + private static void CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e) + { + if (e.SummaryProcess == DevExpress.Data.CustomSummaryProcess.Finalize) + { + ASPxGridView grid = sender as ASPxGridView; + ASPxSummaryItem summaryItem = e.Item as ASPxSummaryItem; + + if (summaryItem != null && summaryItem.FieldName != "Mese") // Presuming 'Mese' is a fixed column + { + decimal total = 0; + + for (int i = 0; i < grid.VisibleRowCount; i++) + { + object value = grid.GetRowValues(i, summaryItem.FieldName); + total += (value != DBNull.Value) ? Convert.ToDecimal(value) : 0; + } + + e.TotalValue = total; + } + } + } + + protected void gvRaccoltaGestori_HtmlFooterCellPrepared(object sender, ASPxGridViewTableFooterCellEventArgs e) + { + HtmlFooterCellPrepared(e); + } + + + protected void gvRaccoltaGestori_SummaryDisplayText(object sender, ASPxGridViewSummaryDisplayTextEventArgs e) + { + SummaryDisplayText(e); + } + + protected void gvSituazioneConti_DataBound(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/AndamentoRaccolta.aspx.designer.cs b/OlympiaIntranet/AndamentoRaccolta.aspx.designer.cs new file mode 100644 index 0000000..ae14527 --- /dev/null +++ b/OlympiaIntranet/AndamentoRaccolta.aspx.designer.cs @@ -0,0 +1,170 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class AndamentoRaccolta + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxRibbon1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRibbon ASPxRibbon1; + + /// + /// ASPxLabel15 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel15; + + /// + /// tbTotaleRaccolta control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotaleRaccolta; + + /// + /// ASPxPanel29 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel29; + + /// + /// ASPxLabel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel2; + + /// + /// tbTotContiAperti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotContiAperti; + + /// + /// ASPxPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel1; + + /// + /// ASPxLabel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel1; + + /// + /// tbTotContiChiusi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox tbTotContiChiusi; + + /// + /// ASPxPageControl1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPageControl ASPxPageControl1; + + /// + /// gvRaccoltaGestori control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvRaccoltaGestori; + + /// + /// gvSituazioneConti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvSituazioneConti; + + /// + /// ASPxPanel10 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel10; + + /// + /// gvRaccoltaConsulenti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvRaccoltaConsulenti; + + /// + /// ExporterRaccoltaConsulenti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ExporterRaccoltaConsulenti; + + /// + /// ExporterRaccoltaGestori control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ExporterRaccoltaGestori; + } +} diff --git a/OlympiaIntranet/App_Start/Startup.cs b/OlympiaIntranet/App_Start/Startup.cs new file mode 100644 index 0000000..333a596 --- /dev/null +++ b/OlympiaIntranet/App_Start/Startup.cs @@ -0,0 +1,39 @@ +using Microsoft.AspNet.Identity; +using Microsoft.AspNet.Identity.Owin; +using Microsoft.Owin; +using Microsoft.Owin.Host.SystemWeb; +using Microsoft.Owin.Security.Cookies; +using Owin; +using System; +using System.Configuration; + +[assembly: OwinStartup(typeof(OlympiaIntranet.App_Start.Startup))] + +namespace OlympiaIntranet.App_Start +{ + public class Startup + { + public void Configuration(IAppBuilder app) + { + // Per gestire il timeout degli utenti guardare qui : https://www.jamessturtevant.com/posts/ASPNET-Identity-Cookie-Authentication-Timeouts/ + // Per implementare il single sign on : https://stackoverflow.com/questions/42229847/single-sign-on-using-asp-net-identity-between-2-asp-net-mvc-projects + + // Possibile soluzione da studiare per il mancanto login qui : https://stackoverflow.com/questions/20737578/asp-net-sessionid-owin-cookies-do-not-send-to-browser + + string cookieDomain = ConfigurationManager.AppSettings["cookieDomain"].ToString(); + app.UseCookieAuthentication(new CookieAuthenticationOptions + { + LoginPath = new PathString("/SignIn.aspx"), + AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, + CookieName = "OlympiaCookieAuth", + CookieDomain = cookieDomain, + CookieManager = new SystemWebCookieManager() + //SlidingExpiration = false, + //CookieHttpOnly = false, // aggiunto per risolvere problemi di login + //CookieSameSite = SameSiteMode.None, // aggiunto per risolvere problemi di login + //CookieSecure = CookieSecureOption.Always, // aggiunto per risolvere problemi di login + //ExpireTimeSpan = TimeSpan.FromMinutes(240) // scadenza credenziali login 4 ore + }); + } + } +} diff --git a/OlympiaIntranet/AssociazioneLinee.aspx b/OlympiaIntranet/AssociazioneLinee.aspx new file mode 100644 index 0000000..9d94a17 --- /dev/null +++ b/OlympiaIntranet/AssociazioneLinee.aspx @@ -0,0 +1,47 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AssociazioneLinee.aspx.cs" Inherits="OlympiaIntranet.AssociazioneLinee" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + diff --git a/OlympiaIntranet/AssociazioneLinee.aspx.cs b/OlympiaIntranet/AssociazioneLinee.aspx.cs new file mode 100644 index 0000000..14a06bc --- /dev/null +++ b/OlympiaIntranet/AssociazioneLinee.aspx.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class AssociazioneLinee : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + } + + protected void gvAssociazioneFondi_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridViewTableDataCellEventArgs e) + { + if (e.DataColumn.FieldName.Contains("cod_lin") && String.IsNullOrEmpty(e.CellValue.ToString()) == true) + { + e.Cell.BackColor = System.Drawing.Color.OrangeRed; + } + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/AssociazioneLinee.aspx.designer.cs b/OlympiaIntranet/AssociazioneLinee.aspx.designer.cs new file mode 100644 index 0000000..c5261f7 --- /dev/null +++ b/OlympiaIntranet/AssociazioneLinee.aspx.designer.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class AssociazioneLinee { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// gvAssociazioneFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvAssociazioneFondi; + + /// + /// SqlDSAssociazioneLinee control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSAssociazioneLinee; + } +} diff --git a/OlympiaIntranet/CapienzaOrdiniSella.aspx b/OlympiaIntranet/CapienzaOrdiniSella.aspx new file mode 100644 index 0000000..57e6263 --- /dev/null +++ b/OlympiaIntranet/CapienzaOrdiniSella.aspx @@ -0,0 +1,97 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CapienzaOrdiniSella.aspx.cs" Inherits="OlympiaIntranet.CapienzaOrdiniSella" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + <%----%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + diff --git a/OlympiaIntranet/CapienzaOrdiniSella.aspx.cs b/OlympiaIntranet/CapienzaOrdiniSella.aspx.cs new file mode 100644 index 0000000..f9ac653 --- /dev/null +++ b/OlympiaIntranet/CapienzaOrdiniSella.aspx.cs @@ -0,0 +1,68 @@ +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class CapienzaOrdiniSella : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (IsPostBack) { + gvCapienzaOrdiniSella.DataBind(); + } + } + + protected void buttonCaricaDati_Click(object sender, EventArgs e) + { + if (Session["cod_ges"] != null && Session["filtra_negativi"] != null) + { + //SqlDSCapienzaOrdiniSella.SelectCommand = "GDN_CapienzaOrdiniSella"; + //SqlDSCapienzaOrdiniSella.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; + //Parameter p = SqlDSCapienzaOrdiniSella.SelectParameters["cod_ges"]; + //SqlDSCapienzaOrdiniSella.SelectParameters.Remove(p); + //SqlDSCapienzaOrdiniSella.SelectParameters.Add("cod_ges", (string)objGestore); + //Parameter q = SqlDSCapienzaOrdiniSella.SelectParameters["filtra_negativi"]; + //SqlDSCapienzaOrdiniSella.SelectParameters.Remove(q); + //SqlDSCapienzaOrdiniSella.SelectParameters.Add("filtra_negativi", rblFiltraNegativi.SelectedIndex.ToString()); + gvCapienzaOrdiniSella.DataBind(); + + } + } + + protected void buttonEsportaExcel_Click(object sender, EventArgs e) + { + ASPxGridViewExporter1.ExportSelectedRowsOnly = false; + ASPxGridViewExporter1.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - Capienza Ordini Fondi Sella"; + XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.DataAware }; // in DataAware mode l'evento ASPxGridViewExporter_RenderBrick non viene eseguito!! + ASPxGridViewExporter1.WriteXlsxToResponse(op); + } + + protected void gridLookupGestore_ValueChanged(object sender, EventArgs e) + { + ASPxGridView grid = gridLookupGestore.GridView; + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + + if (objGestore != null) + { + Session["cod_ges"] = (string)objGestore; + } + } + + protected void gvOrdiniSella_DataBound(object sender, EventArgs e) + { + + } + + protected void rblFiltraNegativi_ValueChanged(object sender, EventArgs e) + { + Session["filtra_negativi"] = rblFiltraNegativi.SelectedIndex; + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/CapienzaOrdiniSella.aspx.designer.cs b/OlympiaIntranet/CapienzaOrdiniSella.aspx.designer.cs new file mode 100644 index 0000000..306d360 --- /dev/null +++ b/OlympiaIntranet/CapienzaOrdiniSella.aspx.designer.cs @@ -0,0 +1,107 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class CapienzaOrdiniSella + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// rblFiltraNegativi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRadioButtonList rblFiltraNegativi; + + /// + /// gridLookupGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupGestore; + + /// + /// buttonCaricaDati control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonCaricaDati; + + /// + /// buttonEsportaExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonEsportaExcel; + + /// + /// gvCapienzaOrdiniSella control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvCapienzaOrdiniSella; + + /// + /// SqlDSGestori control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGestori; + + /// + /// SqlDSCapienzaOrdiniSella control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSCapienzaOrdiniSella; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + } +} diff --git a/OlympiaIntranet/CommonClass.cs b/OlympiaIntranet/CommonClass.cs new file mode 100644 index 0000000..ee1e797 --- /dev/null +++ b/OlympiaIntranet/CommonClass.cs @@ -0,0 +1,774 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Globalization; +using System.Linq; +using System.Web; +using System.Web.UI.WebControls; +using DevExpress.Data; +using DevExpress.Web; +using System.Reflection; +using System.IO; +using System.Data.SqlClient; +using System.Net; +using System.Threading; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using PdfSharp.Pdf; +using System.Web.UI; +using System.Net.Mail; +using System.Text.RegularExpressions; +using System.Text; +using PdfSharp.Drawing; +using MySqlConnector; + +namespace OlympiaIntranet +{ + public class CommonClass + { + public static DataTable GetGestori() + { + string query = "GDN_GetGestore"; + + using (SqlConnection conn = new SqlConnection(OlympiaIntranet.Properties.Settings.Default.SqlConnection)) + { + using (SqlCommand cmd = new SqlCommand(query, conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + + using (SqlDataAdapter da = new SqlDataAdapter(cmd)) + { + DataTable dt = new DataTable(); + da.Fill(dt); + return dt; + } + } + } + } + + public static void SqlBulkCopyTable(Page page, DataTable dt, string sqlTable) + { + //var table = "Events"; + using (var conn = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var bulkCopy = new SqlBulkCopy(conn) { DestinationTableName = sqlTable }; + bulkCopy.BulkCopyTimeout = 6000; + conn.Open(); + var schema = conn.GetSchema("Columns", new[] { null, null, sqlTable, null }); + foreach (DataColumn schemaColumn in dt.Columns) + { + foreach (DataRow row in schema.Rows) + { + if (string.Equals(schemaColumn.ColumnName, (string)row["COLUMN_NAME"], StringComparison.OrdinalIgnoreCase)) + { + bulkCopy.ColumnMappings.Add(schemaColumn.ColumnName, (string)row["COLUMN_NAME"]); + break; + } + } + } + try + { + bulkCopy.WriteToServer(dt); + } + catch (Exception ex) + { + CommonClass.MessageBox(page, ex.Message); + } + } + } + + public static DataTable execQuery_Datatable_MySql(string query, string connectionString) + { + MySqlDataReader result; + DataTable dt = new DataTable(); + using (var con = new MySqlConnection(connectionString)) + { + var cmd = new MySqlCommand + { + CommandText = query, + CommandType = CommandType.Text, + Connection = con + }; + cmd.CommandTimeout = 0; + con.Open(); // Open the MySqlConnection. + result = cmd.ExecuteReader(); + dt.Load(result); + } + return (dt); + } + //public static DataTable execQuery_Datatable_Sql(string storedProc, + // string connectionString, + // string Gestore = "", + // string Consulente = "", + // string Linea = "", + // int FiltroRanking = -1 , + // int TipoRanking = -1, + // DateTime? DataIns = null, + // string TipoAttivita = "", + // string Societa = "", + // DateTime? MeseRiferimento = null) + //{ + // SqlDataReader result; + // DataTable dt = new DataTable(); + // using (var con = new SqlConnection(connectionString)) + // { + // var cmd = new SqlCommand + // { + // CommandText = storedProc, + // CommandType = CommandType.StoredProcedure, + // Connection = con + // }; + // cmd.CommandTimeout = 600; + // if (String.IsNullOrEmpty(Gestore) == false) cmd.Parameters.Add("@cod_ges", SqlDbType.VarChar).Value = Gestore; + // if (String.IsNullOrEmpty(Consulente) == false) cmd.Parameters.Add("@cod_pro", SqlDbType.VarChar).Value = Consulente; + // if (String.IsNullOrEmpty(Linea) == false) cmd.Parameters.Add("@cod_lin", SqlDbType.VarChar).Value = Linea; + // if (DataIns != null) cmd.Parameters.Add("@data_ins", SqlDbType.Date).Value = DataIns; + // if (FiltroRanking != -1) cmd.Parameters.Add("@FiltroRanking", SqlDbType.Int).Value = FiltroRanking; + // if (TipoRanking != -1) cmd.Parameters.Add("@TipoRanking", SqlDbType.Int).Value = TipoRanking; + // if (String.IsNullOrEmpty(TipoAttivita) == false) cmd.Parameters.Add("@TipoAttivita", SqlDbType.VarChar).Value = TipoAttivita; + // if (String.IsNullOrEmpty(Societa) == false) cmd.Parameters.Add("@Societa", SqlDbType.VarChar).Value = Societa; + // if (MeseRiferimento != null) cmd.Parameters.Add("@MeseRiferimento", SqlDbType.Date).Value = MeseRiferimento; + // con.Open(); // Open the SqlConnection. + // result = cmd.ExecuteReader(); + // dt.Load(result); + // } + // return (dt); + //} + public static DataTable execQuery_Datatable_Sql(string storedProc, + string connectionString, + string Gestore = "", + string Consulente = "", + string Linea = "", + int FiltroRanking = -1, + int TipoRanking = -1, + DateTime? DataIns = null, + string TipoAttivita = "", + string Societa = "", + DateTime? MeseRiferimento = null, + string Advisor = "", + string Titolo = "") + { + SqlDataReader result; + DataTable dt = new DataTable(); + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = storedProc, + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.CommandTimeout = 600; + if (String.IsNullOrEmpty(Gestore) == false) cmd.Parameters.Add("@cod_ges", SqlDbType.VarChar).Value = Gestore; + if (String.IsNullOrEmpty(Consulente) == false) cmd.Parameters.Add("@cod_pro", SqlDbType.VarChar).Value = Consulente; + if (String.IsNullOrEmpty(Linea) == false) cmd.Parameters.Add("@cod_lin", SqlDbType.VarChar).Value = Linea; + if (DataIns != null) cmd.Parameters.Add("@data_ins", SqlDbType.Date).Value = DataIns; + if (FiltroRanking != -1) cmd.Parameters.Add("@FiltroRanking", SqlDbType.Int).Value = FiltroRanking; + if (TipoRanking != -1) cmd.Parameters.Add("@TipoRanking", SqlDbType.Int).Value = TipoRanking; + if (String.IsNullOrEmpty(TipoAttivita) == false) cmd.Parameters.Add("@TipoAttivita", SqlDbType.VarChar).Value = TipoAttivita; + if (String.IsNullOrEmpty(Societa) == false) cmd.Parameters.Add("@Societa", SqlDbType.VarChar).Value = Societa; + if (MeseRiferimento != null) cmd.Parameters.Add("@MeseRiferimento", SqlDbType.Date).Value = MeseRiferimento; + if (String.IsNullOrEmpty(Advisor) == false) cmd.Parameters.Add("@cod_adv", SqlDbType.VarChar).Value = Advisor; + if (String.IsNullOrEmpty(Titolo) == false) cmd.Parameters.Add("@Titolo", SqlDbType.VarChar).Value = Titolo; + con.Open(); // Open the SqlConnection. + result = cmd.ExecuteReader(); + dt.Load(result); + } + return (dt); + } + + public static string ExecSql(string proc, string Param1 = "", string Param2 = "", string Param3 = "", string Param4 = "", string Param5 = "") + { + string result; + using (var con = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var cmd = new SqlCommand + { + CommandText = proc, + CommandType = CommandType.StoredProcedure, + Connection = con + }; + if (proc == "monitorVaR_LoadData1") // Se viene chiamata da MonitorVaR allora passa i parametri anche se vuoti , altrimenti schianta!! + { + //cmd.Parameters.Add("@gruppo", SqlDbType.VarChar).Value = Param1; + //cmd.Parameters.Add("@linea", SqlDbType.VarChar).Value = Param2; + //cmd.Parameters.Add("@gestore", SqlDbType.VarChar).Value = Param3; + //cmd.Parameters.Add("@advisor", SqlDbType.VarChar).Value = Param4; + //cmd.Parameters.Add("@consulente", SqlDbType.VarChar).Value = Param5; + cmd.Parameters.Add("@gestore", SqlDbType.VarChar).Value = Param1; + cmd.Parameters.Add("@linea", SqlDbType.VarChar).Value = Param2; + } + if (proc.Contains("GDN_EsposizioneTitoli_Rating") == true) // se viene chiamata da GDN_EsposizioneTitoli_RatingX allora passa il cod_tit altrimenti schianta!! + { + cmd.Parameters.Add("@cod_tit", SqlDbType.VarChar).Value = Param1; + cmd.Parameters.Add("@TipoRanking", SqlDbType.Int).Value = Convert.ToInt16(Param2); + } + con.Open(); // Open the SqlConnection. + result = cmd.ExecuteScalar().ToString(); + } + return (result); + } + + public static void SetColumnVisibility (ASPxGridView grid, bool visibility, string columnName) + { + if (visibility == true) grid.DataColumns[columnName].EditFormSettings.Visible = DevExpress.Utils.DefaultBoolean.True; + if (visibility == false) grid.DataColumns[columnName].EditFormSettings.Visible = DevExpress.Utils.DefaultBoolean.False; + + } + + public static bool IsIsinValid(string isin) + { + isin = isin.Trim().ToUpper(); + Regex r = new Regex("^[A-Z]{2}[A-Z0-9]{9}\\d$"); + if (!r.IsMatch(isin)) + { + return false; + } + + StringBuilder sb = new StringBuilder(); + foreach (char c in isin.Substring(0, 12)) + { + sb.Append(Digit(c, 36)); + } + + return LuhnTest(sb.ToString()); + } + static int DigitValue(char c, int b) + { + if (c >= '0' && c <= '9') + { + return c - '0'; + } + return c - 'A' + 10; + } + + static int Digit(char c, int b) + { + int result = DigitValue(c, b); + if (result >= b) + { + Console.Error.WriteLine("Invalid Number"); + return -1; + } + return result; + } + static string ReverseString(string input) + { + char[] intermediate = input.ToCharArray(); + Array.Reverse(intermediate); + return new string(intermediate); + } + + static bool LuhnTest(string number) + { + int s1 = 0; + int s2 = 0; + string reverse = ReverseString(number); + for (int i = 0; i < reverse.Length; i++) + { + int digit = Digit(reverse[i], 10); + //This is for odd digits, they are 1-indexed in the algorithm. + if (i % 2 == 0) + { + s1 += digit; + } + else + { // Add 2 * digit for 0-4, add 2 * digit - 9 for 5-9. + s2 += 2 * digit; + if (digit >= 5) + { + s2 -= 9; + } + } + } + + return (s1 + s2) % 10 == 0; + } + + public static string SincronizzaInCedLab(string linkApi) + { + string callPage = string.Empty; + string response = ""; + try + { + using (WebClient web = new WebClient()) + { + callPage = web.DownloadString(linkApi); + } + if (callPage.IndexOf("STATUSCODE : OK") != -1) + { + int posStart = callPage.IndexOf("STATUSCODE : START") + 18; + int posEnd = callPage.IndexOf("STATUSCODE : OK"); + response = callPage.Substring(posStart, posEnd - posStart).Replace(System.Environment.NewLine, @"\n"); + } + + if (callPage.IndexOf("Eccezione rilevata") != -1) + { + int posStart = callPage.IndexOf("Eccezione rilevata :") + 20; + int posEnd = callPage.IndexOf("@"); + response = callPage.Substring(posStart, posEnd - posStart); + string error = response.Replace(System.Environment.NewLine, @"\n"); // rimpiazzo \r\n con \\n che viene 'digerito' da javascript nell'alert + return (error); + } + + return (response); + } + catch (Exception ex) + { + return (ex.Message); + } + } + + public static void SendEmail(string msgBody, string msgSubject = "", string msgFrom = "") + { + var mailFrom = "info@gl-software.it"; + var mailTo = "glicciardello@gmail.com"; + //var mailTo1 = "federico.costalonga@gmail.com"; + var host = "mail.gl-software.it"; + var user = "gl-software.it"; + var pass = "kohriwoo"; + //var ComputerName = System.Environment.MachineName; + //int port = 0; + + //if (ComputerName == "DELL-NOTEBOOK") port = 587; // dal notebook usa porta 587 + //else port = 25; // dal server usa porta 25 + + // Invio email tramite .Net + using (MailMessage message = new MailMessage())// msgFrom, DestMail, tbOggetto.Text, htmlBody)) + { + message.From = new MailAddress(mailFrom, msgFrom); + message.To.Add(new MailAddress(mailTo)); + //if (!isDebug) message.To.Add(new MailAddress(mailTo1)); // invia mail a Fede solo se non è in debug mode! + message.IsBodyHtml = true; + message.Body = msgBody; + message.Subject = msgSubject; + + using (SmtpClient client = new SmtpClient(host)) + { + client.Port = 25; + client.EnableSsl = false; + client.UseDefaultCredentials = false; + client.Credentials = new NetworkCredential(user, pass); + client.Send(message); + } + } + } + + public static void MessageBox(System.Web.UI.Page page, string strMsg) + { + //+ character added after strMsg "')" + ScriptManager.RegisterClientScriptBlock(page,page.GetType(), "alertMessage", "alert('" + strMsg.Replace("'", string.Empty) + "')", true); + + } + + public static void CopyPages(PdfDocument from, PdfDocument to) + { + for (int i = 0; i < from.PageCount; i++) + { + to.AddPage(from.Pages[i]); + } + } + + public static DateTime AddBusinessDays(DateTime date, int days) + { + int d = 4 - Math.Sign(days) * (4 - ((int)date.DayOfWeek + 1)); //SET @d = 4 - SIGN(@n) * (4 - DATEPART(DW, @Date)); Aggiunto uno a DayOfWeek perchè in C# Sunday = 0 mentre in sql DATEPART(dw,..) Sunday = 1 + DateTime returnDate = date.AddDays(days + ((Math.Abs(days) + d - 2) / 5) * 2 * Math.Sign(days) - d / 7); // DATEADD(D, @n + ((ABS(@n) + @d - 2) / 5) * 2 * SIGN(@n) - @d / 7, @Date); + return (returnDate); + } + + public static string CallWebApi(string linkApi) + { + // Create a request for the URL. + WebRequest request = WebRequest.Create(linkApi); + request.Timeout = 60 * 1000; // 60 secondi timeout + // If required by the server, set the credentials. + request.Credentials = CredentialCache.DefaultCredentials; + // Get the response. + WebResponse response = request.GetResponse(); + // Display the status. + Console.WriteLine(((HttpWebResponse)response).StatusDescription); + // Get the stream containing content returned by the server. + Stream dataStream = response.GetResponseStream(); + // Open the stream using a StreamReader for easy access. + StreamReader reader = new StreamReader(dataStream); + // Read the content. + string responseFromServer = reader.ReadToEnd(); + // Display the content. + Console.WriteLine(responseFromServer); + // Clean up the streams and the response. + reader.Close(); + response.Close(); + return (responseFromServer); + } + public static bool IsValidJson(string strInput) + { + strInput = strInput.Trim(); + if ((strInput.StartsWith("{") && strInput.EndsWith("}")) || //For object + (strInput.StartsWith("[") && strInput.EndsWith("]"))) //For array + { + try + { + var obj = JToken.Parse(strInput); + //ScriveLog("BBG Service OK!"); + return true; + } + catch (JsonReaderException ) + { + //Exception in parsing json + //ScriveLog(string.Format(" Error (JsonReaderException) from BBGservice : {0} {1}", jex.Message, jex.InnerException)); + return false; + } + catch (Exception ) //some other exception + { + //Console.WriteLine(ex.ToString()); + //ScriveLog(string.Format(" Error (Exception) from BBGservice : {0} {1}", ex.Message, ex.InnerException)); + return false; + } + } + else + { + return false; + } + } + + public static void SaveHits(int idSite, int hits, string user = "") + { + using (var con = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var cmd = new SqlCommand + { + CommandText = "SaveHits1", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + if (idSite == 0) cmd.Parameters.Add("@site", SqlDbType.VarChar).Value = "ROMA"; + if (idSite == 1) cmd.Parameters.Add("@site", SqlDbType.VarChar).Value = "LONDRA"; + cmd.Parameters.Add("@hits", SqlDbType.Int).Value = hits; + cmd.Parameters.Add("@user", SqlDbType.VarChar).Value = user; + con.Open(); // Open the SqlConnection. + cmd.ExecuteNonQuery(); + } + } + + // Verifica server bbg sia online prendendo dalla lista server in tabella BBGServer + // Restituisce l'ip:porta del server attivo altrimenti N/A + public static string[] IsBBGServiceOnline() + { + string[] result = new string[2]; + result[0] = QueryBBGService("ROMA"); + result[1] = QueryBBGService("LONDRA"); + return (result); + } + + public static int CheckHitsManuali(string Site) + { + int result = 0; + using (var con = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var cmd = new SqlCommand + { + CommandText = "hits_TotalHitsManuali", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@site", SqlDbType.VarChar).Value = Site; + //cmd.Parameters.Add("@utente", SqlDbType.VarChar).Value = utente; + con.Open(); // Open the SqlConnection. + result = (int)cmd.ExecuteScalar(); + } + return (result); + } + + public static string QueryBBGService(string site) + { + DataTable serverlistTable = null; + // Rileva elenco server BBG disponibili + using (var con = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var cmd = new SqlCommand + { + CommandText = "bbg_ServerList1", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@site", SqlDbType.VarChar).Value = site; + con.Open(); // Open the SqlConnection. + SqlDataReader result = cmd.ExecuteReader(); + serverlistTable = new DataTable(); + serverlistTable.Load(result); + } + // Test per verificare che BBG Service sia attivo e raggiungibile... + bool callEsito = false; + string testjson = ""; + string jsonString = ""; + string ActualServerIP = ""; + foreach (DataRow serverRow in serverlistTable.Rows) + { + if (callEsito == true) break; // esce se il server ha risposto al precedente IP + + if (!String.IsNullOrEmpty(serverRow["Port"].ToString())) ActualServerIP = serverRow["IP"].ToString() + ":" + serverRow["Port"].ToString(); + else ActualServerIP = serverRow["IP"].ToString(); + + int callNum = 1; + while (callNum < 5 && callEsito == false) // Effettua 5 tentativi per ogni server in lista + { + testjson = string.Format("http://{0}/api/bbgservicehst?security=XS1431873659@ETLX%20Corp&field=PX_LAST&startDate=20170331&endDate=20170331&type=json", ActualServerIP); + using (WebClient web = new WebClient()) + { + try + { + jsonString = web.DownloadString(testjson); + Console.WriteLine(string.Format("Test N°{0} connessione a BBG Service...", callNum)); + //ScriveLog(string.Format("Test N°{0} connessione a BBG Service...", callNum)); + } + catch (Exception) + { + //ScriveLog(string.Format("Errore connessione Test N°{0} a BBG Service - ErrMsg {1} - InnerMsg {2} - jsonResult {3}", callNum, e.Message, e.InnerException, jsonString)); + jsonString = ""; + callNum++; + Thread.Sleep(1000); // aspetta 1 secondo e poi riscarica i dati... + } + if (!String.IsNullOrEmpty(jsonString)) callEsito = true; // esce se riesce a connettersi a BBG Service... + } + } + } + if (callEsito == false) return ("N/A"); + else return (ActualServerIP); + } + //public static string IsBBGServiceOnline(string logFileName) + //{ + // DataTable serverlistTable = null; + // // Rileva elenco server BBG disponibili + // using (var con = new SqlConnection(Properties.Settings.Default.DBSettings)) + // { + // var cmd = new SqlCommand + // { + // CommandText = "bbg_ServerList", + // CommandType = CommandType.StoredProcedure, + // Connection = con + // }; + // con.Open(); // Open the SqlConnection. + // SqlDataReader result = cmd.ExecuteReader(); + // serverlistTable = new DataTable(); + // serverlistTable.Load(result); + // } + // // Test per verificare che BBG Service sia attivo e raggiungibile... + + // bool callEsito = false; + // string testjson = ""; + // string jsonString = ""; + // string ActualServerIP = ""; + // foreach (DataRow serverRow in serverlistTable.Rows) + // { + // if (callEsito == true) break; // esce se il server ha risposto al precedente IP + + // if (!String.IsNullOrEmpty(serverRow["Port"].ToString())) ActualServerIP = serverRow["IP"].ToString() + ":" + serverRow["Port"].ToString(); + // else ActualServerIP = serverRow["IP"].ToString(); + + // int callNum = 1; + // while (callNum < 20 && callEsito == false) // Effettua 20 tentativi per ogni server in lista + // { + // testjson = string.Format("http://{0}/api/bbgservicehst?security=XS1431873659@ETLX%20Corp&field=OPEN,PX_BID,PX_ASK,PX_OPEN,PX_LAST&startDate=20170331&endDate=20170331&type=json", ActualServerIP); + // using (WebClient web = new WebClient()) + // { + // try + // { + // jsonString = web.DownloadString(testjson); + // //Console.WriteLine(string.Format("Test N°{0} connessione a BBG Service...", callNum)); + // //ScriveLog(string.Format("Test N°{0} connessione a BBG Service...", callNum)); + // } + // catch (Exception e) + // { + // //ScriveLog(string.Format("Errore connessione Test N°{0} a BBG Service - ErrMsg {1} - InnerMsg {2} - jsonResult {3}", callNum, e.Message, e.InnerException, jsonString)); + // jsonString = ""; + // callNum++; + // Thread.Sleep(1000); // aspetta 1 secondo e poi riscarica i dati... + // } + // if (!String.IsNullOrEmpty(jsonString)) callEsito = true; // esce se riesce a connettersi a BBG Service... + // } + // } + // } + // if (callEsito == false) return ("N/A"); + // else return (ActualServerIP); + + //} + + public static double[] shiftArray(double[] list, int m) + { + + var from = 0; + var val = list[from]; + var nextGroup = 1; + for (int i = 0; i < list.Length; i++) + { + var to = ((from - m) + list.Length) % list.Length; + if (to == from) + break; + + var temp = list[to]; + list[to] = val; + from = to; + val = temp; + + if (from < nextGroup) + { + from = nextGroup++; + val = list[from]; + } + } + return (list); + } + + public static string CreaBuildNumber() + { + DateTime compiledOn = File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location); + string result = "Build version "+compiledOn.ToString("ddMMyyyy.HHmm")+" - DE 18.1.6"; + return (result); + } + + public static void CreaColonna(ASPxGridView webGrid, string tipoCol, string nomeCampo, ref int ordineColonna, bool applicaFormattazione=true) + { + webGrid.Columns.Remove(webGrid.Columns[nomeCampo]); // Rimuove colonna prima di crearla + if (tipoCol== "Text") + { + var col = new GridViewDataTextColumn() { FieldName = nomeCampo }; + if (ordineColonna == 0) webGrid.TotalSummary.Add(SummaryItemType.Count, nomeCampo).DisplayFormat = "n0"; + if (applicaFormattazione) col.PropertiesTextEdit.DisplayFormatString = "n2"; + col.VisibleIndex = ordineColonna; + webGrid.Columns.Add(col); + } + if (tipoCol == "Date") + { + var col = new GridViewDataDateColumn() { FieldName = nomeCampo }; + col.PropertiesDateEdit.DisplayFormatString = "dd/MM/yyyy"; + col.VisibleIndex = ordineColonna; + webGrid.Columns.Add(col); + } + ordineColonna++; + } + + public static void SettaFormatiNumerici() + { + CultureInfo newCulture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); + newCulture.NumberFormat.NumberGroupSeparator = "."; + newCulture.NumberFormat.NumberDecimalSeparator = ","; + + System.Threading.Thread.CurrentThread.CurrentCulture = newCulture; + System.Threading.Thread.CurrentThread.CurrentUICulture = newCulture; + } + + public static void SettaWebGrid(ASPxGridView webgrid, bool showAll=true) + { + if (!showAll) + { + webgrid.SettingsPager.Mode = GridViewPagerMode.ShowPager; + webgrid.SettingsPager.PageSize = 20; + webgrid.SettingsPager.PageSizeItemSettings.ShowAllItem = true; + webgrid.Settings.ShowGroupPanel = true; + webgrid.Settings.ShowFilterRow = true; + webgrid.Settings.ShowFooter = true; + webgrid.Settings.ShowFilterBar = GridViewStatusBarMode.Visible; + webgrid.Settings.ShowHeaderFilterButton = true; + //webgrid.Settings.VerticalScrollBarMode = ScrollBarMode.Visible; + //webgrid.SettingsAdaptivity.AdaptivityMode = GridViewAdaptivityMode.HideDataCells; + //webgrid.SettingsAdaptivity.AllowOnlyOneAdaptiveDetailExpanded = true; + webgrid.Theme = "MetropolisBlue"; + } + else + { + webgrid.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords; + webgrid.Settings.ShowGroupPanel = false; + webgrid.Settings.ShowFilterRow = false; + webgrid.Settings.ShowFooter = false; + //webgrid.Theme = "Moderno"; + webgrid.Theme = "MetropolisBlue"; + } + } + + public static void SetColumnFilterContains(ASPxGridView grid) + { + // Abilita in tutte le colonne di default la ricerca con 'Contains' + for (int i = 0; i < Math.Min(grid.VisibleRowCount, grid.Columns.Count); i++) + { + GridViewDataColumn col = (grid.Columns[i]) as GridViewDataColumn; + if (col != null) col.Settings.AutoFilterCondition = AutoFilterCondition.Contains; + } + } + + public static void CustomDataBind(string tipo,ASPxGridView webgrid, string sp, Label label, string testolabel, bool usaParametri=true) + { + //var sqlDS = new SqlDataSource + //{ + // ConnectionString = Properties.Settings.Default.DBSettings, + // SelectCommandType = SqlDataSourceCommandType.StoredProcedure, + // SelectCommand = sp + //}; + //if (usaParametri) + //{ + // var sqlParam = new Parameter("Filter", DbType.String, tipo); + // sqlDS.SelectParameters.Add(sqlParam); + + // switch (tipo) + // { + // case "P": + // label.Text = testolabel + " (Utenti Public)"; + // break; + // case "F": + // label.Text = testolabel + " (Utenti Full)"; + // break; + // case "C": + // label.Text = testolabel + " (Utenti Customer)"; + // break; + // case "R": + // label.Text = testolabel + " (Utenti Registered)"; + // break; + // } + //} + //webgrid.DataSource = sqlDS; + //webgrid.DataBind(); + } + + public static void SalvaLogSync(string paramCall, string paramUtente) + { + using (var con = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.logsync_Ins", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("Call", SqlDbType.VarChar).Value = paramCall; + cmd.Parameters.Add("Utente", SqlDbType.VarChar).Value = paramUtente; + con.Open(); // Open the SqlConnection. + cmd.ExecuteNonQuery(); + } + } + + public static string SQLProc(string proc, string date = "", int idSite = -1) + { + string result; + using (var con = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var cmd = new SqlCommand + { + CommandText = proc, + CommandType = CommandType.StoredProcedure, + Connection = con + }; + if (String.IsNullOrEmpty(date) == false) cmd.Parameters.Add("@Date", SqlDbType.Date).Value = Convert.ToDateTime(date); + if (idSite == 0) cmd.Parameters.Add("@site", SqlDbType.VarChar).Value = "ROMA"; + if (idSite == 1) cmd.Parameters.Add("@site", SqlDbType.VarChar).Value = "LONDRA"; + con.Open(); // Open the SqlConnection. + result = cmd.ExecuteScalar().ToString(); + } + return (result); + } + + public static void DrawImage(XGraphics gfx, string jpegFileNamePath, int x, int y, int width, int height) + { + XImage image = XImage.FromFile(jpegFileNamePath); + gfx.DrawImage(image, x, y, width, height); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/DXTempFolder/BinaryData/d150b194-2ccf-4eb7-aa09-ca06c949c150Page1_barChart.bmp b/OlympiaIntranet/DXTempFolder/BinaryData/d150b194-2ccf-4eb7-aa09-ca06c949c150Page1_barChart.bmp new file mode 100644 index 0000000..958b753 Binary files /dev/null and b/OlympiaIntranet/DXTempFolder/BinaryData/d150b194-2ccf-4eb7-aa09-ca06c949c150Page1_barChart.bmp differ diff --git a/OlympiaIntranet/DashboardControlli.aspx b/OlympiaIntranet/DashboardControlli.aspx new file mode 100644 index 0000000..4614489 --- /dev/null +++ b/OlympiaIntranet/DashboardControlli.aspx @@ -0,0 +1,97 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DashboardControlli.aspx.cs" Inherits="OlympiaIntranet.DashboardControlli" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + Dashboard Controlli + + +
+ + + + + + + + +
+

Dashboard Controlli +

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- Exporter collegato alla griglia --%> + + +
+
+
+
+ + diff --git a/OlympiaIntranet/DashboardControlli.aspx.cs b/OlympiaIntranet/DashboardControlli.aspx.cs new file mode 100644 index 0000000..5615297 --- /dev/null +++ b/OlympiaIntranet/DashboardControlli.aspx.cs @@ -0,0 +1,79 @@ +using DevExpress.Web; +using System; +using System.Data; +using System.Data.SqlClient; +using System.Web; + +namespace OlympiaIntranet +{ + public partial class DashboardControlli : System.Web.UI.Page + { + private string ConnectionString + { + get + { + return System.Configuration.ConfigurationManager + .ConnectionStrings["OlympiaIntranet.Properties.Settings.SqlConnection"] + .ConnectionString; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!HttpContext.Current.User.Identity.IsAuthenticated) + { + Response.Redirect("~/SignIn.aspx"); + return; + } + + if (!IsPostBack) + { + BindGrid(); + } + } + + // --------------------------------------------------------------- + // Necessario per i callback DevExpress (filtro, ordinamento, ecc.) + // --------------------------------------------------------------- + protected void gvDashboardAlert_DataBinding(object sender, EventArgs e) + { + gvDashboardAlert.DataSource = GetData(); + } + + // --------------------------------------------------------------- + // Carica i dati e li assegna alla griglia + // --------------------------------------------------------------- + private void BindGrid() + { + gvDashboardAlert.DataSource = GetData(); + gvDashboardAlert.DataBind(); + } + + // --------------------------------------------------------------- + // Recupera i dati dalla SP GDN_DashboardAlert + // --------------------------------------------------------------- + private DataTable GetData() + { + DataTable dt = new DataTable(); + + using (SqlConnection conn = new SqlConnection(ConnectionString)) + using (SqlCommand cmd = new SqlCommand("GDN_DashboardAlert", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + SqlDataAdapter da = new SqlDataAdapter(cmd); + da.Fill(dt); + } + + return dt; + } + + // --------------------------------------------------------------- + // Export Excel - usa ASPxGridViewExporter dichiarato nel markup + // --------------------------------------------------------------- + protected void btnExportExcel_Click(object sender, EventArgs e) + { + gvDashboardAlert.DataSource = GetData(); + gridExporter.WriteXlsxToResponse("DashboardAlert_" + DateTime.Now.ToString("yyyyMMdd") + ".xlsx"); + } + } +} diff --git a/OlympiaIntranet/DashboardControlli.aspx.designer.cs b/OlympiaIntranet/DashboardControlli.aspx.designer.cs new file mode 100644 index 0000000..b352792 --- /dev/null +++ b/OlympiaIntranet/DashboardControlli.aspx.designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class DashboardControlli + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel1; + + /// + /// btnExportExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnExportExcel; + + /// + /// gvDashboardAlert control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvDashboardAlert; + + /// + /// gridExporter control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter gridExporter; + } +} diff --git a/OlympiaIntranet/DataClasses1.dbml b/OlympiaIntranet/DataClasses1.dbml new file mode 100644 index 0000000..32fac5f --- /dev/null +++ b/OlympiaIntranet/DataClasses1.dbml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/OlympiaIntranet/DataClasses1.dbml.layout b/OlympiaIntranet/DataClasses1.dbml.layout new file mode 100644 index 0000000..69ebabb --- /dev/null +++ b/OlympiaIntranet/DataClasses1.dbml.layout @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OlympiaIntranet/DataClasses1.designer.cs b/OlympiaIntranet/DataClasses1.designer.cs new file mode 100644 index 0000000..9ae82dc --- /dev/null +++ b/OlympiaIntranet/DataClasses1.designer.cs @@ -0,0 +1,461 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + using System.Data.Linq; + using System.Data.Linq.Mapping; + using System.Data; + using System.Collections.Generic; + using System.Reflection; + using System.Linq; + using System.Linq.Expressions; + using System.ComponentModel; + using System; + + + [global::System.Data.Linq.Mapping.DatabaseAttribute(Name="FirstSolutionDB")] + public partial class DataClasses1DataContext : System.Data.Linq.DataContext + { + + private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource(); + + #region Extensibility Method Definitions + partial void OnCreated(); + #endregion + + public DataClasses1DataContext() : + base(global::OlympiaIntranet.Properties.Settings.Default.SqlConnection, mappingSource) + { + OnCreated(); + } + + public DataClasses1DataContext(string connection) : + base(connection, mappingSource) + { + OnCreated(); + } + + public DataClasses1DataContext(System.Data.IDbConnection connection) : + base(connection, mappingSource) + { + OnCreated(); + } + + public DataClasses1DataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + base(connection, mappingSource) + { + OnCreated(); + } + + public DataClasses1DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : + base(connection, mappingSource) + { + OnCreated(); + } + + public System.Data.Linq.Table LoadFondiETFs + { + get + { + return this.GetTable(); + } + } + } + + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.LoadFondiETF")] + public partial class LoadFondiETF + { + + private string _IsinCode; + + private string _Name; + + private string _ListingCurrency; + + private string _TepiloraCategory; + + private string _TepiloraType; + + private string _TepiloraCurrencyExposure; + + private string _TepiloraCurrencyHedging; + + private System.Nullable _InceptionDate; + + private System.Nullable _OngoingFees; + + private System.Nullable _TER; + + private System.Nullable _TotalAssetValue; + + private string _DistributionPolicy; + + private System.Nullable _LowerFees; + + private System.Nullable _TMonthlyReturns; + + private System.Nullable _TMonthlyVolatility; + + private System.Nullable _TRDD; + + private System.Nullable _FinalRating; + + private System.Nullable _DataIns; + + private string _TepiloraCode; + + private string _MorningStarCategory; + + private string _MorningstarCode; + + public LoadFondiETF() + { + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsinCode", DbType="VarChar(50)")] + public string IsinCode + { + get + { + return this._IsinCode; + } + set + { + if ((this._IsinCode != value)) + { + this._IsinCode = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="VarChar(500)")] + public string Name + { + get + { + return this._Name; + } + set + { + if ((this._Name != value)) + { + this._Name = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ListingCurrency", DbType="VarChar(10)")] + public string ListingCurrency + { + get + { + return this._ListingCurrency; + } + set + { + if ((this._ListingCurrency != value)) + { + this._ListingCurrency = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TepiloraCategory", DbType="VarChar(500)")] + public string TepiloraCategory + { + get + { + return this._TepiloraCategory; + } + set + { + if ((this._TepiloraCategory != value)) + { + this._TepiloraCategory = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TepiloraType", DbType="VarChar(50)")] + public string TepiloraType + { + get + { + return this._TepiloraType; + } + set + { + if ((this._TepiloraType != value)) + { + this._TepiloraType = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TepiloraCurrencyExposure", DbType="VarChar(50)")] + public string TepiloraCurrencyExposure + { + get + { + return this._TepiloraCurrencyExposure; + } + set + { + if ((this._TepiloraCurrencyExposure != value)) + { + this._TepiloraCurrencyExposure = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TepiloraCurrencyHedging", DbType="VarChar(50)")] + public string TepiloraCurrencyHedging + { + get + { + return this._TepiloraCurrencyHedging; + } + set + { + if ((this._TepiloraCurrencyHedging != value)) + { + this._TepiloraCurrencyHedging = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_InceptionDate", DbType="DateTime")] + public System.Nullable InceptionDate + { + get + { + return this._InceptionDate; + } + set + { + if ((this._InceptionDate != value)) + { + this._InceptionDate = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OngoingFees", DbType="Float")] + public System.Nullable OngoingFees + { + get + { + return this._OngoingFees; + } + set + { + if ((this._OngoingFees != value)) + { + this._OngoingFees = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TER", DbType="Float")] + public System.Nullable TER + { + get + { + return this._TER; + } + set + { + if ((this._TER != value)) + { + this._TER = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TotalAssetValue", DbType="Float")] + public System.Nullable TotalAssetValue + { + get + { + return this._TotalAssetValue; + } + set + { + if ((this._TotalAssetValue != value)) + { + this._TotalAssetValue = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DistributionPolicy", DbType="VarChar(50)")] + public string DistributionPolicy + { + get + { + return this._DistributionPolicy; + } + set + { + if ((this._DistributionPolicy != value)) + { + this._DistributionPolicy = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LowerFees", DbType="Int")] + public System.Nullable LowerFees + { + get + { + return this._LowerFees; + } + set + { + if ((this._LowerFees != value)) + { + this._LowerFees = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TMonthlyReturns", DbType="Float")] + public System.Nullable TMonthlyReturns + { + get + { + return this._TMonthlyReturns; + } + set + { + if ((this._TMonthlyReturns != value)) + { + this._TMonthlyReturns = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TMonthlyVolatility", DbType="Float")] + public System.Nullable TMonthlyVolatility + { + get + { + return this._TMonthlyVolatility; + } + set + { + if ((this._TMonthlyVolatility != value)) + { + this._TMonthlyVolatility = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TRDD", DbType="Float")] + public System.Nullable TRDD + { + get + { + return this._TRDD; + } + set + { + if ((this._TRDD != value)) + { + this._TRDD = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FinalRating", DbType="Float")] + public System.Nullable FinalRating + { + get + { + return this._FinalRating; + } + set + { + if ((this._FinalRating != value)) + { + this._FinalRating = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DataIns", DbType="Date")] + public System.Nullable DataIns + { + get + { + return this._DataIns; + } + set + { + if ((this._DataIns != value)) + { + this._DataIns = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TepiloraCode", DbType="VarChar(50)")] + public string TepiloraCode + { + get + { + return this._TepiloraCode; + } + set + { + if ((this._TepiloraCode != value)) + { + this._TepiloraCode = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MorningStarCategory", DbType="VarChar(100)")] + public string MorningStarCategory + { + get + { + return this._MorningStarCategory; + } + set + { + if ((this._MorningStarCategory != value)) + { + this._MorningStarCategory = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MorningstarCode", DbType="VarChar(100)")] + public string MorningstarCode + { + get + { + return this._MorningstarCode; + } + set + { + if ((this._MorningstarCode != value)) + { + this._MorningstarCode = value; + } + } + } + } +} +#pragma warning restore 1591 diff --git a/OlympiaIntranet/Default.aspx b/OlympiaIntranet/Default.aspx new file mode 100644 index 0000000..3f1d4a9 --- /dev/null +++ b/OlympiaIntranet/Default.aspx @@ -0,0 +1,212 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="OlympiaIntranet.Default" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Responsive image +
+
+
+ + + + + + + + + +
+ Logout +
+
+
+
+
+
+
+
+<%-- --%> + +
+ +
+ + +
+
+<%-- --%> + + +
+ AUM +
+ +
+
+<%--
+
--%> + + +
+
+ +
+
+<%--
+
--%> + + +
+
+
+
+
+
+<%--
+
--%> + + +
+
+
+
+
+
+<%--
+
--%> +<%-- --%> + + +
+
+
+
+
+
+<%--
+
--%> +<%-- --%> + +
+
+
+
+
+
+
+<%--
+
+
+
+
+
+
+
+
+
--%> +
+
+
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/OlympiaIntranet/Default.aspx.cs b/OlympiaIntranet/Default.aspx.cs new file mode 100644 index 0000000..da84817 --- /dev/null +++ b/OlympiaIntranet/Default.aspx.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class Default : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + } + + protected void lbLogout_Click(object sender, EventArgs e) + { + var AuthenticationManager = HttpContext.Current.GetOwinContext().Authentication; + AuthenticationManager.SignOut(); + + Response.Redirect("~/SignIn.aspx"); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/Default.aspx.designer.cs b/OlympiaIntranet/Default.aspx.designer.cs new file mode 100644 index 0000000..c6df096 --- /dev/null +++ b/OlympiaIntranet/Default.aspx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class Default { + + /// + /// LoginView2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LoginView LoginView2; + } +} diff --git a/OlympiaIntranet/Default2.aspx b/OlympiaIntranet/Default2.aspx new file mode 100644 index 0000000..e0b96aa --- /dev/null +++ b/OlympiaIntranet/Default2.aspx @@ -0,0 +1,446 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default2.aspx.cs" Inherits="OlympiaIntranet.Default2" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Responsive image +
+
+
+ + + + + + + + + +
+ Logout +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ AUM +
+
+
+
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + diff --git a/OlympiaIntranet/Default2.aspx.cs b/OlympiaIntranet/Default2.aspx.cs new file mode 100644 index 0000000..8c82801 --- /dev/null +++ b/OlympiaIntranet/Default2.aspx.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class Default2 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + //if (User.Identity.IsAuthenticated == false || User.Identity.Name == "external") + if (User.Identity.IsAuthenticated == false) // [30-08-2024]: Rimossa utenza external su richiesta di Fede + { + Response.Redirect("~/SignIn.aspx"); + } + } + + protected void lbLogout_Click(object sender, EventArgs e) + { + var AuthenticationManager = HttpContext.Current.GetOwinContext().Authentication; + AuthenticationManager.SignOut(); + + Response.Redirect("~/SignIn.aspx"); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/Default2.aspx.designer.cs b/OlympiaIntranet/Default2.aspx.designer.cs new file mode 100644 index 0000000..0a4e802 --- /dev/null +++ b/OlympiaIntranet/Default2.aspx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class Default2 { + + /// + /// LoginView2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LoginView LoginView2; + + /// + /// menuFormLayout control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout menuFormLayout; + } +} diff --git a/OlympiaIntranet/ElencoProxy.aspx b/OlympiaIntranet/ElencoProxy.aspx new file mode 100644 index 0000000..5759f3c --- /dev/null +++ b/OlympiaIntranet/ElencoProxy.aspx @@ -0,0 +1,102 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ElencoProxy.aspx.cs" Inherits="OlympiaIntranet.ElencoProxy" %> + +<%@ Register Assembly="DevExpress.Web.Bootstrap.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.Bootstrap" TagPrefix="dx" %> + +<%@ Register assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web" tagprefix="dx" %> +<%--<%@ Register Src="~/MemberPages/menu.ascx" TagPrefix="mc" TagName="menuControl" %>--%> + + + + + + + +
+<%--
+ +
--%> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/OlympiaIntranet/ElencoProxy.aspx.cs b/OlympiaIntranet/ElencoProxy.aspx.cs new file mode 100644 index 0000000..c48f55e --- /dev/null +++ b/OlympiaIntranet/ElencoProxy.aspx.cs @@ -0,0 +1,177 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using MySqlConnector; +using System.Data; +using DevExpress.Web; +using System.Collections; + +// +// Nota : Per colpa di un bug in mySQL Connector .Net v6.10.6 non si può usare SqlDataSource e bisogna gestire le operazioni CRUD a mano! (la soluzione sarebbe di aggiornare MySql Connector all'ultima versione !) +// +namespace OlympiaIntranet +{ + public partial class ElencoProxy : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + CommonClass.SetColumnFilterContains(gvElencoProxy); + + RefreshGrid(); + + } + + protected void RefreshGrid() + { + MySqlConnection conn = new MySqlConnection(Properties.Settings.Default.mySqlConnection); + MySqlCommand cmd = conn.CreateCommand(); + + cmd.CommandText = "select * from olympia_proxylist"; + conn.Open(); + + MySqlDataReader dataReader = cmd.ExecuteReader(); + var dataTable = new DataTable(); + dataTable.Load(dataReader); + conn.Close(); + + gvElencoProxy.DataSource = dataTable; + gvElencoProxy.KeyFieldName = "IDProxylist"; + gvElencoProxy.DataBind(); + } + + protected void gvElencoProxy_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) + { + // ref link : https://www.devexpress.com/Support/Center/Question/Details/KA18686/aspxgridview-how-to-implement-crud-operations-with-a-custom-data-source + + ASPxGridView gridView = (ASPxGridView)sender; + IDictionaryEnumerator enumerator = e.NewValues.GetEnumerator(); + string sqlKey = String.Empty; + string sqlValue = String.Empty; + string sql = String.Empty; + string cod_tit_originale = String.Empty; + enumerator.Reset(); + int cont = 1; + while (enumerator.MoveNext()) + { + + if (enumerator.Key.ToString() == "cod_tit_originale") { if (enumerator.Value != null) cod_tit_originale = enumerator.Value.ToString(); } + + if (cont == 7) // sono 7 i campi che salviamo : cod_tit_originale,isin_originale,descrizione_originale,cod_tit_proxy,isin_proxy,descrizione_proxy,scadenza + { + sqlKey += enumerator.Key.ToString(); + if (enumerator.Value != null) sqlValue += "'" + Convert.ToDateTime(enumerator.Value).ToString("yyyy-MM-dd")+"'"; // Ultimo campo è scadenza che è una data + else sqlValue += "'2000-01-01'"; + } + else + { + sqlKey += enumerator.Key.ToString() + ","; + if (enumerator.Value != null) sqlValue += "'" + enumerator.Value.ToString() + "',"; + else sqlValue += "NULL,"; + } + cont++; + } + sql = "INSERT INTO olympia_proxylist (" + sqlKey + ",data_ins) values (" + sqlValue + ",CURDATE())"; + + // Verifico che isin_originale non sia già presente fra le proxy, e nel caso segnalo errore e non permetto l'inserimento! (31/01/2024) + List listIsinOriginale = new List(); + for (int i = 0; i < gvElencoProxy.VisibleRowCount; i++) + { + listIsinOriginale.Add(gvElencoProxy.GetRowValues(i, "cod_tit_originale").ToString()); + } + if (listIsinOriginale.Contains(cod_tit_originale) == true) + { + e.Cancel = false; + throw new MyException($"Titolo {cod_tit_originale} già presente nelle proxy, cancellarlo oppure modificarlo!"); + } + + // Salva nuovo Proxy in tabella olympia_proxylist + MySqlConnection conn = new MySqlConnection(Properties.Settings.Default.mySqlConnection); + MySqlCommand cmd = conn.CreateCommand(); + cmd.CommandText = sql; + conn.Open(); + cmd.ExecuteNonQuery(); + conn.Close(); + + gridView.CancelEdit(); + e.Cancel = true; + + RefreshGrid(); + } + + protected void gvElencoProxy_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) + { + // ref link : https://www.devexpress.com/Support/Center/Question/Details/KA18686/aspxgridview-how-to-implement-crud-operations-with-a-custom-data-source + + ASPxGridView gridView = (ASPxGridView)sender; + int ID = (int)e.Keys[0]; + + IDictionaryEnumerator enumerator = e.NewValues.GetEnumerator(); + string sqlKeyValue = String.Empty; + string sql = String.Empty; + enumerator.Reset(); + int cont = 1; + while (enumerator.MoveNext()) + { + if (cont == 7) // sono 7 i campi che salviamo : cod_tit_originale,isin_originale,descrizione_originale,cod_tit_proxy,isin_proxy,descrizione_proxy,scadenza + { + if (enumerator.Value != null) sqlKeyValue += enumerator.Key.ToString()+"='" + Convert.ToDateTime(enumerator.Value).ToString("yyyy-MM-dd") + "',"; // Ultimo campo è scadenza che è una data + else sqlKeyValue += enumerator.Key.ToString() + "='2000-01-01',"; + sqlKeyValue += "data_mod=CURDATE()"; + } + else + { + if (enumerator.Value != null) sqlKeyValue += enumerator.Key.ToString() + "='" + enumerator.Value.ToString() + "',"; + else sqlKeyValue += enumerator.Key.ToString() + "=NULL,"; + } + cont++; + } + sql = "UPDATE olympia_proxylist SET " + sqlKeyValue +" WHERE IDProxylist=" + ID; + + // Salva nuovo Proxy in tabella olympia_proxylist + MySqlConnection conn = new MySqlConnection(Properties.Settings.Default.mySqlConnection); + MySqlCommand cmd = conn.CreateCommand(); + cmd.CommandText = sql; + conn.Open(); + cmd.ExecuteNonQuery(); + conn.Close(); + + gridView.CancelEdit(); + e.Cancel = true; + + RefreshGrid(); + } + + protected void gvElencoProxy_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) + { + // ref link : https://www.devexpress.com/Support/Center/Question/Details/KA18686/aspxgridview-how-to-implement-crud-operations-with-a-custom-data-source + + ASPxGridView gridView = (ASPxGridView)sender; + int ID = (int)e.Keys[0]; + + string sql = String.Empty; + + sql = "DELETE FROM olympia_proxylist WHERE IDProxylist=" + ID; + + // Salva nuovo Proxy in tabella olympia_proxylist + MySqlConnection conn = new MySqlConnection(Properties.Settings.Default.mySqlConnection); + MySqlCommand cmd = conn.CreateCommand(); + cmd.CommandText = sql; + conn.Open(); + cmd.ExecuteNonQuery(); + conn.Close(); + + gridView.CancelEdit(); + e.Cancel = true; + + RefreshGrid(); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/ElencoProxy.aspx.designer.cs b/OlympiaIntranet/ElencoProxy.aspx.designer.cs new file mode 100644 index 0000000..6985d07 --- /dev/null +++ b/OlympiaIntranet/ElencoProxy.aspx.designer.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class ElencoProxy + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// gvElencoProxy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvElencoProxy; + + /// + /// SqlDSProxyList control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSProxyList; + } +} diff --git a/OlympiaIntranet/ElencoTitoli.aspx b/OlympiaIntranet/ElencoTitoli.aspx new file mode 100644 index 0000000..f9e2ab3 --- /dev/null +++ b/OlympiaIntranet/ElencoTitoli.aspx @@ -0,0 +1,115 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ElencoTitoli.aspx.cs" Inherits="OlympiaIntranet.ElencoTitoli" %> + +<%@ Register assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web" tagprefix="dx" %> +<%--<%@ Register Src="~/MemberPages/menu.ascx" TagPrefix="mc" TagName="menuControl" %>--%> + + + + + + + + + +
+<%-- --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + diff --git a/OlympiaIntranet/ElencoTitoli.aspx.cs b/OlympiaIntranet/ElencoTitoli.aspx.cs new file mode 100644 index 0000000..c5941dc --- /dev/null +++ b/OlympiaIntranet/ElencoTitoli.aspx.cs @@ -0,0 +1,63 @@ +using DevExpress.Export; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using MySqlConnector; +using System.Data; + +// Codice Titolo | ISIN | Descrizione Titolo | Ticker Bloomberg | Tipo titolo | Descrizione Tipo Titolo | Asset Class | Descrizione Asset Class | Flag Certificate | Mercato | Prezzo | Data Ultimo Prezzo +namespace OlympiaIntranet +{ + public partial class ElencoTitoli : System.Web.UI.Page + { + string mySqlconnString = "Server=192.168.125.10;Port=3306;Database=olympia;Uid=pegasus9x;Pwd=Locarno_4139$;"; + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + // Setta in tutte le colonne di default ricerca per 'Contains' invece che per 'Begins with' (mettere in Page_Load altrimenti non funziona!) + CommonClass.SetColumnFilterContains(ASPxTitoliGDN); + + //if (!IsPostBack) + //{ + MySqlConnection conn = new MySqlConnection(mySqlconnString); + MySqlCommand cmd = conn.CreateCommand(); + + cmd.CommandText = "select cod_tit as CodiceTitolo , cod_isin as ISIN , des_tit as DescrizioneTitolo, des_tit_bre as DescrizioneTitoloBreve, cod_div as Divisa, security_type as SecurityType, cod_bloomberg as TickerBBG,"+ + "CASE WHEN fondo_azi = 'S' THEN 'Fondo Azionario' "+ + "WHEN fondo_bil = 'S' THEN 'Fondo Bilanciato' "+ + "WHEN fondo_obb = 'S' THEN 'Fondo Obbligazionario' " + + "WHEN fondo_mon = 'S' THEN 'Fondo Monetario' "+ + "WHEN certificate = 'S' THEN 'Certificato' "+ + "END as Tipo,"+ + "ETF, cod_mer as Mercato, divisore as Divisore, t.cod_tiptit as TipoTitolo, tt.des_tiptit AS DescrTipoTitolo, bloccato as Bloccato, noacquisti as nobuy, link_prezzi as LinkPrezzi, link_error as LinkError, new_entry as NewEntry, in_portafoglio as InPortafoglio," + + "utilizzato as Utilizzato, conflitto as Conflitto, prezzo_ult as UltimoPrezzo, data_ult as DataUltimoPrezzo, note as Note, coordinate as Coordinate "+ + "from tit t left join tabtiptit tt ON tt.cod_tiptit=t.cod_tiptit where estinto is null"; + conn.Open(); + + MySqlDataReader dataReader = cmd.ExecuteReader(); + var dataTable = new DataTable(); + dataTable.Load(dataReader); + conn.Close(); + + ASPxTitoliGDN.DataSource = dataTable; + ASPxTitoliGDN.DataBind(); + //} + } + + protected void ASPxExportXls_Click(object sender, EventArgs e) + { + ASPxGridViewExporter.ExportSelectedRowsOnly = false; + ASPxGridViewExporter.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - Tabella Titoli Guardian"; + XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.DataAware }; // in DataAware mode l'evento ASPxGridViewExporter_RenderBrick non viene eseguito!! + ASPxGridViewExporter.WriteXlsxToResponse(op); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/ElencoTitoli.aspx.designer.cs b/OlympiaIntranet/ElencoTitoli.aspx.designer.cs new file mode 100644 index 0000000..93b78c0 --- /dev/null +++ b/OlympiaIntranet/ElencoTitoli.aspx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class ElencoTitoli { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxExportXls control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxExportXls; + + /// + /// ASPxTitoliGDN control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView ASPxTitoliGDN; + + /// + /// SqlDSTitoliGDN control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSTitoliGDN; + + /// + /// ASPxGridViewExporter control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter; + } +} diff --git a/OlympiaIntranet/EsposizioneCertificati.aspx b/OlympiaIntranet/EsposizioneCertificati.aspx new file mode 100644 index 0000000..4774a58 --- /dev/null +++ b/OlympiaIntranet/EsposizioneCertificati.aspx @@ -0,0 +1,158 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EsposizioneCertificati.aspx.cs" Inherits="OlympiaIntranet.EsposizioneCertificati" %> + +<%@ Register Assembly="DevExpress.XtraCharts.v23.2.Web, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dx" %> + +<%@ Register Assembly="DevExpress.XtraCharts.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts" TagPrefix="dx" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + + +
+
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + +
+ + + + + + + + + <%--messo a 523 per arrivare a 600px (523px grafico + 77px height header)--%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + +
+ + + diff --git a/OlympiaIntranet/EsposizioneCertificati.aspx.cs b/OlympiaIntranet/EsposizioneCertificati.aspx.cs new file mode 100644 index 0000000..d5039ce --- /dev/null +++ b/OlympiaIntranet/EsposizioneCertificati.aspx.cs @@ -0,0 +1,116 @@ + using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraCharts.Native; +using DevExpress.XtraPrinting; +using PdfSharp.Pdf; +using PdfSharp.Pdf.IO; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +namespace OlympiaIntranet +{ + public partial class EsposizioneCertificati : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + } + + protected void btnCaricaDati_Click(object sender, EventArgs e) + { + Session["cod_rap"] = txtPortafoglio.Text; + + gvEsposizioneCertificati.DataBind(); + + if (gvEsposizioneCertificati.VisibleRowCount == 0) + { + CommonClass.MessageBox(this, "Consultare la posizione in Guardian e ripetere la richiesta!"); + // throw new MyException("Consultare la posizione in Guardian e ripetere la richiesta!"); + } + } + + + + protected void btnEsportaExcel_Click(object sender, EventArgs e) + { + ASPxGridViewExporter1.ExportSelectedRowsOnly = false; + ASPxGridViewExporter1.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - Esposizione Certificati"; + XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.WYSIWYG }; + ASPxGridViewExporter1.WriteXlsxToResponse(op); + } + + protected void gvEsposizioneCertificati_CustomErrorText(object sender, ASPxGridViewCustomErrorTextEventArgs e) + { + // https://supportcenter.devexpress.com/ticket/details/e59/how-to-show-an-error-message-when-a-record-cannot-be-deleted + if (e.Exception is MyException) e.ErrorText = e.Exception.Message; + } + + protected void btnEsportaPdf_Click(object sender, EventArgs e) + { + // Crea pdf di gvEsposizioneCertificati + string gridFileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - grid.pdf"; + using (System.IO.FileStream output = new System.IO.FileStream(Server.MapPath(@"~/App_Data/UploadTemp/" +gridFileName), FileMode.Create)) + { + gvEsposizioneCertificati.ExportToPdf(output); + } + + // Crea pdf del grafico + string chartFileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - chart.pdf"; + chart.DataBind(); + + // Esporta grafico in pdf in landscape + var ps = new PrintingSystem(); + ps.PageSettings.Landscape = true; + var link1 = new PrintableComponentLink(); + chart.DataBind(); + link1.Component = ((IChartContainer)chart).Chart; + link1.Landscape = true; + //link1.PaperKind = System.Drawing.Printing.PaperKind.A4Extra; + //((Chart)link1.Component).OptionsPrint.SizeMode = DevExpress.XtraCharts.Printing.PrintSizeMode.Zoom; + link1.PrintingSystem = ps; + link1.CreateDocument(); + ps.Document.AutoFitToPagesWidth = 1; // Fit to page + ps.Document.ScaleFactor = 0.95F; + using (FileStream stream = new FileStream(Server.MapPath(@"~/App_Data/UploadTemp/" + chartFileName), FileMode.Create)) + { + link1.PrintingSystem.ExportToPdf(stream); + } + ps.Dispose(); + + // Unisce i pdf della griglia e del grafico + string finalPdfFinalName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - EsposizioneCertificati.pdf"; + PdfDocument one = new PdfDocument(); + one = PdfReader.Open(Server.MapPath(@"~/App_Data/UploadTemp/" + gridFileName), PdfDocumentOpenMode.Import); // pdf griglia + PdfDocument two = new PdfDocument(); + two = PdfReader.Open(Server.MapPath(@"~/App_Data/UploadTemp/" + chartFileName), PdfDocumentOpenMode.Import); // pdf grafico + PdfDocument three = new PdfDocument(); + using (PdfDocument outPdf = new PdfDocument()) + { + CommonClass.CopyPages(one, outPdf); + CommonClass.CopyPages(two, outPdf); + outPdf.Save(Server.MapPath(@"~/App_Data/UploadTemp/" + finalPdfFinalName)); + } + File.Delete(Server.MapPath(@"~/App_Data/UploadTemp/" + gridFileName)); + File.Delete(Server.MapPath(@"~/App_Data/UploadTemp/" + chartFileName)); + + // Restituisce pdf finale da scaricare + byte[] bytePDF = System.IO.File.ReadAllBytes(Server.MapPath(@"~/App_Data/UploadTemp/" + finalPdfFinalName)); + + // Restituisce pdf + Response.Clear(); + Response.ContentType = "application/pdf"; + Response.AddHeader("Content-Disposition", $"attachment; filename={finalPdfFinalName}"); + Response.BinaryWrite(bytePDF); + Response.Flush(); + Response.End(); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/EsposizioneCertificati.aspx.designer.cs b/OlympiaIntranet/EsposizioneCertificati.aspx.designer.cs new file mode 100644 index 0000000..ee4c930 --- /dev/null +++ b/OlympiaIntranet/EsposizioneCertificati.aspx.designer.cs @@ -0,0 +1,150 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class EsposizioneCertificati { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxLabel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel1; + + /// + /// ASPxPanel29 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel29; + + /// + /// txtPortafoglio control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox txtPortafoglio; + + /// + /// ASPxPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel1; + + /// + /// btnCaricaDati control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnCaricaDati; + + /// + /// ASPxPanel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel2; + + /// + /// btnEsportaExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnEsportaExcel; + + /// + /// ASPxPanel3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel3; + + /// + /// btnEsportaPdf control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnEsportaPdf; + + /// + /// gvEsposizioneCertificati control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvEsposizioneCertificati; + + /// + /// chart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.XtraCharts.Web.WebChartControl chart; + + /// + /// SqlDSEsposizioneCertificati control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSEsposizioneCertificati; + + /// + /// SqlDSEsposizioneCertificatiTOP10 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSEsposizioneCertificatiTOP10; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + } +} diff --git a/OlympiaIntranet/EsposizioneTitoli.aspx b/OlympiaIntranet/EsposizioneTitoli.aspx new file mode 100644 index 0000000..8cd431f --- /dev/null +++ b/OlympiaIntranet/EsposizioneTitoli.aspx @@ -0,0 +1,245 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EsposizioneTitoli.aspx.cs" Inherits="OlympiaIntranet.EsposizioneTitoli" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + <%# Eval("Titolo").ToString() %> + + + + + + + + + + + + +<%-- + + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + <%-- + + + +
+ + + + + + +
--%> + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + diff --git a/OlympiaIntranet/EsposizioneTitoli.aspx.cs b/OlympiaIntranet/EsposizioneTitoli.aspx.cs new file mode 100644 index 0000000..32443c4 --- /dev/null +++ b/OlympiaIntranet/EsposizioneTitoli.aspx.cs @@ -0,0 +1,229 @@ +using DevExpress.Data; +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + + +namespace OlympiaIntranet +{ + public partial class EsposizioneTitoli : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + else + { + string loggedUser = HttpContext.Current.User.Identity.Name; + + switch (loggedUser) + { + // Gestori + case "adonini": + gridLookupGestore.Value = "DONINI"; + gridLookupGestore.Enabled = false; + break; + case "sbettinelli": + gridLookupGestore.Value = "BETTINELLI"; + gridLookupGestore.Enabled = false; + break; + case "agamba": + gridLookupGestore.Value = "GAMBA"; + gridLookupGestore.Enabled = false; + break; + case "rcammarino": + gridLookupGestore.Value = "CAMMARINO"; + gridLookupGestore.Enabled = false; + break; + case "rtorre": + gridLookupGestore.Value = "TORRE"; + gridLookupGestore.Enabled = false; + break; + case "lbrambilla": + gridLookupGestore.Value = "BRAMBILLA"; + gridLookupGestore.Enabled = false; + break; + // consulenti + case "mbeltramelli": + gridLookupGestore.Value = "PISONI"; + gridLookupGestore.Enabled = false; + gridLookupConsulente.Value = "BELTRAMELLI"; + gridLookupConsulente.Enabled = false; + break; + case "fmucci": + gridLookupGestore.Value = "PISONI"; + gridLookupGestore.Enabled = false; + gridLookupConsulente.Value = "MUCCI"; + gridLookupConsulente.Enabled = false; + break; + // utenti + case "slopez": // nota: da sp GDN_GPM_Linee1 carica solo le linee "HIGH.RET.VAR","LOW.VOL.VAR" per slopez (02/03/2022) + gridLookupGestore.Value = "CAMMARINO"; + gridLookupGestore.Enabled = false; + gridLookupConsulente.Value = "CASTRICHELLA"; + gridLookupConsulente.Enabled = false; + break; + default: + gridLookupGestore.Enabled = true; // gli altri gestori abilitati a vedere tutto sono fcostalonga, ecanziani, fpisoni, glicciardello + break; + } + + Session["cod_ges"] = gridLookupGestore.Value; // serve per popolare gridlookupLinea!! + Session["user"] = loggedUser; // serve per popolare gridlookupLinea!! + } + + if (IsPostBack) // Rielabora il grafico altrimenti il print non la stampa. + { + CaricaEsposizioneTitoli(); + } + } + + protected void gridLookupGestore_ValueChanged(object sender, EventArgs e) + { + // ref: https://supportcenter.devexpress.com/ticket/details/q340370/aspxgridlookup-how-to-refresh-the-control-after-some-data-is-changed + // note: Per refreshare gridlookupLinea sulla base del valore di gridLookupGestore, salvo il valore gestore in una variabile di sessione Session["cod_ges"] + // e poi il refresh/rebind di SqlDSLinee verrà effettuato nell'evento lato client EndCallBack + + ASPxGridView grid = gridLookupGestore.GridView; + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + + if (objGestore != null) + { + Session["cod_ges"] = (string)objGestore; + } + + } + + protected void buttonEsposizioneTitoli_Click(object sender, EventArgs e) + { + CaricaEsposizioneTitoli(); + } + + private void CaricaEsposizioneTitoli() + { + ASPxGridView grid = gridLookupGestore.GridView; + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + grid = gridLookupLinea.GridView; + object objLinea = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Linea" }); + grid = gridLookupConsulente.GridView; + object objConsulente = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Consulente" }); + + if (!(objGestore != null && objLinea != null && objConsulente != null)) return; + + DataTable dtEsposizioneTitoli = CommonClass.execQuery_Datatable_Sql("GDN_EsposizioneTitoli8", Properties.Settings.Default.SqlConnection, (string)objGestore, (string)objConsulente, (string)objLinea, rgFiltriRanking.SelectedIndex); + gvEsposizioneTitoli.DataSource = dtEsposizioneTitoli; + gvEsposizioneTitoli.DataBind(); + if (gvEsposizioneTitoli.Columns["Titolo"] != null) + { + gvEsposizioneTitoli.GroupBy(gvEsposizioneTitoli.Columns["Titolo"]); + //ASPxSummaryItem summaryItem = new ASPxSummaryItem + //{ + // FieldName = "Controvalore", + // SummaryType = SummaryItemType.Sum, + // DisplayFormat = "{0}", + // ShowInColumn = "Titolo" + //}; + //gvEsposizioneTitoli.GroupSummary.Add(summaryItem); + //gvEsposizioneTitoli.SortBy(gvEsposizioneTitoli.Columns["CtvTitolo"], DevExpress.Data.ColumnSortOrder.Descending); + } + if (objLinea.ToString() != "-- TUTTI --" && objConsulente.ToString() != "-- TUTTI --") gvEsposizioneTitoli.SettingsBehavior.AutoExpandAllGroups = true; // autoespande tutti gruppi solo se non sono selezionati tutti nelle linee e nei consulenti + else gvEsposizioneTitoli.SettingsBehavior.AutoExpandAllGroups = false; + + // Visualizza Controvalori titoli + DataTable dtControvaloriTitoli = CommonClass.execQuery_Datatable_Sql("GDN_EsposizioneTitoli_Controvalori", Properties.Settings.Default.SqlConnection, (string)objGestore, (string)objConsulente, (string)objLinea, rgFiltriRanking.SelectedIndex); + gvControvaloreTitoli.DataSource = dtControvaloriTitoli; + gvControvaloreTitoli.DataBind(); + + } + + + + + protected void gvEsposizioneTitoli_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) + { + //if (e.DataColumn.FieldName == "CodiceTitolo") + //{ + // string htmlValue = CommonClass.ExecSql("GDN_EsposizioneTitoli_Rating1", e.GetValue("CodiceTitolo").ToString()); + // if (String.IsNullOrEmpty(htmlValue) == false) + // { + // e.Cell.Attributes.Add("onmouseover", string.Format("onShowPopup(event.x, event.y, '{0}')", htmlValue)); + // //e.Cell.Attributes.Add("onmouseover", string.Format("onShowPopupAtElement('{0}')", htmlValue)); + // } + + // else e.Cell.Attributes.Add("onmouseout", string.Format("onHidePopup();")); + //} + //else e.Cell.Attributes.Add("onmouseout", string.Format("onHidePopup();")); + } + + protected void gvEsposizioneTitoli_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) + { + // da rimettere!! + + //if (e.RowType == GridViewRowType.Group) + //{ + // //string htmlValue = CommonClass.ExecSql("GDN_EsposizioneTitoli_Rating3", e.GetValue("CodiceTitolo").ToString(),rgTipoRanking.SelectedIndex.ToString()); + // //string morningstarRankingHtml = CommonClass.ExecSql("GDN_EsposizioneTitoli_Rating3", e.GetValue("CodiceTitolo").ToString(), "1"); + // //if (String.IsNullOrEmpty(htmlValue) == false) + // //{ + // // string popupHeaderText = String.Empty; + // // if (rgTipoRanking.SelectedIndex == 0) popupHeaderText = "Ranking Tepilora"; + // // if (rgTipoRanking.SelectedIndex == 1) popupHeaderText = "Ranking MorningStar"; + // // e.Row.Attributes.Add("onclick", string.Format("onShowPopup('{0}','{1}')", htmlValue, popupHeaderText)); + // //} + // //else e.Row.Attributes.Add("onmouseout", string.Format("onHidePopup();")); + + // string tepiloraRankingHtml = CommonClass.ExecSql("GDN_EsposizioneTitoli_Rating4", e.GetValue("CodiceTitolo").ToString(), "0"); + // string morningstarRankingHtml = CommonClass.ExecSql("GDN_EsposizioneTitoli_Rating4", e.GetValue("CodiceTitolo").ToString(), "1"); + // if (String.IsNullOrEmpty(tepiloraRankingHtml) == false && String.IsNullOrEmpty(morningstarRankingHtml) == false) + // { + // //string popupHeaderText = $"Ranking {e.GetValue("CodiceTitolo").ToString()}"; + // e.Row.Attributes.Add("onclick", string.Format("onShowPopup1('{0}','{1}')", tepiloraRankingHtml, morningstarRankingHtml, "")); + // } + // else e.Row.Attributes.Add("onmouseout", string.Format("onHidePopup();")); + //} + } + + protected void buttonEsportaExcel_Click(object sender, EventArgs e) + { + gridviewExporter.ExportSelectedRowsOnly = false; + gridviewExporter.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - EsposizioneTitoli"; + XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.DataAware }; // in DataAware mode l'evento ASPxGridViewExporter_RenderBrick non viene eseguito!! + gridviewExporter.WriteXlsxToResponse(op); + } + + protected void btnRankingTitoli_Click(object sender, EventArgs e) + { + ASPxButton btn = sender as ASPxButton; + GridViewGroupRowTemplateContainer container = btn.NamingContainer as GridViewGroupRowTemplateContainer; + string titolo = container.GroupText.Substring(1, 5); + //string tepiloraRankingHtml = CommonClass.ExecSql("GDN_EsposizioneTitoli_Rating4", titolo, "0"); + //string morningstarRankingHtml = CommonClass.ExecSql("GDN_EsposizioneTitoli_Rating4", titolo, "1"); + //if (String.IsNullOrEmpty(tepiloraRankingHtml) == false && String.IsNullOrEmpty(morningstarRankingHtml) == false) + //{ + // ASPxlblTepilora.EncodeHtml = false; + // ASPxlblTepilora.Text = tepiloraRankingHtml; + // ASPxlblMorningstar.EncodeHtml = false; + // ASPxlblMorningstar.Text = morningstarRankingHtml; + // ASPxPopupControl1.ShowOnPageLoad = true; + //} + + // Tepilora rimosso dal 26/06/2023 su richiesta di Fede + string morningstarRankingHtml = CommonClass.ExecSql("GDN_EsposizioneTitoli_Rating4", titolo, "1"); + if (String.IsNullOrEmpty(morningstarRankingHtml) == false) + { + ASPxlblMorningstar.EncodeHtml = false; + ASPxlblMorningstar.Text = morningstarRankingHtml; + ASPxPopupControl1.ShowOnPageLoad = true; + } + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/EsposizioneTitoli.aspx.designer.cs b/OlympiaIntranet/EsposizioneTitoli.aspx.designer.cs new file mode 100644 index 0000000..e9def0e --- /dev/null +++ b/OlympiaIntranet/EsposizioneTitoli.aspx.designer.cs @@ -0,0 +1,177 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class EsposizioneTitoli { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// rgFiltriRanking control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRadioButtonList rgFiltriRanking; + + /// + /// gridLookupGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupGestore; + + /// + /// gridLookupConsulente control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupConsulente; + + /// + /// gridLookupLinea control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupLinea; + + /// + /// buttonEsposizioneTitoli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonEsposizioneTitoli; + + /// + /// buttonEsportaExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonEsportaExcel; + + /// + /// ASPxPageControl2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPageControl ASPxPageControl2; + + /// + /// gvEsposizioneTitoli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvEsposizioneTitoli; + + /// + /// ASPxPopupControl1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPopupControl ASPxPopupControl1; + + /// + /// ASPxPageControl1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPageControl ASPxPageControl1; + + /// + /// ASPxlblMorningstar control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxlblMorningstar; + + /// + /// gvControvaloreTitoli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvControvaloreTitoli; + + /// + /// gridviewExporter control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter gridviewExporter; + + /// + /// SqlDSGestori control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGestori; + + /// + /// SqlDSLinee control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSLinee; + + /// + /// SqlDSConsulenti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSConsulenti; + } +} diff --git a/OlympiaIntranet/EsposizioneTitoli_old.aspx b/OlympiaIntranet/EsposizioneTitoli_old.aspx new file mode 100644 index 0000000..9a40332 --- /dev/null +++ b/OlympiaIntranet/EsposizioneTitoli_old.aspx @@ -0,0 +1,150 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EsposizioneTitoli_old.aspx.cs" Inherits="OlympiaIntranet.EsposizioneTitoli_old" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + diff --git a/OlympiaIntranet/EsposizioneTitoli_old.aspx.cs b/OlympiaIntranet/EsposizioneTitoli_old.aspx.cs new file mode 100644 index 0000000..6113502 --- /dev/null +++ b/OlympiaIntranet/EsposizioneTitoli_old.aspx.cs @@ -0,0 +1,126 @@ +using DevExpress.Data; +using DevExpress.Web; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class EsposizioneTitoli_old : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + else + { + string loggedUser = HttpContext.Current.User.Identity.Name; + + switch (loggedUser) + { + // Gestori + case "sbettinelli": + gridLookupGestore.Value = "BETTINELLI"; + gridLookupGestore.Enabled = false; + break; + case "agamba": + gridLookupGestore.Value = "GAMBA"; + gridLookupGestore.Enabled = false; + break; + case "rcammarino": + gridLookupGestore.Value = "CAMMARINO"; + gridLookupGestore.Enabled = false; + break; + case "rtorre": + gridLookupGestore.Value = "TORRE"; + gridLookupGestore.Enabled = false; + break; + // consulenti + case "mbeltramelli": + gridLookupGestore.Value = "PISONI"; + gridLookupGestore.Enabled = false; + gridLookupConsulente.Value = "BELTRAMELLI"; + gridLookupConsulente.Enabled = false; + break; + case "fmucci": + gridLookupGestore.Value = "PISONI"; + gridLookupGestore.Enabled = false; + gridLookupConsulente.Value = "MUCCI"; + gridLookupConsulente.Enabled = false; + break; + default: + gridLookupGestore.Enabled = true; // gli altri gestori abilitati a vedere tutto sono fcostalonga, ecanziani, fpisoni, glicciardello + break; + } + + Session["cod_ges"] = gridLookupGestore.Value; // serve per popolare gridlookupLinea!! + } + + if (IsPostBack) // Rielabora il grafico altrimenti il print non la stampa. + { + CaricaEsposizioneTitoli(); + } + } + + protected void gridLookupGestore_ValueChanged(object sender, EventArgs e) + { + // ref: https://supportcenter.devexpress.com/ticket/details/q340370/aspxgridlookup-how-to-refresh-the-control-after-some-data-is-changed + // note: Per refreshare gridlookupLinea sulla base del valore di gridLookupGestore, salvo il valore gestore in una variabile di sessione Session["cod_ges"] + // e poi il refresh/rebind di SqlDSLinee verrà effettuato nell'evento lato client EndCallBack + + ASPxGridView grid = gridLookupGestore.GridView; + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + + if (objGestore != null) + { + Session["cod_ges"] = (string)objGestore; + } + + } + + protected void buttonEsposizioneTitoli_Click(object sender, EventArgs e) + { + CaricaEsposizioneTitoli(); + } + + private void CaricaEsposizioneTitoli() + { + ASPxGridView grid = gridLookupGestore.GridView; + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + grid = gridLookupLinea.GridView; + object objLinea = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Linea" }); + grid = gridLookupConsulente.GridView; + object objConsulente = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Consulente" }); + if (!(objGestore != null && objLinea != null && objConsulente != null)) return; + + DataTable dtEsposizioneTitoli = CommonClass.execQuery_Datatable_Sql("GDN_EsposizioneTitoli1", Properties.Settings.Default.SqlConnection, (string)objGestore, (string)objConsulente, (string)objLinea); + gvEsposizioneTitoli.DataSource = dtEsposizioneTitoli; + gvEsposizioneTitoli.DataBind(); + if (gvEsposizioneTitoli.Columns["Titolo"] != null) gvEsposizioneTitoli.GroupBy(gvEsposizioneTitoli.Columns["Titolo"]); + + } + + + + + protected void gvEsposizioneTitoli_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) + { + //string htmlValue = CommonClass.ExecSql("GDN_EsposizioneTitoli_Rating1", e.GetValue("CodiceTitolo").ToString()); + //e.Cell.Attributes.Add("onmouseover", string.Format("onShowPopup(event.x, event.y, '{0}')", htmlValue)); + } + + protected void gvEsposizioneTitoli_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) + { + if (e.RowType == GridViewRowType.Group) + { + e.Row.Attributes.Add("onmouseout", string.Format("onHidePopup();")); + } + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/EsposizioneTitoli_old.aspx.designer.cs b/OlympiaIntranet/EsposizioneTitoli_old.aspx.designer.cs new file mode 100644 index 0000000..0352047 --- /dev/null +++ b/OlympiaIntranet/EsposizioneTitoli_old.aspx.designer.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class EsposizioneTitoli_old { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// gridLookupGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupGestore; + + /// + /// gridLookupConsulente control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupConsulente; + + /// + /// gridLookupLinea control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupLinea; + + /// + /// buttonEsposizioneTitoli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonEsposizioneTitoli; + + /// + /// gvEsposizioneTitoli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvEsposizioneTitoli; + + /// + /// ASPxPopupControl1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPopupControl ASPxPopupControl1; + + /// + /// ASPxLabel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel1; + + /// + /// SqlDSGestori control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGestori; + + /// + /// SqlDSLinee control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSLinee; + + /// + /// SqlDSConsulenti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSConsulenti; + } +} diff --git a/OlympiaIntranet/Fondi.aspx b/OlympiaIntranet/Fondi.aspx new file mode 100644 index 0000000..88a77d1 --- /dev/null +++ b/OlympiaIntranet/Fondi.aspx @@ -0,0 +1,282 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Fondi.aspx.cs" Inherits="OlympiaIntranet.test" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + +
+ + diff --git a/OlympiaIntranet/Fondi.aspx.cs b/OlympiaIntranet/Fondi.aspx.cs new file mode 100644 index 0000000..8365c28 --- /dev/null +++ b/OlympiaIntranet/Fondi.aspx.cs @@ -0,0 +1,141 @@ +using ClosedXML.Excel; +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using MySqlConnector; +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data.SqlClient; + +namespace OlympiaIntranet +{ + public partial class test : System.Web.UI.Page + { + string queryLoadGrid = "GDN_ElencoFondi6"; + + protected void Page_Init(object sender, EventArgs e) + { + ASPxDateEdit1.Date = DateTime.Now.Date; + } + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + CommonClass.SetColumnFilterContains(gridviewFondi); + + // Assegna la variabile di sessione Switch ad ogni postback + if (IsPostBack==true) + { + Session["Switch"] = rblFiltro.SelectedIndex; + } + + // Se Overall Score norm distr > 50% allora colora verdino + GridViewFormatConditionHighlight Rule1 = new GridViewFormatConditionHighlight(); + Rule1.FieldName = "Overall Score (norm distr)"; + Rule1.Expression = "[Overall Score (norm distr)] >= 0.5"; + Rule1.Format = GridConditionHighlightFormat.LightGreenFill; + gridviewFondi.FormatConditions.Add(Rule1); + + // Se Overall Score norm distr < 50% allora colora rossastro + GridViewFormatConditionHighlight Rule2 = new GridViewFormatConditionHighlight(); + Rule2.FieldName = "Overall Score (norm distr)"; + Rule2.Expression = "[Overall Score (norm distr)] < 0.5"; + Rule2.Format = GridConditionHighlightFormat.LightRedFill; + gridviewFondi.FormatConditions.Add(Rule2); + + } + + + protected void rblFiltro_SelectedIndexChanged(object sender, EventArgs e) + { + Session["Switch"] = rblFiltro.SelectedIndex; + } + + protected void gridlookupCategorie_ValueChanged(object sender, EventArgs e) + { + object objCodice = gridlookupCategorie.GridView.GetRowValues(gridlookupCategorie.GridView.FocusedRowIndex, "Codice"); + if (String.IsNullOrEmpty(objCodice.ToString()) == false) Session["Codice"] = gridlookupCategorie.GridView.GetRowValues(gridlookupCategorie.GridView.FocusedRowIndex, "Codice"); + } + + protected void ASPxButton1_Click(object sender, EventArgs e) + { + + } + + protected void gridviewFondi_ContextMenuItemClick(object sender, ASPxGridViewContextMenuItemClickEventArgs e) + { + // RefreshData(); // ** da togliere x test!! + + // Nota: Se si aggiunge un menu contestuale , ricordarsi di modificare pure lato client la procedura OnContextMenuItemClick + var gridView = (ASPxGridView)sender; + + if (e.Item.Name == "scaricaFondoBBG") + { + string tickerBBG = (string)gridviewFondi.GetRowValues(gridView.FocusedRowIndex, "Bloomberg Ticker"); + string result = string.Empty; + try + { + result = CommonClass.CallWebApi(String.Format("https://api.smart-roots.net:4001/api/bbgFondi?tickerBBG={0}", tickerBBG)); + + if (result.IndexOf("[OK]") != -1) + { + string msg = string.Format("Dati fondo {0} scaricati da Bloomberg!",tickerBBG); + CommonClass.MessageBox(this, msg); + //RefreshData(); + + } + } + catch (Exception ex) + { + string error = string.Format("[{0}] - " + "[ERRORE] Eccezione rilevata in scarico dati fondi da bbg

Message: {1}
InnerException: {2}", DateTime.Now, ex.Message, ex.InnerException); + CommonClass.MessageBox(this, error); + } + } + } + + protected void gridviewFondi_FillContextMenuItems(object sender, ASPxGridViewContextMenuEventArgs e) + { + var gridView = (ASPxGridView)sender; + if (e.MenuType == GridViewContextMenuType.Rows) + { + // Crea Context Menu per scaricare dati fondi da bbg + var item = e.CreateItem("Scarica dati da BBG", "scaricaFondoBBG"); + item.BeginGroup = true; + item.Image.IconID = "miscellaneous_publish_16x16"; + e.Items.Add(item); + } + } + + //protected void gridviewFondi_CustomErrorText(object sender, ASPxGridViewCustomErrorTextEventArgs e) + //{ + // // https://supportcenter.devexpress.com/ticket/details/e59/how-to-show-an-error-message-when-a-record-cannot-be-deleted + // if (e.Exception is MyException) e.ErrorText = e.Exception.Message; + //} + + private void RefreshData() + { + SqlDSFondi.SelectCommand = queryLoadGrid; + SqlDSFondi.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; + Parameter p1 = SqlDSFondi.SelectParameters["Switch"]; + SqlDSFondi.SelectParameters.Remove(p1); + SqlDSFondi.SelectParameters.Add("Switch", Session["Switch"].ToString()); + Parameter p2 = SqlDSFondi.SelectParameters["Codice"]; + SqlDSFondi.SelectParameters.Remove(p2); + SqlDSFondi.SelectParameters.Add("Codice", Session["Codice"].ToString()); + gridviewFondi.DataBind(); + + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/Fondi.aspx.designer.cs b/OlympiaIntranet/Fondi.aspx.designer.cs new file mode 100644 index 0000000..e3c8458 --- /dev/null +++ b/OlympiaIntranet/Fondi.aspx.designer.cs @@ -0,0 +1,123 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class test { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// rblFiltro control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRadioButtonList rblFiltro; + + /// + /// ASPxPanel29 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel29; + + /// + /// gridlookupCategorie control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridlookupCategorie; + + /// + /// ASPxPanel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel2; + + /// + /// ASPxDateEdit1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxDateEdit ASPxDateEdit1; + + /// + /// ASPxPanel3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel3; + + /// + /// ASPxLoadData control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxLoadData; + + /// + /// ASPxPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel1; + + /// + /// gridviewFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gridviewFondi; + + /// + /// SqlDSCategorie control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSCategorie; + + /// + /// SqlDSFondi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSFondi; + } +} diff --git a/OlympiaIntranet/GPMAssetAllocation.aspx b/OlympiaIntranet/GPMAssetAllocation.aspx new file mode 100644 index 0000000..fb83331 --- /dev/null +++ b/OlympiaIntranet/GPMAssetAllocation.aspx @@ -0,0 +1,189 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GPMAssetAllocation.aspx.cs" Inherits="OlympiaIntranet.GPMAssetAllocation" %> + +<%@ Register Assembly="DevExpress.XtraCharts.v23.2.Web, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + +<%@ Register Assembly="DevExpress.XtraCharts.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts" TagPrefix="dx" %> + + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + +<%-- + + + + + + + + + + + + --%> +<%-- + + + + + + + + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + --%> + + + + + + + + + + + + +
+
+
+ + +
+
+ + + + + + + +<%-- + + + + + --%> +<%-- + + + + + --%> + + + +<%-- --%> + + + +
+ + + diff --git a/OlympiaIntranet/GPMAssetAllocation.aspx.cs b/OlympiaIntranet/GPMAssetAllocation.aspx.cs new file mode 100644 index 0000000..c7c8779 --- /dev/null +++ b/OlympiaIntranet/GPMAssetAllocation.aspx.cs @@ -0,0 +1,320 @@ +using DevExpress.Web; +using DevExpress.XtraCharts; +using DevExpress.XtraCharts.Native; +using DevExpress.XtraCharts.Web; +using DevExpress.Pdf; +using DevExpress.XtraPrinting; +using DevExpress.XtraGrid; +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + + public partial class GPMAssetAllocation : System.Web.UI.Page + { + string[] adminUser = new string[] { "fcostalonga", "ecanziani", "fpisoni", "glicciardello" }; + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + else + { + string loggedUser = HttpContext.Current.User.Identity.Name; + + if (adminUser.Contains(loggedUser) == true) { gridLookupGestore.Enabled = true; } + else + { + gridLookupGestore.Value = loggedUser.Substring(1).ToUpper(); + gridLookupGestore.Enabled = false; + } + + Session["cod_ges"] = gridLookupGestore.Value; // serve per popolare gridlookupLinea!! + //Session["cod_adv"] = gridLookupAdvisor.Value; // serve per popolare gridlookupLinea!! + Session["user"] = loggedUser; // serve per popolare gridlookupGestore!! + } + + if (IsPostBack) // Rielabora il grafico altrimenti il print non la stampa. + { + PlottaFullStackedBar(); + } + } + + protected void buttonGeneraGrafici_Click(object sender, EventArgs e) + { + PlottaFullStackedBar(); + } + + private void PlottaFullStackedBar() + { + // Carica dati in dtStackedBarsData + ASPxGridView grid = gridLookupGestore.GridView; + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + grid = gridLookupLinea.GridView; + object objLinea = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Linea" }); + + //grid = gridLookupAdvisor.GridView; + //object objAdvisor = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Advisor" }); + //if (!(objGestore != null && objLinea != null && objAdvisor != null)) return; + + if (!(objGestore != null && objLinea != null)) return; + DataTable dtStackedBarsData = CommonClass.execQuery_Datatable_Sql("GDN_GPMAssetAllocation_StackedBars2", + Properties.Settings.Default.SqlConnection, + (string)objGestore, + "", + (string)objLinea, + -1, + -1, + null, + "", + "", + null, + "" + ); + Session["dtStackedBarsData"] = dtStackedBarsData; + var listAssetClass = (from r in dtStackedBarsData.AsEnumerable() + group r by r["Asset Class"]); + + /* + WebChartControl fullStackedBarChart = new WebChartControl + { + DataSource = dtStackedBarsData, + RenderFormat = RenderFormat.Svg, + Height = 768, + Width = 1024, + EnableViewState = false, // necessario altrimenti non riaggiorna il grafico! + AppearanceName = "Gray" + }; + */ + + fullStackedBarChart.DataSource = dtStackedBarsData; + + // Cancella tutte le serie prima di plottare + fullStackedBarChart.Series.Clear(); + + // Cancella tutti i titoli della serie prima di plottare + fullStackedBarChart.Titles.Clear(); + + // Rimuove legenda aggiuntiva dei portafogli + fullStackedBarChart.Legends.Clear(); + + // Setta titolo del grafico + SettaTitoloGrafico(fullStackedBarChart); + + + foreach (var groupedAssetClass in listAssetClass) + { + string AssetClass = (string)groupedAssetClass.Key; + Series series = new Series(AssetClass, ViewType.FullStackedBar); + foreach (var seriesPoint in groupedAssetClass) + { + series.Points.Add(new SeriesPoint(seriesPoint["Codice Portafoglio"], seriesPoint["Esposizione"])); + } + series.ArgumentScaleType = ScaleType.Qualitative; + series.CrosshairContentShowMode = CrosshairContentShowMode.Default; + series.CrosshairLabelPattern = "{S}: {V:F2}%"; // ref link : https://docs.devexpress.com/CoreLibraries/DevExpress.XtraCharts.SeriesBase.CrosshairLabelPattern + + FullStackedBarSeriesView seriesView = (FullStackedBarSeriesView)series.View; + switch (AssetClass) + { + case "Fondi Bilanciati e Flessibili": + seriesView.Color = Color.LightCyan; + break; + case "Liquidità": + seriesView.Color = Color.LightGreen; + break; + case "Obbligazioni e Fondi Obbligazionari": + seriesView.Color = Color.LightSalmon; + break; + case "Prodotti Strutturati": + seriesView.Color = Color.MediumPurple; + break; + case "Azioni e Fondi Azionari": + seriesView.Color = Color.OrangeRed; + break; + case "Real Estate": + seriesView.Color = Color.Orange; + break; + default: + break; + } + seriesView.BarWidth = 0.4; + fullStackedBarChart.Series.Add(series); + } + + // Posiziona la legenda sopra e fuori dal grafico + // ref link: https://docs.devexpress.com/CoreLibraries/DevExpress.XtraCharts.LegendBase.AlignmentHorizontal + Legend legend = fullStackedBarChart.Legend; + legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; + legend.AlignmentVertical = LegendAlignmentVertical.TopOutside; + legend.MaxHorizontalPercentage = 100; + legend.Direction = LegendDirection.LeftToRight; + + // Hide the legend (if necessary). + fullStackedBarChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; + fullStackedBarChart.CrosshairOptions.GroupHeaderPattern = "Portafoglio: {A}"; + + // Add the chart to the form. + //this.Controls.Add(fullStackedBarChart); + + // Ruota etichetta sulle ascisse di 180 + XYDiagram diagram = (XYDiagram)fullStackedBarChart.Diagram; + if (diagram != null) + { + // Ruota etichetta sulle ascisse di 180 + diagram.AxisX.Label.Angle = -90; + diagram.AxisX.QualitativeScaleOptions.AutoGrid = false; // ref link: https://supportcenter.devexpress.com/ticket/details/t567170/how-to-force-displaying-all-axis-labels-when-the-qualitative-scale-type-is-used + diagram.AxisX.QualitativeScaleOptions.GridSpacing = 1; + + // Rimuove margini su asse Y + diagram.AxisY.WholeRange.AutoSideMargins = false; + diagram.AxisY.WholeRange.EndSideMargin = 0; + diagram.AxisY.WholeRange.StartSideMargin = 0; + + // Setta Ordinate (Asse Y) in percentuale + diagram.AxisY.Label.TextPattern = "{VP:P0}"; + + // Aggiunge legenda relativa ai ptf in basso + Legend ptfLegend = new Legend(); + fullStackedBarChart.Legends.Add(ptfLegend); + + ptfLegend.DockTarget = diagram.Panes.GetPaneByName("Default"); + ptfLegend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; + ptfLegend.AlignmentVertical = LegendAlignmentVertical.BottomOutside; + ptfLegend.ItemVisibilityMode = LegendItemVisibilityMode.AutoGeneratedAndCustom; + ptfLegend.MarkerMode = LegendMarkerMode.None; + ptfLegend.MaxHorizontalPercentage = 100; + ptfLegend.Direction = LegendDirection.LeftToRight; + + AggiungeItemLegend(ptfLegend, "(A) = ATTIVO"); + AggiungeItemLegend(ptfLegend, "(AR) = ATTIVO-RIC"); + AggiungeItemLegend(ptfLegend, "(V) = VIRTUALE"); + //AggiungeItemLegend(ptfLegend, "(P) = PENDING"); + //AggiungeItemLegend(ptfLegend, "(C) = IN CHIUSURA"); + } + + fullStackedBarChart.DataBind(); + } + + private void AggiungeItemLegend(Legend ptfLegend, string legendText) + { + CustomLegendItem item = new CustomLegendItem + { + Text = legendText + }; + ptfLegend.CustomItems.Add(item); + } + + private string TitoloFiltri() + { + string filtro = String.Empty; + if (String.IsNullOrEmpty(gridLookupGestore.Text) == true) { filtro += "Gestore: tutti "; } else { filtro += $"Gestore: {gridLookupGestore.Text} "; } + //if (String.IsNullOrEmpty(gridLookupAdvisor.Text) == true) { filtro += "Advisor: tutti "; } else { filtro += $"Advisor: {gridLookupAdvisor.Text} "; } + if (String.IsNullOrEmpty(gridLookupLinea.Text) == true) { filtro += "Linea: tutti "; } else { filtro += $"Linea: {gridLookupLinea.Text} "; } + return (filtro); + } + + private void SettaTitoloGrafico(WebChartControl chartControl) + { + // Create chart titles. + ChartTitle chartTitle1 = new ChartTitle(); + ChartTitle chartTitle2 = new ChartTitle(); + // Define the text for the titles. + chartTitle1.Text = "GPM ASSET ALLOCATION"; + + chartTitle2.Text = TitoloFiltri(); + + chartTitle2.WordWrap = true; + chartTitle2.MaxLineCount = 2; + + // Define the alignment of the titles. + chartTitle1.Alignment = StringAlignment.Center; + chartTitle2.Alignment = StringAlignment.Center; + + // Place the titles where it's required. + chartTitle1.Dock = ChartTitleDockStyle.Top; + chartTitle2.Dock = ChartTitleDockStyle.Top; + + // Customize a title's appearance. + chartTitle1.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle1.Font = new Font("Tahoma", 14, FontStyle.Bold); + chartTitle1.TextColor = Color.Blue; + chartTitle1.Indent = 10; + + // Customize a title's appearance. + chartTitle2.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle2.Font = new Font("Arial", 10, FontStyle.Bold); + chartTitle2.TextColor = Color.Black; + chartTitle2.Indent = 10; + + // Add the titles to the chart. + chartControl.Titles.AddRange(new ChartTitle[] { chartTitle1, chartTitle2 }); + } + + protected void buttonEsportaPdf_Click(object sender, EventArgs e) + { + + // Esporta grafico in pdf + //var ps = new PrintingSystem(); + //ps.PageSettings.Landscape = true; + //var link1 = new PrintableComponentLink(); + //fullStackedBarChart.DataBind(); + //link1.Component = ((IChartContainer)fullStackedBarChart).Chart; + //link1.Landscape = true; + //link1.PrintingSystem = ps; + //link1.CreateDocument(); + //ps.Document.AutoFitToPagesWidth = 1; // Fit to page + + //using (var stream = new MemoryStream()) + //{ + // link1.PrintingSystem.ExportToPdf(stream); + // Response.Clear(); + // Response.Buffer = false; + // Response.AppendHeader("Content-Type", "application/pdf"); + // Response.AppendHeader("Content-Transfer-Encoding", "binary"); + // Response.AppendHeader("Content-Disposition", $"attachment; filename=GPMAssetAllocation_{DateTime.Now.Date.ToString("yyyyMMdd")}.pdf"); + // Response.BinaryWrite(stream.GetBuffer()); + // Response.End(); + //} + //ps.Dispose(); + + } + + protected void gridLookupGestore_ValueChanged(object sender, EventArgs e) + { + // ref: https://supportcenter.devexpress.com/ticket/details/q340370/aspxgridlookup-how-to-refresh-the-control-after-some-data-is-changed + // note: Per refreshare gridlookupLinea sulla base del valore di gridLookupGestore, salvo il valore gestore in una variabile di sessione Session["cod_ges"] + // e poi il refresh/rebind di SqlDSLinee verrà effettuato nell'evento lato client EndCallBack + + ASPxGridView grid = gridLookupGestore.GridView; + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + + if (objGestore != null) + { + Session["cod_ges"] = (string)objGestore; + } + + } + + //protected void gridLookupAdvisor_ValueChanged(object sender, EventArgs e) + //{ + // ASPxGridView grid = gridLookupAdvisor.GridView; + // object objAdvisor = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Advisor" }); + + // if (objAdvisor != null) + // { + // Session["cod_adv"] = (string)objAdvisor; + // } + //} + } +} \ No newline at end of file diff --git a/OlympiaIntranet/GPMAssetAllocation.aspx.designer.cs b/OlympiaIntranet/GPMAssetAllocation.aspx.designer.cs new file mode 100644 index 0000000..1e474d8 --- /dev/null +++ b/OlympiaIntranet/GPMAssetAllocation.aspx.designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class GPMAssetAllocation + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// gridLookupGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupGestore; + + /// + /// gridLookupLinea control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupLinea; + + /// + /// buttonGeneraGrafici control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonGeneraGrafici; + + /// + /// buttonEsportaPdf control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonEsportaPdf; + + /// + /// fullStackedBarChart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.XtraCharts.Web.WebChartControl fullStackedBarChart; + + /// + /// SqlDSGestori control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGestori; + + /// + /// SqlDSLinee control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSLinee; + } +} diff --git a/OlympiaIntranet/GPMAssetAllocationAPI.aspx b/OlympiaIntranet/GPMAssetAllocationAPI.aspx new file mode 100644 index 0000000..a7fdc33 --- /dev/null +++ b/OlympiaIntranet/GPMAssetAllocationAPI.aspx @@ -0,0 +1,160 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GPMAssetAllocationAPI.aspx.cs" Inherits="OlympiaIntranet.GPMAssetAllocationAPI" %> +<%@ Register Assembly="DevExpress.XtraCharts.v23.2.Web, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.XtraCharts.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts" TagPrefix="dx" %> + + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + +<%-- + + + + + + + --%> + + + + + + +<%-- + + + + + + --%> + + + + + + +<%-- + + + + + + --%> + + + + + + + + + + + + + + + + + <%-- + + + --%> + + + + + + + + + + + + +
+
+
+ + +
+
+ +<%-- + + + + + + + + + + + + + + + + + --%> +
+ + + diff --git a/OlympiaIntranet/GPMAssetAllocationAPI.aspx.cs b/OlympiaIntranet/GPMAssetAllocationAPI.aspx.cs new file mode 100644 index 0000000..3205e57 --- /dev/null +++ b/OlympiaIntranet/GPMAssetAllocationAPI.aspx.cs @@ -0,0 +1,493 @@ +using DevExpress.Web; +using DevExpress.XtraCharts; +using DevExpress.XtraCharts.Native; +using DevExpress.XtraCharts.Web; +using DevExpress.Pdf; +using DevExpress.XtraPrinting; +using DevExpress.XtraGrid; +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + + public partial class GPMAssetAllocationAPI : System.Web.UI.Page + { + string cod_ges = String.Empty; + //string cod_adv = String.Empty; + string cod_lin = String.Empty; + + protected void Page_Load(object sender, EventArgs e) // Parametri input : cod_ges,cod_adv,cod_lin + { + // (@cod_ges AS VARCHAR(50), @cod_adv AS VARCHAR(50), @cod_lin AS VARCHAR(50)) + cod_ges = Request.QueryString["cod_ges"]; + //cod_adv = Request.QueryString["cod_adv"]; + cod_lin = Request.QueryString["cod_lin"]; + + //Session["cod_ges"] = cod_ges; // serve per popolare gridlookupLinea!! + + PlottaFullStackedBar(); + + buttonEsportaPdf_Click(this, null); + } + + protected void buttonGeneraGrafici_Click(object sender, EventArgs e) + { + PlottaFullStackedBar(); + } + + private void PlottaFullStackedBar() + { + //if (!(String.IsNullOrEmpty(cod_ges) == false && String.IsNullOrEmpty(cod_adv) == false && String.IsNullOrEmpty(cod_lin) == false)) return; + if (!(String.IsNullOrEmpty(cod_ges) == false && String.IsNullOrEmpty(cod_lin) == false)) return; + // Carica dati in dtStackedBarsData + + DataTable dtStackedBarsData = CommonClass.execQuery_Datatable_Sql("GDN_GPMAssetAllocation_StackedBars2", + Properties.Settings.Default.SqlConnection, + cod_ges, + "", + cod_lin, + -1, + -1, + null, + "", + "", + null, + ""); + Session["dtStackedBarsData"] = dtStackedBarsData; + var listAssetClass = (from r in dtStackedBarsData.AsEnumerable() + group r by r["Asset Class"]); + + + fullStackedBarChart.DataSource = dtStackedBarsData; + + // Cancella tutte le serie prima di plottare + fullStackedBarChart.Series.Clear(); + + // Cancella tutti i titoli della serie prima di plottare + fullStackedBarChart.Titles.Clear(); + + // Rimuove legenda aggiuntiva dei portafogli + fullStackedBarChart.Legends.Clear(); + + // Setta titolo del grafico + SettaTitoloGrafico(fullStackedBarChart); + + + foreach (var groupedAssetClass in listAssetClass) + { + string AssetClass = (string)groupedAssetClass.Key; + Series series = new Series(AssetClass, ViewType.FullStackedBar); + foreach (var seriesPoint in groupedAssetClass) + { + series.Points.Add(new SeriesPoint(seriesPoint["Codice Portafoglio"], seriesPoint["Esposizione"])); + } + series.ArgumentScaleType = ScaleType.Qualitative; + series.CrosshairContentShowMode = CrosshairContentShowMode.Default; + series.CrosshairLabelPattern = "{S}: {V:F2}%"; // ref link : https://docs.devexpress.com/CoreLibraries/DevExpress.XtraCharts.SeriesBase.CrosshairLabelPattern + + FullStackedBarSeriesView seriesView = (FullStackedBarSeriesView)series.View; + switch (AssetClass) + { + case "Fondi Bilanciati e Flessibili": + seriesView.Color = Color.LightCyan; + break; + case "Liquidità": + seriesView.Color = Color.LightGreen; + break; + case "Obbligazioni e Fondi Obbligazionari": + seriesView.Color = Color.LightSalmon; + break; + case "Prodotti Strutturati": + seriesView.Color = Color.MediumPurple; + break; + case "Azioni e Fondi Azionari": + seriesView.Color = Color.OrangeRed; + break; + case "Real Estate": + seriesView.Color = Color.Orange; + break; + default: + break; + } + seriesView.BarWidth = 0.4; + fullStackedBarChart.Series.Add(series); + } + + // Posiziona la legenda sopra e fuori dal grafico + // ref link: https://docs.devexpress.com/CoreLibraries/DevExpress.XtraCharts.LegendBase.AlignmentHorizontal + Legend legend = fullStackedBarChart.Legend; + legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; + legend.AlignmentVertical = LegendAlignmentVertical.TopOutside; + legend.MaxHorizontalPercentage = 100; + legend.Direction = LegendDirection.LeftToRight; + + // Hide the legend (if necessary). + fullStackedBarChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; + fullStackedBarChart.CrosshairOptions.GroupHeaderPattern = "Portafoglio: {A}"; + + // Add the chart to the form. + //this.Controls.Add(fullStackedBarChart); + + // Ruota etichetta sulle ascisse di 180 + XYDiagram diagram = (XYDiagram)fullStackedBarChart.Diagram; + if (diagram != null) + { + // Ruota etichetta sulle ascisse di 180 + diagram.AxisX.Label.Angle = -90; + diagram.AxisX.QualitativeScaleOptions.AutoGrid = false; // ref link: https://supportcenter.devexpress.com/ticket/details/t567170/how-to-force-displaying-all-axis-labels-when-the-qualitative-scale-type-is-used + diagram.AxisX.QualitativeScaleOptions.GridSpacing = 1; + + // Rimuove margini su asse Y + diagram.AxisY.WholeRange.AutoSideMargins = false; + diagram.AxisY.WholeRange.EndSideMargin = 0; + diagram.AxisY.WholeRange.StartSideMargin = 0; + + // Setta Ordinate (Asse Y) in percentuale + diagram.AxisY.Label.TextPattern = "{VP:P0}"; + + // Aggiunge legenda relativa ai ptf in basso + Legend ptfLegend = new Legend(); + fullStackedBarChart.Legends.Add(ptfLegend); + + ptfLegend.DockTarget = diagram.Panes.GetPaneByName("Default"); + ptfLegend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; + ptfLegend.AlignmentVertical = LegendAlignmentVertical.BottomOutside; + ptfLegend.ItemVisibilityMode = LegendItemVisibilityMode.AutoGeneratedAndCustom; + ptfLegend.MarkerMode = LegendMarkerMode.None; + ptfLegend.MaxHorizontalPercentage = 100; + ptfLegend.Direction = LegendDirection.LeftToRight; + + AggiungeItemLegend(ptfLegend, "(A) = ATTIVO"); + AggiungeItemLegend(ptfLegend, "(AR) = ATTIVO-RIC"); + AggiungeItemLegend(ptfLegend, "(V) = VIRTUALE"); + //AggiungeItemLegend(ptfLegend, "(P) = PENDING"); + //AggiungeItemLegend(ptfLegend, "(C) = IN CHIUSURA"); + } + + fullStackedBarChart.DataBind(); + } + + private void AggiungeItemLegend(Legend ptfLegend, string legendText) + { + CustomLegendItem item = new CustomLegendItem + { + Text = legendText + }; + ptfLegend.CustomItems.Add(item); + } + + private string TitoloFiltri() + { + string filtro = String.Empty; + if (String.IsNullOrEmpty(cod_ges) == true) { filtro += "Gestore: tutti "; } else { filtro += $"Gestore: {cod_ges} "; } + //if (String.IsNullOrEmpty(cod_adv) == true) { filtro += "Advisor: tutti "; } else { filtro += $"Advisor: {cod_adv} "; } + if (String.IsNullOrEmpty(cod_lin) == true) { filtro += "Linea: tutti "; } else { filtro += $"Linea: {cod_lin} "; } + return (filtro); + } + + private void SettaTitoloGrafico(WebChartControl chartControl) + { + // Create chart titles. + ChartTitle chartTitle1 = new ChartTitle(); + ChartTitle chartTitle2 = new ChartTitle(); + // Define the text for the titles. + chartTitle1.Text = "GPM ASSET ALLOCATION"; + + chartTitle2.Text = TitoloFiltri(); + + chartTitle2.WordWrap = true; + chartTitle2.MaxLineCount = 2; + + // Define the alignment of the titles. + chartTitle1.Alignment = StringAlignment.Center; + chartTitle2.Alignment = StringAlignment.Center; + + // Place the titles where it's required. + chartTitle1.Dock = ChartTitleDockStyle.Top; + chartTitle2.Dock = ChartTitleDockStyle.Top; + + // Customize a title's appearance. + chartTitle1.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle1.Font = new Font("Tahoma", 14, FontStyle.Bold); + chartTitle1.TextColor = Color.Blue; + chartTitle1.Indent = 10; + + // Customize a title's appearance. + chartTitle2.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle2.Font = new Font("Arial", 10, FontStyle.Bold); + chartTitle2.TextColor = Color.Black; + chartTitle2.Indent = 10; + + // Add the titles to the chart. + chartControl.Titles.AddRange(new ChartTitle[] { chartTitle1, chartTitle2 }); + } + + protected void buttonEsportaPdf_Click(object sender, EventArgs e) + { + + // Esporta grafico in pdf + var ps = new PrintingSystem(); + ps.PageSettings.Landscape = true; + var link1 = new PrintableComponentLink(); + fullStackedBarChart.DataBind(); + link1.Component = ((IChartContainer)fullStackedBarChart).Chart; + link1.Landscape = true; + link1.PrintingSystem = ps; + link1.CreateDocument(); + ps.Document.AutoFitToPagesWidth = 1; // Fit to page + + using (var stream = new MemoryStream()) + { + link1.PrintingSystem.ExportToPdf(stream); + Response.Clear(); + Response.Buffer = false; + Response.AppendHeader("Content-Type", "application/pdf"); + Response.AppendHeader("Content-Transfer-Encoding", "binary"); + Response.AppendHeader("Content-Disposition", $"attachment; filename=GPMAssetAllocation_{cod_ges}_{cod_lin}_{DateTime.Now.Date.ToString("yyyyMMdd")}.pdf"); + Response.BinaryWrite(stream.GetBuffer()); + Response.End(); + } + ps.Dispose(); + + } + } + //public partial class GPMAssetAllocationAPI : System.Web.UI.Page + //{ + // string cod_ges = String.Empty; + // string cod_pro = String.Empty; + // string cod_lin = String.Empty; + + // protected void Page_Load(object sender, EventArgs e) // Parametri input : cod_ges,cod_pro,cod_lin + // { + // // (@cod_ges AS VARCHAR(50), @cod_pro AS VARCHAR(50), @cod_lin AS VARCHAR(50)) + // cod_ges = Request.QueryString["cod_ges"]; + // cod_pro = Request.QueryString["cod_pro"]; + // cod_lin = Request.QueryString["cod_lin"]; + + // Session["cod_ges"] = cod_ges; // serve per popolare gridlookupLinea!! + + // PlottaFullStackedBar(); + + // buttonEsportaPdf_Click(this, null); + // } + + // protected void buttonGeneraGrafici_Click(object sender, EventArgs e) + // { + // PlottaFullStackedBar(); + // } + + // private void PlottaFullStackedBar() + // { + // if (!(String.IsNullOrEmpty(cod_ges) == false && String.IsNullOrEmpty(cod_pro) == false && String.IsNullOrEmpty(cod_lin) == false)) return; + + // // Carica dati in dtStackedBarsData + + // DataTable dtStackedBarsData = CommonClass.execQuery_Datatable_Sql("GDN_GPMAssetAllocation_StackedBars", Properties.Settings.Default.SqlConnection, cod_ges, cod_pro, cod_lin); + // Session["dtStackedBarsData"] = dtStackedBarsData; + // var listAssetClass = (from r in dtStackedBarsData.AsEnumerable() + // group r by r["Asset Class"]); + + + // fullStackedBarChart.DataSource = dtStackedBarsData; + + // // Cancella tutte le serie prima di plottare + // fullStackedBarChart.Series.Clear(); + + // // Cancella tutti i titoli della serie prima di plottare + // fullStackedBarChart.Titles.Clear(); + + // // Rimuove legenda aggiuntiva dei portafogli + // fullStackedBarChart.Legends.Clear(); + + // // Setta titolo del grafico + // SettaTitoloGrafico(fullStackedBarChart); + + + // foreach (var groupedAssetClass in listAssetClass) + // { + // string AssetClass = (string)groupedAssetClass.Key; + // Series series = new Series(AssetClass, ViewType.FullStackedBar); + // foreach (var seriesPoint in groupedAssetClass) + // { + // series.Points.Add(new SeriesPoint(seriesPoint["Codice Portafoglio"], seriesPoint["Esposizione"])); + // } + // series.ArgumentScaleType = ScaleType.Qualitative; + // series.CrosshairContentShowMode = CrosshairContentShowMode.Default; + // series.CrosshairLabelPattern = "{S}: {V:F2}%"; // ref link : https://docs.devexpress.com/CoreLibraries/DevExpress.XtraCharts.SeriesBase.CrosshairLabelPattern + + // FullStackedBarSeriesView seriesView = (FullStackedBarSeriesView)series.View; + // switch (AssetClass) + // { + // case "Fondi Bilanciati e Flessibili": + // seriesView.Color = Color.LightCyan; + // break; + // case "Liquidità": + // seriesView.Color = Color.LightGreen; + // break; + // case "Obbligazioni e Fondi Obbligazionari": + // seriesView.Color = Color.LightSalmon; + // break; + // case "Prodotti Strutturati": + // seriesView.Color = Color.MediumPurple; + // break; + // case "Azioni e Fondi Azionari": + // seriesView.Color = Color.OrangeRed; + // break; + // case "Real Estate": + // seriesView.Color = Color.Orange; + // break; + // default: + // break; + // } + // seriesView.BarWidth = 0.4; + // fullStackedBarChart.Series.Add(series); + // } + + // // Posiziona la legenda sopra e fuori dal grafico + // // ref link: https://docs.devexpress.com/CoreLibraries/DevExpress.XtraCharts.LegendBase.AlignmentHorizontal + // Legend legend = fullStackedBarChart.Legend; + // legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; + // legend.AlignmentVertical = LegendAlignmentVertical.TopOutside; + // legend.MaxHorizontalPercentage = 100; + // legend.Direction = LegendDirection.LeftToRight; + + // // Hide the legend (if necessary). + // fullStackedBarChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; + // fullStackedBarChart.CrosshairOptions.GroupHeaderPattern = "Portafoglio: {A}"; + + // // Add the chart to the form. + // //this.Controls.Add(fullStackedBarChart); + + // // Ruota etichetta sulle ascisse di 180 + // XYDiagram diagram = (XYDiagram)fullStackedBarChart.Diagram; + // if (diagram != null) + // { + // // Ruota etichetta sulle ascisse di 180 + // diagram.AxisX.Label.Angle = -90; + // diagram.AxisX.QualitativeScaleOptions.AutoGrid = false; // ref link: https://supportcenter.devexpress.com/ticket/details/t567170/how-to-force-displaying-all-axis-labels-when-the-qualitative-scale-type-is-used + // diagram.AxisX.QualitativeScaleOptions.GridSpacing = 1; + + // // Rimuove margini su asse Y + // diagram.AxisY.WholeRange.AutoSideMargins = false; + // diagram.AxisY.WholeRange.EndSideMargin = 0; + // diagram.AxisY.WholeRange.StartSideMargin = 0; + + // // Setta Ordinate (Asse Y) in percentuale + // diagram.AxisY.Label.TextPattern = "{VP:P0}"; + + // // Aggiunge legenda relativa ai ptf in basso + // Legend ptfLegend = new Legend(); + // fullStackedBarChart.Legends.Add(ptfLegend); + + // ptfLegend.DockTarget = diagram.Panes.GetPaneByName("Default"); + // ptfLegend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; + // ptfLegend.AlignmentVertical = LegendAlignmentVertical.BottomOutside; + // ptfLegend.ItemVisibilityMode = LegendItemVisibilityMode.AutoGeneratedAndCustom; + // ptfLegend.MarkerMode = LegendMarkerMode.None; + // ptfLegend.MaxHorizontalPercentage = 100; + // ptfLegend.Direction = LegendDirection.LeftToRight; + + // AggiungeItemLegend(ptfLegend, "(A) = ATTIVO"); + // //AggiungeItemLegend(ptfLegend, "(C) = IN CHIUSURA"); + // AggiungeItemLegend(ptfLegend, "(AR) = ATTIVO-RIC"); + // AggiungeItemLegend(ptfLegend, "(V) = VIRTUALE"); + // //AggiungeItemLegend(ptfLegend, "(P) = PENDING"); + // } + + // fullStackedBarChart.DataBind(); + // } + + // private void AggiungeItemLegend(Legend ptfLegend, string legendText) + // { + // CustomLegendItem item = new CustomLegendItem + // { + // Text = legendText + // }; + // ptfLegend.CustomItems.Add(item); + // } + + // private string TitoloFiltri() + // { + // string filtro = String.Empty; + // if (String.IsNullOrEmpty(cod_ges) == true) { filtro += "Gestore: tutti "; } else { filtro += $"Gestore: {cod_ges} "; } + // if (String.IsNullOrEmpty(cod_pro) == true) { filtro += "Consulente: tutti "; } else { filtro += $"Consulente: {cod_pro} "; } + // if (String.IsNullOrEmpty(cod_lin) == true) { filtro += "Linea: tutti "; } else { filtro += $"Linea: {cod_lin} "; } + // return (filtro); + // } + + // private void SettaTitoloGrafico(WebChartControl chartControl) + // { + // // Create chart titles. + // ChartTitle chartTitle1 = new ChartTitle(); + // ChartTitle chartTitle2 = new ChartTitle(); + // // Define the text for the titles. + // chartTitle1.Text = "GPM ASSET ALLOCATION"; + + // chartTitle2.Text = TitoloFiltri(); + + // chartTitle2.WordWrap = true; + // chartTitle2.MaxLineCount = 2; + + // // Define the alignment of the titles. + // chartTitle1.Alignment = StringAlignment.Center; + // chartTitle2.Alignment = StringAlignment.Center; + + // // Place the titles where it's required. + // chartTitle1.Dock = ChartTitleDockStyle.Top; + // chartTitle2.Dock = ChartTitleDockStyle.Top; + + // // Customize a title's appearance. + // chartTitle1.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + // chartTitle1.Font = new Font("Tahoma", 14, FontStyle.Bold); + // chartTitle1.TextColor = Color.Blue; + // chartTitle1.Indent = 10; + + // // Customize a title's appearance. + // chartTitle2.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + // chartTitle2.Font = new Font("Arial", 10, FontStyle.Bold); + // chartTitle2.TextColor = Color.Black; + // chartTitle2.Indent = 10; + + // // Add the titles to the chart. + // chartControl.Titles.AddRange(new ChartTitle[] { chartTitle1, chartTitle2 }); + // } + + // protected void buttonEsportaPdf_Click(object sender, EventArgs e) + // { + + // // Esporta grafico in pdf + // var ps = new PrintingSystem(); + // ps.PageSettings.Landscape = true; + // var link1 = new PrintableComponentLink(); + // fullStackedBarChart.DataBind(); + // link1.Component = ((IChartContainer)fullStackedBarChart).Chart; + // link1.Landscape = true; + // link1.PrintingSystem = ps; + // link1.CreateDocument(); + // ps.Document.AutoFitToPagesWidth = 1; // Fit to page + + // using (var stream = new MemoryStream()) + // { + // link1.PrintingSystem.ExportToPdf(stream); + // Response.Clear(); + // Response.Buffer = false; + // Response.AppendHeader("Content-Type", "application/pdf"); + // Response.AppendHeader("Content-Transfer-Encoding", "binary"); + // Response.AppendHeader("Content-Disposition", $"attachment; filename=GPMAssetAllocation_{cod_ges}_{cod_lin}_{DateTime.Now.Date.ToString("yyyyMMdd")}.pdf"); + // Response.BinaryWrite(stream.GetBuffer()); + // Response.End(); + // } + // ps.Dispose(); + + // } + //} +} \ No newline at end of file diff --git a/OlympiaIntranet/GPMAssetAllocationAPI.aspx.designer.cs b/OlympiaIntranet/GPMAssetAllocationAPI.aspx.designer.cs new file mode 100644 index 0000000..0b2f0dc --- /dev/null +++ b/OlympiaIntranet/GPMAssetAllocationAPI.aspx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class GPMAssetAllocationAPI { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// buttonGeneraGrafici control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonGeneraGrafici; + + /// + /// buttonEsportaPdf control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonEsportaPdf; + + /// + /// fullStackedBarChart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.XtraCharts.Web.WebChartControl fullStackedBarChart; + } +} diff --git a/OlympiaIntranet/GPMDispRendRisk.aspx b/OlympiaIntranet/GPMDispRendRisk.aspx new file mode 100644 index 0000000..138ad9a --- /dev/null +++ b/OlympiaIntranet/GPMDispRendRisk.aspx @@ -0,0 +1,167 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GPMDispRendRisk.aspx.cs" Inherits="OlympiaIntranet.GPMDispRendRisk" %> + +<%@ Register Assembly="DevExpress.XtraCharts.v23.2.Web, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + +<%-- + + + + + + + + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ + + + + + + + + +<%-- --%> + + + +<%-- + + + + + --%> +
+ + + diff --git a/OlympiaIntranet/GPMDispRendRisk.aspx.cs b/OlympiaIntranet/GPMDispRendRisk.aspx.cs new file mode 100644 index 0000000..4521116 --- /dev/null +++ b/OlympiaIntranet/GPMDispRendRisk.aspx.cs @@ -0,0 +1,341 @@ +using DevExpress.Web; +using DevExpress.XtraCharts; +using DevExpress.XtraCharts.Native; +using DevExpress.XtraCharts.Web; +using DevExpress.Pdf; +using DevExpress.XtraPrinting; +using DevExpress.XtraGrid; +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using DevExpress.Utils; +using DevExpress.XtraReports.UI; +using DevExpress.XtraReports.Web; + +namespace OlympiaIntranet +{ + + public partial class GPMDispRendRisk : System.Web.UI.Page + { + string[] adminUser = new string[] { "fcostalonga", "ecanziani", "fpisoni", "glicciardello" }; + protected void Page_Init(object sender, EventArgs e) + { + if (DateTime.Now.Date.DayOfWeek == DayOfWeek.Monday) dateEditDataIns.Date = DateTime.Now.Date.AddDays(-3); // se è lunedì prende 3 giorni prima ossia venerdì + else + if (DateTime.Now.Date.DayOfWeek == DayOfWeek.Sunday) dateEditDataIns.Date = DateTime.Now.Date.AddDays(-2); // se è lunedì prende 2 giorni prima ossia venerdì + else + dateEditDataIns.Date = DateTime.Now.Date.AddDays(-1); // .. in tutti gli altri casi cioè se è martedì,...sabato allora prende il giorno precedente + } + + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + else + { + string loggedUser = HttpContext.Current.User.Identity.Name; + + if (adminUser.Contains(loggedUser) == true) { gridLookupGestore.Enabled = true; } + else + { + gridLookupGestore.Value = loggedUser.Substring(1).ToUpper(); + gridLookupGestore.Enabled = false; + } + //switch (loggedUser) + //{ + // // Gestori + // case "sbettinelli": + // gridLookupGestore.Value = "BETTINELLI"; + // gridLookupGestore.Enabled = false; + // break; + // case "agamba": + // gridLookupGestore.Value = "GAMBA"; + // gridLookupGestore.Enabled = false; + // break; + // case "rcammarino": + // gridLookupGestore.Value = "CAMMARINO"; + // gridLookupGestore.Enabled = false; + // break; + // case "rtorre": + // gridLookupGestore.Value = "TORRE"; + // gridLookupGestore.Enabled = false; + // break; + // case "adonini": + // gridLookupGestore.Value = "DONINI"; + // gridLookupGestore.Enabled = false; + // break; + // case "lbrambilla": + // gridLookupGestore.Value = "BRAMBILLA"; + // gridLookupGestore.Enabled = false; + // break; + // default: + // gridLookupGestore.Enabled = true; // gli altri gestori abilitati a vedere tutto sono fcostalonga, ecanziani, fpisoni, glicciardello + // break; + //} + + Session["cod_ges"] = gridLookupGestore.Value; // serve per popolare gridlookupLinea!! + //Session["cod_adv"] = gridLookupAdvisor.Value; // serve per popolare gridlookupLinea!! + Session["user"] = loggedUser; // serve per popolare gridlookupGestore!! + } + + if (IsPostBack) // Rielabora il grafico altrimenti il print non la stampa. + { + PlottaPointChart(); + } + } + + private void PlottaPointChart() + { + // Carica dati in dtStackedBarsData + ASPxGridView grid = gridLookupGestore.GridView; + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + grid = gridLookupLinea.GridView; + object objLinea = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Linea" }); + //grid = gridLookupAdvisor.GridView; + //object objAdvisor = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Advisor" }); + //if (!(objGestore != null && objLinea != null && objAdvisor != null)) return; + if (!(objGestore != null && objLinea != null)) return; + + // nota: esiste pure GDN_GPMDispRendRisk_PointCharts1 e GDN_GPM_Gestori1 perchè Filippo voleva avere l'opzione -- TUTTI -- sui gestori, ma poi il grafico si vedeva tutto incasinato e abbiamo desistito (07/06/2022) + DataTable dtPointsChartData = CommonClass.execQuery_Datatable_Sql("GDN_GPMDispRendRisk_PointCharts2", + Properties.Settings.Default.SqlConnection, + (string)objGestore, + "", + (string)objLinea + , + -1, + -1, + dateEditDataIns.Date, + "", + "", + null, + ""); + + Session["dtPointsChartData"] = dtPointsChartData; + + pointChart.DataSource = dtPointsChartData; + + // Cancella tutte le serie prima di plottare + pointChart.Series.Clear(); + + // Cancella tutti i titoli della serie prima di plottare + pointChart.Titles.Clear(); + + // Rimuove legenda aggiuntiva dei portafogli + pointChart.Legends.Clear(); + + // Setta titolo del grafico + SettaTitoloGrafico(pointChart); + + string seriesName = $"{(string)objLinea}"; + Series series = new Series(seriesName, ViewType.Point); + series.ArgumentScaleType = ScaleType.Numerical; + series.LabelsVisibility = DefaultBoolean.True; + series.Label.TextPattern = "{HINT}"; + series.ArgumentDataMember = "VaR Medio 95"; + series.ValueDataMembers[0] = "Performance YTD"; + series.ShowInLegend = false; + series.CrosshairContentShowMode = CrosshairContentShowMode.Label; + //series.CrosshairHighlightPoints = DefaultBoolean.True; // non funziona + //pointChart.CrosshairOptions.HighlightPoints = true; // non funziona + + (series.Label as PointSeriesLabel).ResolveOverlappingMode = ResolveOverlappingMode.JustifyAroundPoint; + foreach (DataRow row in dtPointsChartData.Rows) + { + if ( + ((string)objLinea != "-- TUTTI --") // E' selezionata la singola linea allora deve visualizzare il singolo punto limite var che è uguale per tutti i ptf. + || // oppure + ((string)objLinea == "-- TUTTI --" && row["Codice Portafoglio"].ToString() != "LIMITE VAR") // Sono selezionate tutte le linee ma viene escluso ptf=LIMITE VAR per plottare tutti i punti + ) + { + SeriesPoint sp = new SeriesPoint(row["VaR Medio 95"], row["Performance YTD"]); + sp.Tag = new { Portafoglio = $"Portafoglio: {row["Codice Portafoglio"]}", Cliente = $"Cliente: {row["Cliente"]}" }; // link https://supportcenter.devexpress.com/ticket/details/t757258/how-to-display-custom-data-in-the-crosshair-label-text + //if (row["Codice Portafoglio"].ToString() != "LIMITE VAR") sp.ToolTipHint = string.Format("{0} - {1}", row["Codice Portafoglio"], row["Cliente"]); // tolto su richiesta di Filippo e spostato in proprietà CrosshairLabelPattern + series.Points.Add(sp); + } + //if ((string)objLinea == "-- TUTTI --" && row["Codice Portafoglio"].ToString() != "LIMITE VAR") // se sono selezionate tutte le linee allora non deve visualizzare punto limite var perchè ce ne sarebbero più di uno + //{ + // SeriesPoint sp = new SeriesPoint(row["VaR Medio 95"], row["Performance YTD"]); + // sp.Tag = new { Portafoglio = $"Portafoglio: {row["Codice Portafoglio"]}", Cliente = $"Cliente: {row["Cliente"]}" }; // link https://supportcenter.devexpress.com/ticket/details/t757258/how-to-display-custom-data-in-the-crosshair-label-text + // series.Points.Add(sp); + //} + } + series.CrosshairLabelPattern = "{Portafoglio} \r\n {Cliente} \r\n Var Medio 95%: {A:F2}% \r\n Perf YTD: {V:F2}%"; // ref link : https://docs.devexpress.com/CoreLibraries/DevExpress.XtraCharts.SeriesBase.CrosshairLabelPattern + pointChart.Series.Add(series); + + XYDiagram diagram = (XYDiagram)pointChart.Diagram; + if (diagram != null) + { + diagram.AxisX.Title.Text = "VAR MEDIO 95%"; + diagram.AxisX.Title.Visibility = DefaultBoolean.True; + diagram.AxisY.Title.Text = "PERFORMANCE YTD"; + diagram.AxisY.Title.Visibility = DefaultBoolean.True; + + // Setta var max sul grafico (plottato solo se una linea è selezionata) + SettaVarMax(pointChart, dtPointsChartData, (string)objLinea); + } + } + + private void SettaVarMax(WebChartControl pointChart, DataTable dtPointsChartData, string Linea) + { + // Cancella eventuali precedenti linee verticali + XYDiagram diagram = (XYDiagram)pointChart.Diagram; + diagram.AxisX.ConstantLines.Clear(); + + // Se è selezionata una singola linea, allora rileva il limite var prendendo il primo ptf in dtPointsChartData e leggendo il valore da tabraplim + if (Linea != "-- TUTTI --") + { + double limiteVar = (from r in dtPointsChartData.AsEnumerable() + select Convert.ToDouble(r["LimiteVar"])).FirstOrDefault(); + ConstantLine cl1 = new ConstantLine("Limite VaR"); + + cl1.AxisValue = limiteVar; + cl1.Visible = true; + cl1.ShowBehind = false; + cl1.Color = System.Drawing.Color.Red; + cl1.LineStyle.DashStyle = DashStyle.Solid; + cl1.LineStyle.Thickness = 2; + cl1.ShowInLegend = false; + + diagram.AxisX.ConstantLines.Add(cl1); + + // Define the whole range for the X-axis. + //diagram.AxisX.WholeRange.Auto = false; + //diagram.AxisX.WholeRange.SetMinMaxValues(0, limiteVar * 0.2); + } + } + + private void SettaTitoloGrafico(WebChartControl chartControl) + { + // Create chart titles. + ChartTitle chartTitle1 = new ChartTitle(); + ChartTitle chartTitle2 = new ChartTitle(); + // Define the text for the titles. + chartTitle1.Text = "GPM DISPERSION RISK / REND"; + + chartTitle2.Text = TitoloFiltri(); + + chartTitle2.WordWrap = true; + chartTitle2.MaxLineCount = 2; + + // Define the alignment of the titles. + chartTitle1.Alignment = StringAlignment.Center; + chartTitle2.Alignment = StringAlignment.Center; + + // Place the titles where it's required. + chartTitle1.Dock = ChartTitleDockStyle.Top; + chartTitle2.Dock = ChartTitleDockStyle.Top; + + // Customize a title's appearance. + chartTitle1.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle1.Font = new Font("Tahoma", 14, FontStyle.Bold); + chartTitle1.TextColor = Color.Blue; + chartTitle1.Indent = 10; + + // Customize a title's appearance. + chartTitle2.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle2.Font = new Font("Arial", 10, FontStyle.Bold); + chartTitle2.TextColor = Color.Black; + chartTitle2.Indent = 10; + + // Add the titles to the chart. + chartControl.Titles.AddRange(new ChartTitle[] { chartTitle1, chartTitle2 }); + } + private string TitoloFiltri() + { + string filtro = String.Empty; + if (String.IsNullOrEmpty(gridLookupGestore.Text) == true) { filtro += "Gestore: tutti "; } else { filtro += $"Gestore: {gridLookupGestore.Text} "; } + //if (String.IsNullOrEmpty(gridLookupAdvisor.Text) == true) { filtro += "Advisor: tutti "; } else { filtro += $"Advisor: {gridLookupAdvisor.Text} "; } + if (String.IsNullOrEmpty(gridLookupLinea.Text) == true) { filtro += "Linea: tutti "; } else { filtro += $"Linea: {gridLookupLinea.Text} "; } + return (filtro); + } + + protected void buttonGeneraGrafici_Click(object sender, EventArgs e) + { + PlottaPointChart(); + } + + protected void buttonEsportaPdf_Click(object sender, EventArgs e) + { + /* + // Esporta grafico in pdf + var ps = new PrintingSystem(); + ps.PageSettings.Landscape = true; + var link1 = new PrintableComponentLink(); + pointChart.DataBind(); + + link1.Component = ((IChartContainer)pointChart).Chart; + link1.Landscape = true; + link1.PrintingSystem = ps; + link1.CreateDocument(); + ps.Document.AutoFitToPagesWidth = 1; // Fit to page + + using (var stream = new MemoryStream()) + { + link1.PrintingSystem.ExportToPdf(stream); + Response.Clear(); + Response.Buffer = false; + Response.AppendHeader("Content-Type", "application/pdf"); + Response.AppendHeader("Content-Transfer-Encoding", "binary"); + Response.AppendHeader("Content-Disposition", $"attachment; filename=GPMDispRendRisk_{DateTime.Now.Date.ToString("yyyyMMdd")}.pdf"); + Response.BinaryWrite(stream.GetBuffer()); + Response.End(); + } + ps.Dispose(); + + */ + + /* + XtraReport r = new XtraReport(); + r.Bands.Add(new DetailBand()); + r.Bands[BandKind.Detail].Height = Convert.ToInt32(pointChart.Height.Value * pointChart.Width.Value / (r.PageWidth - r.Margins.Left - r.Margins.Right)); + XRChart chart = new XRChart(); + ((IChartContainer)chart).Assign(((IChartContainer)pointChart).Chart); + r.Bands[BandKind.Detail].Controls.Add(chart); + chart.Size = new Size(r.PageWidth - r.Margins.Left - r.Margins.Right, r.Bands[BandKind.Detail].Height); + + ReportViewer rv = new ReportViewer(); + rv.Report = r; + r.ExportOptions.Pdf.ShowPrintDialogOnOpen = true; + r.Landscape = true; + rv.WritePdfTo(this.Response); + */ + } + + protected void gridLookupGestore_ValueChanged(object sender, EventArgs e) + { + // ref: https://supportcenter.devexpress.com/ticket/details/q340370/aspxgridlookup-how-to-refresh-the-control-after-some-data-is-changed + // note: Per refreshare gridlookupLinea e gridlookupAdvisor sulla base del valore di gridLookupGestore, salvo il valore gestore in una variabile di sessione Session["cod_ges"] + // e poi il refresh/rebind di SqlDSLinee e SqlDSAdvisor verrà effettuato nell'evento lato client EndCallBack + + ASPxGridView grid = gridLookupGestore.GridView; + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + + if (objGestore != null) + { + Session["cod_ges"] = (string)objGestore; + } + + } + + //protected void gridLookupAdvisor_ValueChanged(object sender, EventArgs e) + //{ + // ASPxGridView grid = gridLookupAdvisor.GridView; + // object objAdvisor = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Advisor" }); + + // if (objAdvisor != null) + // { + // Session["cod_adv"] = (string)objAdvisor; + // } + //} + } +} \ No newline at end of file diff --git a/OlympiaIntranet/GPMDispRendRisk.aspx.designer.cs b/OlympiaIntranet/GPMDispRendRisk.aspx.designer.cs new file mode 100644 index 0000000..b0aa52e --- /dev/null +++ b/OlympiaIntranet/GPMDispRendRisk.aspx.designer.cs @@ -0,0 +1,107 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class GPMDispRendRisk + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// gridLookupGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupGestore; + + /// + /// gridLookupLinea control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupLinea; + + /// + /// dateEditDataIns control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxDateEdit dateEditDataIns; + + /// + /// buttonGeneraGrafici control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonGeneraGrafici; + + /// + /// buttonEsportaPdf control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonEsportaPdf; + + /// + /// pointChart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.XtraCharts.Web.WebChartControl pointChart; + + /// + /// SqlDSGestori control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGestori; + + /// + /// SqlDSLinee control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSLinee; + } +} diff --git a/OlympiaIntranet/GPMDispRendRiskAPI.aspx b/OlympiaIntranet/GPMDispRendRiskAPI.aspx new file mode 100644 index 0000000..cd8dc85 --- /dev/null +++ b/OlympiaIntranet/GPMDispRendRiskAPI.aspx @@ -0,0 +1,164 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GPMDispRendRiskAPI.aspx.cs" Inherits="OlympiaIntranet.GPMDispRendRiskAPI" %> + +<%@ Register Assembly="DevExpress.XtraCharts.v23.2.Web, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + +<%-- + + + + + + + --%> + + + + + + +<%-- + + + + + + --%> + + + + + + +<%-- + + + + + + --%> + + + + + + +<%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+<%-- + + + + + + + + + + + + + + + + + --%> +
+ + + + diff --git a/OlympiaIntranet/GPMDispRendRiskAPI.aspx.cs b/OlympiaIntranet/GPMDispRendRiskAPI.aspx.cs new file mode 100644 index 0000000..5d286a3 --- /dev/null +++ b/OlympiaIntranet/GPMDispRendRiskAPI.aspx.cs @@ -0,0 +1,540 @@ +using DevExpress.Web; +using DevExpress.XtraCharts; +using DevExpress.XtraCharts.Native; +using DevExpress.XtraCharts.Web; +using DevExpress.Pdf; +using DevExpress.XtraPrinting; +using DevExpress.XtraGrid; +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using DevExpress.Utils; +using DevExpress.XtraReports.UI; +using DevExpress.XtraReports.Web; +using System.Windows.Forms; + +namespace OlympiaIntranet +{ + public partial class GPMDispRendRiskAPI : System.Web.UI.Page + { + string cod_ges = String.Empty; + //string cod_adv = String.Empty; + string cod_lin = String.Empty; + + protected void Page_Load(object sender, EventArgs e) + { + cod_ges = Request.QueryString["cod_ges"]; + //cod_adv = Request.QueryString["cod_adv"]; + cod_lin = Request.QueryString["cod_lin"]; + + //Session["cod_ges"] = cod_ges; // serve per popolare gridlookupLinea!! + //if (String.IsNullOrEmpty(cod_ges) == true || String.IsNullOrEmpty(cod_adv) == true || String.IsNullOrEmpty(cod_lin) == true) + //{ + // CommonClass.MessageBox(this, "Parametri mancanti ricontrollare!"); + // return; + //} + if (String.IsNullOrEmpty(cod_ges) == true || String.IsNullOrEmpty(cod_lin) == true) + { + CommonClass.MessageBox(this, "Parametri mancanti ricontrollare!"); + return; + } + + PlottaPointChart(); + + buttonEsportaPdf_Click(this, null); + } + + private void PlottaPointChart() + { + + //if (!(String.IsNullOrEmpty(cod_ges) == false && String.IsNullOrEmpty(cod_adv) == false && String.IsNullOrEmpty(cod_lin) == false)) return; + if (!(String.IsNullOrEmpty(cod_ges) == false && String.IsNullOrEmpty(cod_lin) == false)) return; + + // nota: esiste pure GDN_GPMDispRendRisk_PointCharts1 e GDN_GPM_Gestori1 perchè Filippo voleva avere l'opzione -- TUTTI -- sui gestori, ma poi il grafico si vedeva tutto incasinato e abbiamo desistito (07/06/2022) + DataTable dtPointsChartData = CommonClass.execQuery_Datatable_Sql("GDN_GPMDispRendRisk_PointCharts2", + Properties.Settings.Default.SqlConnection, + cod_ges, + "", + cod_lin, + -1, + -1, + CommonClass.AddBusinessDays(DateTime.Today.Date, -1), // prende l'ultimo giorno lavorativo del mese precedente + "", + "", + null, + ""); + Session["dtPointsChartData"] = dtPointsChartData; + + //var listAssetClass = (from r in dtPointsChartData.AsEnumerable() + // select r); + + + pointChart.DataSource = dtPointsChartData; + + // Cancella tutte le serie prima di plottare + pointChart.Series.Clear(); + + // Cancella tutti i titoli della serie prima di plottare + pointChart.Titles.Clear(); + + // Rimuove legenda aggiuntiva dei portafogli + pointChart.Legends.Clear(); + + // Setta titolo del grafico + SettaTitoloGrafico(pointChart); + + string seriesName = $"{cod_lin}"; + Series series = new Series(seriesName, ViewType.Point); + series.ArgumentScaleType = ScaleType.Numerical; + series.LabelsVisibility = DefaultBoolean.True; + series.Label.TextPattern = "{HINT}"; + series.ArgumentDataMember = "VaR Medio 95"; + series.ValueDataMembers[0] = "Performance YTD"; + series.ShowInLegend = false; + series.CrosshairContentShowMode = CrosshairContentShowMode.Default; + series.CrosshairLabelPattern = "Var Medio 95%: {A:F2}% \r\n Perf YTD: {V:F2}%"; // ref link : https://docs.devexpress.com/CoreLibraries/DevExpress.XtraCharts.SeriesBase.CrosshairLabelPattern + (series.Label as PointSeriesLabel).ResolveOverlappingMode = ResolveOverlappingMode.JustifyAroundPoint; + foreach (DataRow row in dtPointsChartData.Rows) + { + SeriesPoint sp = new SeriesPoint(row["VaR Medio 95"], row["Performance YTD"]); + if (row["Codice Portafoglio"].ToString() != "LIMITE VAR") sp.ToolTipHint = $"{row["Codice Portafoglio"]} - {row["Cliente"]}"; + series.Points.Add(sp); + } + + pointChart.Series.Add(series); + + XYDiagram diagram = (XYDiagram)pointChart.Diagram; + if (diagram != null) + { + diagram.AxisX.Title.Text = "VAR MEDIO 95%"; + diagram.AxisX.Title.Visibility = DefaultBoolean.True; + diagram.AxisY.Title.Text = "PERFORMANCE YTD"; + diagram.AxisY.Title.Visibility = DefaultBoolean.True; + + // Setta var max sul grafico (plottato solo se una linea è selezionata) + SettaVarMax(pointChart, dtPointsChartData, cod_lin); + } + } + + private void SettaVarMax(WebChartControl pointChart, DataTable dtPointsChartData, string Linea) + { + // Cancella eventuali precedenti linee verticali + XYDiagram diagram = (XYDiagram)pointChart.Diagram; + diagram.AxisX.ConstantLines.Clear(); + + // Se è selezionata una singola linea, allora rileva il limite var prendendo il primo ptf in dtPointsChartData e leggendo il valore da tabraplim + if (Linea != "-- TUTTI --") + { + double limiteVar = (from r in dtPointsChartData.AsEnumerable() + select Convert.ToDouble(r["LimiteVar"])).FirstOrDefault(); + ConstantLine cl1 = new ConstantLine("Limite VaR"); + + cl1.AxisValue = limiteVar; + cl1.Visible = true; + cl1.ShowBehind = false; + cl1.Color = System.Drawing.Color.Red; + cl1.LineStyle.DashStyle = DashStyle.Solid; + cl1.LineStyle.Thickness = 2; + cl1.ShowInLegend = false; + + diagram.AxisX.ConstantLines.Add(cl1); + + // Define the whole range for the X-axis. + //diagram.AxisX.WholeRange.Auto = false; + //diagram.AxisX.WholeRange.SetMinMaxValues(0, limiteVar * 0.2); + } + } + + private void SettaTitoloGrafico(WebChartControl chartControl) + { + // Create chart titles. + ChartTitle chartTitle1 = new ChartTitle(); + ChartTitle chartTitle2 = new ChartTitle(); + // Define the text for the titles. + chartTitle1.Text = "GPM DISPERSION RISK / REND"; + + chartTitle2.Text = TitoloFiltri(); + + chartTitle2.WordWrap = true; + chartTitle2.MaxLineCount = 2; + + // Define the alignment of the titles. + chartTitle1.Alignment = StringAlignment.Center; + chartTitle2.Alignment = StringAlignment.Center; + + // Place the titles where it's required. + chartTitle1.Dock = ChartTitleDockStyle.Top; + chartTitle2.Dock = ChartTitleDockStyle.Top; + + // Customize a title's appearance. + chartTitle1.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle1.Font = new Font("Tahoma", 14, FontStyle.Bold); + chartTitle1.TextColor = Color.Blue; + chartTitle1.Indent = 10; + + // Customize a title's appearance. + chartTitle2.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle2.Font = new Font("Arial", 10, FontStyle.Bold); + chartTitle2.TextColor = Color.Black; + chartTitle2.Indent = 10; + + // Add the titles to the chart. + chartControl.Titles.AddRange(new ChartTitle[] { chartTitle1, chartTitle2 }); + } + private string TitoloFiltri() + { + string filtro = String.Empty; + if (String.IsNullOrEmpty(cod_ges) == true) { filtro += "Gestore: tutti "; } else { filtro += $"Gestore: {cod_ges} "; } + //if (String.IsNullOrEmpty(cod_adv) == true) { filtro += "Advisor: tutti "; } else { filtro += $"Advisor: {cod_adv} "; } + if (String.IsNullOrEmpty(cod_lin) == true) { filtro += "Linea: tutti "; } else { filtro += $"Linea: {cod_lin} "; } + return (filtro); + } + + protected void buttonGeneraGrafici_Click(object sender, EventArgs e) + { + PlottaPointChart(); + } + + protected void buttonEsportaPdf_Click(object sender, EventArgs e) + { + + // Esporta grafico in pdf + /* + var ps = new PrintingSystem(); + ps.PageSettings.Landscape = true; + var link1 = new PrintableComponentLink(); + pointChart.DataBind(); + + link1.Component = ((IChartContainer)pointChart).Chart; + link1.Landscape = true; + link1.PrintingSystem = ps; + link1.CreateDocument(); + ps.Document.AutoFitToPagesWidth = 1; // Fit to page + + using (var stream = new MemoryStream()) + { + link1.PrintingSystem.ExportToPdf(stream); + Response.Clear(); + Response.Buffer = false; + Response.AppendHeader("Content-Type", "application/pdf"); + Response.AppendHeader("Content-Transfer-Encoding", "binary"); + Response.AppendHeader("Content-Disposition", $"attachment; filename=GPMDispRendRisk_{DateTime.Now.Date.ToString("yyyyMMdd")}.pdf"); + Response.BinaryWrite(stream.GetBuffer()); + Response.End(); + } + ps.Dispose(); + */ + + + /* + XtraReport r = new XtraReport(); + r.Bands.Add(new DetailBand()); + r.Bands[BandKind.Detail].Height = Convert.ToInt32(pointChart.Height.Value * pointChart.Width.Value / (r.PageWidth - r.Margins.Left - r.Margins.Right)); + XRChart chart = new XRChart(); + ((IChartContainer)chart).Assign(((IChartContainer)pointChart).Chart); + r.Bands[BandKind.Detail].Controls.Add(chart); + chart.Size = new Size(r.PageWidth - r.Margins.Left - r.Margins.Right, r.Bands[BandKind.Detail].Height); + + ReportViewer rv = new ReportViewer(); + rv.Report = r; + r.ExportOptions.Pdf.ShowPrintDialogOnOpen = false; + r.Landscape = true; + rv.WritePdfTo(this.Response); + */ + + XtraReport r = new XtraReport(); + r.Bands.Add(new DetailBand()); + //int charts_height = Convert.ToInt32(pointChart.Height.Value * pointChart.Width.Value / (r.PageWidth - r.Margins.Left - r.Margins.Right)); + r.Bands[BandKind.Detail].Height = 720; + XRChart chart = new XRChart(); + chart.Size = new Size(1280, 720); + ((IChartContainer)chart).Assign(((IChartContainer)pointChart).Chart); + r.ExportOptions.Pdf.ShowPrintDialogOnOpen = false; + r.ExportOptions.Pdf.ConvertImagesToJpeg = true; + r.PrintingSystem.Document.AutoFitToPagesWidth = 1; + r.Landscape = true; + r.Bands[BandKind.Detail].Controls.Add(chart); + ReportViewer rv = new ReportViewer(); + rv.Report = r; + rv.WritePdfTo(this.Response); + } + + protected void gridLookupGestore_ValueChanged(object sender, EventArgs e) + { + // ref: https://supportcenter.devexpress.com/ticket/details/q340370/aspxgridlookup-how-to-refresh-the-control-after-some-data-is-changed + // note: Per refreshare gridlookupLinea e gridlookupConsulente sulla base del valore di gridLookupGestore, salvo il valore gestore in una variabile di sessione Session["cod_ges"] + // e poi il refresh/rebind di SqlDSLinee e SqlDSConsulente verrà effettuato nell'evento lato client EndCallBack + + //ASPxGridView grid = gridLookupGestore.GridView; + //object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + + //if (objGestore != null) + //{ + // Session["cod_ges"] = (string)objGestore; + //} + + } + + protected void pointChart_DataBound(object sender, EventArgs e) + { + //foreach (Series series in pointChart.Series) + // foreach (SeriesPoint point in series.Points) + // point.ToolTipHint = "porca troia"; + } + } + //public partial class GPMDispRendRiskAPI : System.Web.UI.Page + //{ + // string cod_ges = String.Empty; + // string cod_pro = String.Empty; + // string cod_lin = String.Empty; + + // protected void Page_Load(object sender, EventArgs e) + // { + // cod_ges = Request.QueryString["cod_ges"]; + // cod_pro = Request.QueryString["cod_pro"]; + // cod_lin = Request.QueryString["cod_lin"]; + + // Session["cod_ges"] = cod_ges; // serve per popolare gridlookupLinea!! + + // PlottaPointChart(); + + // buttonEsportaPdf_Click(this, null); + // } + + // private void PlottaPointChart() + // { + + // if (!(String.IsNullOrEmpty(cod_ges) == false && String.IsNullOrEmpty(cod_pro) == false && String.IsNullOrEmpty(cod_lin) == false)) return; + + // // nota: esiste pure GDN_GPMDispRendRisk_PointCharts1 e GDN_GPM_Gestori1 perchè Filippo voleva avere l'opzione -- TUTTI -- sui gestori, ma poi il grafico si vedeva tutto incasinato e abbiamo desistito (07/06/2022) + // DataTable dtPointsChartData = CommonClass.execQuery_Datatable_Sql("GDN_GPMDispRendRisk_PointCharts", Properties.Settings.Default.SqlConnection, cod_ges, cod_pro, cod_lin, -1, -1, CommonClass.AddBusinessDays(DateTime.Today.Date,-1)); // prende l'ultimo giorno lavorativo del mese precedente + // Session["dtPointsChartData"] = dtPointsChartData; + + // //var listAssetClass = (from r in dtPointsChartData.AsEnumerable() + // // select r); + + + // pointChart.DataSource = dtPointsChartData; + + // // Cancella tutte le serie prima di plottare + // pointChart.Series.Clear(); + + // // Cancella tutti i titoli della serie prima di plottare + // pointChart.Titles.Clear(); + + // // Rimuove legenda aggiuntiva dei portafogli + // pointChart.Legends.Clear(); + + // // Setta titolo del grafico + // SettaTitoloGrafico(pointChart); + + // string seriesName = $"{cod_lin}"; + // Series series = new Series(seriesName, ViewType.Point); + // series.ArgumentScaleType = ScaleType.Numerical; + // series.LabelsVisibility = DefaultBoolean.True; + // series.Label.TextPattern = "{HINT}"; + // series.ArgumentDataMember = "VaR Medio 95"; + // series.ValueDataMembers[0] = "Performance YTD"; + // series.ShowInLegend = false; + // series.CrosshairContentShowMode = CrosshairContentShowMode.Default; + // series.CrosshairLabelPattern = "Var Medio 95%: {A:F2}% \r\n Perf YTD: {V:F2}%"; // ref link : https://docs.devexpress.com/CoreLibraries/DevExpress.XtraCharts.SeriesBase.CrosshairLabelPattern + // (series.Label as PointSeriesLabel).ResolveOverlappingMode = ResolveOverlappingMode.JustifyAroundPoint; + // foreach (DataRow row in dtPointsChartData.Rows) + // { + // SeriesPoint sp = new SeriesPoint(row["VaR Medio 95"], row["Performance YTD"]); + // if (row["Codice Portafoglio"].ToString() != "LIMITE VAR") sp.ToolTipHint = $"{row["Codice Portafoglio"]} - {row["Cliente"]}"; + // series.Points.Add(sp); + // } + + // pointChart.Series.Add(series); + + // XYDiagram diagram = (XYDiagram)pointChart.Diagram; + // if (diagram != null) + // { + // diagram.AxisX.Title.Text = "VAR MEDIO 95%"; + // diagram.AxisX.Title.Visibility = DefaultBoolean.True; + // diagram.AxisY.Title.Text = "PERFORMANCE YTD"; + // diagram.AxisY.Title.Visibility = DefaultBoolean.True; + + // // Setta var max sul grafico (plottato solo se una linea è selezionata) + // SettaVarMax(pointChart, dtPointsChartData, cod_lin); + // } + // } + + // private void SettaVarMax(WebChartControl pointChart, DataTable dtPointsChartData, string Linea) + // { + // // Cancella eventuali precedenti linee verticali + // XYDiagram diagram = (XYDiagram)pointChart.Diagram; + // diagram.AxisX.ConstantLines.Clear(); + + // // Se è selezionata una singola linea, allora rileva il limite var prendendo il primo ptf in dtPointsChartData e leggendo il valore da tabraplim + // if (Linea != "-- TUTTI --") + // { + // double limiteVar = (from r in dtPointsChartData.AsEnumerable() + // select Convert.ToDouble(r["LimiteVar"])).FirstOrDefault(); + // ConstantLine cl1 = new ConstantLine("Limite VaR"); + + // cl1.AxisValue = limiteVar; + // cl1.Visible = true; + // cl1.ShowBehind = false; + // cl1.Color = System.Drawing.Color.Red; + // cl1.LineStyle.DashStyle = DashStyle.Solid; + // cl1.LineStyle.Thickness = 2; + // cl1.ShowInLegend = false; + + // diagram.AxisX.ConstantLines.Add(cl1); + + // // Define the whole range for the X-axis. + // //diagram.AxisX.WholeRange.Auto = false; + // //diagram.AxisX.WholeRange.SetMinMaxValues(0, limiteVar * 0.2); + // } + // } + + // private void SettaTitoloGrafico(WebChartControl chartControl) + // { + // // Create chart titles. + // ChartTitle chartTitle1 = new ChartTitle(); + // ChartTitle chartTitle2 = new ChartTitle(); + // // Define the text for the titles. + // chartTitle1.Text = "GPM DISPERSION RISK / REND"; + + // chartTitle2.Text = TitoloFiltri(); + + // chartTitle2.WordWrap = true; + // chartTitle2.MaxLineCount = 2; + + // // Define the alignment of the titles. + // chartTitle1.Alignment = StringAlignment.Center; + // chartTitle2.Alignment = StringAlignment.Center; + + // // Place the titles where it's required. + // chartTitle1.Dock = ChartTitleDockStyle.Top; + // chartTitle2.Dock = ChartTitleDockStyle.Top; + + // // Customize a title's appearance. + // chartTitle1.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + // chartTitle1.Font = new Font("Tahoma", 14, FontStyle.Bold); + // chartTitle1.TextColor = Color.Blue; + // chartTitle1.Indent = 10; + + // // Customize a title's appearance. + // chartTitle2.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + // chartTitle2.Font = new Font("Arial", 10, FontStyle.Bold); + // chartTitle2.TextColor = Color.Black; + // chartTitle2.Indent = 10; + + // // Add the titles to the chart. + // chartControl.Titles.AddRange(new ChartTitle[] { chartTitle1, chartTitle2 }); + // } + // private string TitoloFiltri() + // { + // string filtro = String.Empty; + // //if (String.IsNullOrEmpty(gridLookupGestore.Text) == true) { filtro += "Gestore: tutti "; } else { filtro += $"Gestore: {gridLookupGestore.Text} "; } + // //if (String.IsNullOrEmpty(gridLookupConsulente.Text) == true) { filtro += "Consulente: tutti "; } else { filtro += $"Consulente: {gridLookupConsulente.Text} "; } + // //if (String.IsNullOrEmpty(gridLookupLinea.Text) == true) { filtro += "Linea: tutti "; } else { filtro += $"Linea: {gridLookupLinea.Text} "; } + // if (String.IsNullOrEmpty(cod_ges) == true) { filtro += "Gestore: tutti "; } else { filtro += $"Gestore: {cod_ges} "; } + // if (String.IsNullOrEmpty(cod_pro) == true) { filtro += "Consulente: tutti "; } else { filtro += $"Consulente: {cod_pro} "; } + // if (String.IsNullOrEmpty(cod_lin) == true) { filtro += "Linea: tutti "; } else { filtro += $"Linea: {cod_lin} "; } + // return (filtro); + // } + + // protected void buttonGeneraGrafici_Click(object sender, EventArgs e) + // { + // PlottaPointChart(); + // } + + // protected void buttonEsportaPdf_Click(object sender, EventArgs e) + // { + + // // Esporta grafico in pdf + // /* + // var ps = new PrintingSystem(); + // ps.PageSettings.Landscape = true; + // var link1 = new PrintableComponentLink(); + // pointChart.DataBind(); + + // link1.Component = ((IChartContainer)pointChart).Chart; + // link1.Landscape = true; + // link1.PrintingSystem = ps; + // link1.CreateDocument(); + // ps.Document.AutoFitToPagesWidth = 1; // Fit to page + + // using (var stream = new MemoryStream()) + // { + // link1.PrintingSystem.ExportToPdf(stream); + // Response.Clear(); + // Response.Buffer = false; + // Response.AppendHeader("Content-Type", "application/pdf"); + // Response.AppendHeader("Content-Transfer-Encoding", "binary"); + // Response.AppendHeader("Content-Disposition", $"attachment; filename=GPMDispRendRisk_{DateTime.Now.Date.ToString("yyyyMMdd")}.pdf"); + // Response.BinaryWrite(stream.GetBuffer()); + // Response.End(); + // } + // ps.Dispose(); + // */ + + + // /* + // XtraReport r = new XtraReport(); + // r.Bands.Add(new DetailBand()); + // r.Bands[BandKind.Detail].Height = Convert.ToInt32(pointChart.Height.Value * pointChart.Width.Value / (r.PageWidth - r.Margins.Left - r.Margins.Right)); + // XRChart chart = new XRChart(); + // ((IChartContainer)chart).Assign(((IChartContainer)pointChart).Chart); + // r.Bands[BandKind.Detail].Controls.Add(chart); + // chart.Size = new Size(r.PageWidth - r.Margins.Left - r.Margins.Right, r.Bands[BandKind.Detail].Height); + + // ReportViewer rv = new ReportViewer(); + // rv.Report = r; + // r.ExportOptions.Pdf.ShowPrintDialogOnOpen = false; + // r.Landscape = true; + // rv.WritePdfTo(this.Response); + // */ + + // XtraReport r = new XtraReport(); + // r.Bands.Add(new DetailBand()); + // //int charts_height = Convert.ToInt32(pointChart.Height.Value * pointChart.Width.Value / (r.PageWidth - r.Margins.Left - r.Margins.Right)); + // r.Bands[BandKind.Detail].Height = 720; + // XRChart chart = new XRChart(); + // chart.Size = new Size(1280, 720); + // ((IChartContainer)chart).Assign(((IChartContainer)pointChart).Chart); + // r.ExportOptions.Pdf.ShowPrintDialogOnOpen = false; + // r.ExportOptions.Pdf.ConvertImagesToJpeg = true; + // r.PrintingSystem.Document.AutoFitToPagesWidth = 1; + // r.Landscape = true; + // r.Bands[BandKind.Detail].Controls.Add(chart); + // ReportViewer rv = new ReportViewer(); + // rv.Report = r; + // rv.WritePdfTo(this.Response); + // } + + // protected void gridLookupGestore_ValueChanged(object sender, EventArgs e) + // { + // // ref: https://supportcenter.devexpress.com/ticket/details/q340370/aspxgridlookup-how-to-refresh-the-control-after-some-data-is-changed + // // note: Per refreshare gridlookupLinea e gridlookupConsulente sulla base del valore di gridLookupGestore, salvo il valore gestore in una variabile di sessione Session["cod_ges"] + // // e poi il refresh/rebind di SqlDSLinee e SqlDSConsulente verrà effettuato nell'evento lato client EndCallBack + + // //ASPxGridView grid = gridLookupGestore.GridView; + // //object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + + // //if (objGestore != null) + // //{ + // // Session["cod_ges"] = (string)objGestore; + // //} + + // } + + // protected void pointChart_DataBound(object sender, EventArgs e) + // { + // //foreach (Series series in pointChart.Series) + // // foreach (SeriesPoint point in series.Points) + // // point.ToolTipHint = "porca troia"; + // } + //} +} \ No newline at end of file diff --git a/OlympiaIntranet/GPMDispRendRiskAPI.aspx.designer.cs b/OlympiaIntranet/GPMDispRendRiskAPI.aspx.designer.cs new file mode 100644 index 0000000..941ad5a --- /dev/null +++ b/OlympiaIntranet/GPMDispRendRiskAPI.aspx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class GPMDispRendRiskAPI { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// buttonGeneraGrafici control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonGeneraGrafici; + + /// + /// buttonEsportaPdf control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonEsportaPdf; + + /// + /// pointChart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.XtraCharts.Web.WebChartControl pointChart; + } +} diff --git a/OlympiaIntranet/GestioneOrdini.aspx b/OlympiaIntranet/GestioneOrdini.aspx new file mode 100644 index 0000000..9e3dd3d --- /dev/null +++ b/OlympiaIntranet/GestioneOrdini.aspx @@ -0,0 +1,759 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GestioneOrdini.aspx.cs" Inherits="OlympiaIntranet.GestioneOrdiniGuardian" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> +<%--<%@ Register Src="~/MemberPages/menu.ascx" TagPrefix="mc" TagName="menuControl" %>--%> + + + + + + + +
+
+<%-- --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%-- + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +<%-- + + --%> + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/OlympiaIntranet/GestioneOrdini.aspx.cs b/OlympiaIntranet/GestioneOrdini.aspx.cs new file mode 100644 index 0000000..026cba8 --- /dev/null +++ b/OlympiaIntranet/GestioneOrdini.aspx.cs @@ -0,0 +1,928 @@ +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Net; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class GestioneOrdiniGuardian : System.Web.UI.Page + { + DataTable dtTitoli, dtClienti; + string Isin = "", Description = "", DivisaTitolo = "", LastDate = ""; + string Last = "", Ask = ""; + string paramGruppi = ""; + DateTime LastDateNET = Convert.ToDateTime("01/01/1900"); + + protected void Page_Init(object sender, EventArgs e) + { + // Imposta data odierna di default + ASPxDataUltimaModifica.Date = DateTime.Now.Date; + ASPxDataInvio.Date = DateTime.Now.Date; + + // Setta gruppi a seconda dell'utente + + // Utenza Anna + ASPxCBLGruppi.Items.Clear(); + ASPxCBLGruppiExcel.Items.Clear(); + if (Page.User.Identity.Name == "anna" || Page.User.Identity.Name == "federico" || Page.User.Identity.Name == "admin" || Page.User.Identity.Name == "ecanziani" || Page.User.Identity.Name == "fcostalonga" || Page.User.Identity.Name == "agamba") + { + ASPxCBLGruppi.Items.Add("ANNA_BIL", "ANNA_BIL"); + ASPxCBLGruppi.Items.Add("ANNA_UBS", "ANNA_UBS"); + ASPxCBLGruppi.Items.Add("ANNA_UBS_CH", "ANNA_UBS_CH"); + + ASPxCBLGruppiExcel.Items.Add("ANNA_BIL", "ANNA_BIL"); + ASPxCBLGruppiExcel.Items.Add("ANNA_UBS", "ANNA_UBS"); + ASPxCBLGruppiExcel.Items.Add("ANNA_UBS_CH", "ANNA_UBS_CH"); + + } + + // Utenza Stefano + if (Page.User.Identity.Name == "stefano" || Page.User.Identity.Name == "sbettinelli") + { + ASPxCBLGruppi.Items.Add("STE_ITA", "STE_ITA"); + ASPxCBLGruppi.Items.Add("STE_EST", "STE_EST"); + + ASPxCBLGruppiExcel.Items.Add("STE_ITA", "STE_ITA"); + ASPxCBLGruppiExcel.Items.Add("STE_EST", "STE_EST"); + } + + } + + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + ReloadTables(); + + } + + protected void ASPxRBLTipoTitolo_SelectedIndexChanged(object sender, EventArgs e) + { + // Evento gestito tramite javascript in ClientSideEvents SelectedIndexChanged + // "function(s, e) { + + // if (rblTipoTitolo.GetSelectedIndex() == 0) // Tipo Codice : ISIN + // { + // comboboxStrumento.SetEnabled(true); + // } + // else + // if (rblTipoTitolo.GetSelectedIndex() == 1) // Tipo Codice : Ticker BBG + // { + // comboboxStrumento.SetSelectedIndex(-1); + // comboboxStrumento.SetEnabled(false); + // } + //}" + + //if (ASPxRBLTipoTitolo.SelectedIndex == 0) // Tipo Codice : ISIN + //{ + // ASPxStrumento.Enabled = true; + //} + //else + //if (ASPxRBLTipoTitolo.SelectedIndex == 1) // Tipo Codice : Ticker BBG + //{ + // ASPxStrumento.SelectedIndex = -1; + // ASPxStrumento.Enabled = false; + //} + } + + protected void ASPxButtonQueryBBG_Click(object sender, EventArgs e) + { + // Pulisce Label varie + ASPxLabelQueryStatus.Text = ""; + ASPxLabelDescrizioneBBG.Text = ""; + ASPxLabelDivisaTitoloBBG.Text = ""; + ASPxLabelPrezzoBBG.Text = ""; + ASPxLabelDataPrezzoBBG.Text = ""; + + // Controllo Codice Titolo + if (String.IsNullOrEmpty(ASPxCodiceTitolo.Text)) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Codice Titolo mancante!\");", true); + return; + } + + // Controllo Tipo Titolo + if (ASPxRBLTipoTitolo.SelectedIndex == -1) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Selezionare tipo ISIN o Ticker BBG!\");", true); + return; + } + // Controllo correttezza ISIN (se selezionato ISIN in radiobuttonlist) + if (ASPxRBLTipoTitolo.SelectedIndex == 0 && (ASPxCodiceTitolo.Text.Length != 12 || (ASPxCodiceTitolo.Text.Any(Char.IsWhiteSpace)))) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Formato ISIN non corretto!\");", true); + return; + } + // Controllo Strumento (solo se è selezionato Tipo Codice ISIN) + //if (ASPxRBLTipoTitolo.SelectedIndex == 0 && ASPxStrumento.SelectedIndex == -1) + // Controllo Strumento + if (ASPxStrumento.SelectedIndex == -1) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Selezionare Strumento!\");", true); + return; + } + //// Controllo Mercato + //if (ASPxMercato.SelectedIndex == -1) + //{ + // ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Selezionare Mercato!\");", true); + // return; + //} + + // Controllo PCS Obbligazioni se è selezionato Obbligazioni come Strumento + //if (ASPxStrumento.SelectedIndex == 4 && ASPxPCSObbligazioni.SelectedIndex == -1) + //{ + // ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Selezionare PCS!\");", true); + // return; + //} + + // Compone link BBG + //string suffixBBG = ""; + string security = ""; + string field = "ID_ISIN,SECURITY_NAME,PX_LAST,CRNCY,PX_CLOSE_DT,PX_ASK"; // Nel caso di strumento = Certificates allora la descrizione la prenderò componendola dal DB + if (ASPxRBLTipoTitolo.SelectedIndex == 0) // Selezionato ISIN + { + if (ASPxStrumento.SelectedIndex != 4) security = "/isin/" + ASPxCodiceTitolo.Text.ToUpper(); + else security = "/isin/" + ASPxCodiceTitolo.Text + "@"+ ASPxPCS.Text; // se Strumento è obbligazioni allora compone diversamente la security (esempio /isin/DE000A2GSB86@GERM) + } + else + if (ASPxRBLTipoTitolo.SelectedIndex == 1) // Selezionato Ticker BBG + { + security = ASPxCodiceTitolo.Text; + } + + // Effettua chiamata a BBG + string IPBBG = CommonClass.IsBBGServiceOnline()[1]; // Scarica dati rt da Londra + bool callEsito = (IPBBG != "N/A"); + int hits = 0; + int numFields = 6; + //string linkBBG = string.Format("http://188.172.147.202:50000/api/bbgservice?security={0}&field={1}&type=json",security,field); + if (!callEsito) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"BBG OFFLINE!\");", true); + return; + } + hits += numFields; + string linkBBG = string.Format("http://{0}/api/bbgservice?security={1}&field={2}&type=json", IPBBG, security, field); + string json = ""; + string error = ""; + try + { + using (WebClient web = new WebClient()) + { + json = web.DownloadString(linkBBG); + } + if (CommonClass.IsValidJson(json) == false) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"ERRORE CHIAMATA BBG SERVICE! ("+ linkBBG + ") \");", true); + return; + } + JArray root = JArray.Parse(json); + + foreach (var item in root) + { + Isin = (string)item.SelectToken("ID_ISIN"); // usato solo se Tipo Titolo è Ticker BBG + Description = (string)item.SelectToken("SECURITY_NAME"); // usato solo se Strumento non è Certificates + //Last = Convert.ToDecimal(((string)item.SelectToken("PX_LAST")).Replace('.', ',')); + //Ask = Convert.ToDecimal(((string)item.SelectToken("PX_ASK")).Replace('.', ',')); + Last = (string)item.SelectToken("PX_LAST"); + Ask = (string)item.SelectToken("PX_ASK"); + DivisaTitolo = (string)item.SelectToken("CRNCY"); + LastDate = (string)item.SelectToken("PX_CLOSE_DT"); + if (LastDate != "0") + { + var arrLastDate = LastDate.Split('-'); // Splitta data in formato yyyy-mm-dd per convertirla in C#.Net + LastDateNET = new DateTime(Convert.ToInt16(arrLastDate[0]), Convert.ToInt16(arrLastDate[1]), Convert.ToInt16(arrLastDate[2])); + } else LastDateNET = new DateTime(1900, 01, 01); + } + + CommonClass.SaveHits(1, hits); + + } + catch (Exception ex) + { + error = ex.Message; + string Errore = string.Format("alert(\"{0} (Errore : {1})\");", "Errore esecuzione query su BBG Service!",error); + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", Errore, true); + } + + if (!string.IsNullOrEmpty(error)) return; // Se s'è errore in Query BBG allora esce... + + // Verifica esistenza Isin in tabella TitoliGDN e nel caso ne carica i dati altrimenti li salva e li visualizza + int IDTitoli = (from r in dtTitoli.AsEnumerable() + where r.Field("ISIN").ToUpper() == Isin + select r.Field("IDTitoli")).SingleOrDefault(); + if (IDTitoli == 0) // Se Isin non esiste nel DB allora lo salva + { + ASPxLabelISIN.Text = Isin; + if (ASPxStrumento.Text == "Certificates") + { + ASPxLabelDescrizioneBBG.Text = ExecSP("GDN_DescrizioneTitolo", Isin); + ASPxLabelPrezzoBBG.Text = String.Format("{0:F}", Ask); + var layoutItem = ASPxFLTitoli.FindItemOrGroupByName("ASPxLayoutItemPrezzo"); + layoutItem.Caption = "Prezzo (Ask)"; + ASPxLabelDataPrezzoBBG.Text = DateTime.Now.Date.ToString("dd-MM-yyyy"); + } + else + { + ASPxLabelDescrizioneBBG.Text = Description; + ASPxLabelPrezzoBBG.Text = String.Format("{0:F}", Last); + var layoutItem = ASPxFLTitoli.FindItemOrGroupByName("ASPxLayoutItemPrezzo"); + layoutItem.Caption = "Prezzo (Last)"; + ASPxLabelDataPrezzoBBG.Text = LastDateNET.ToString("dd-MM-yyyy"); + } + + ASPxLabelDataPrezzoBBG.Text = LastDateNET.ToString("dd-MM-yyyy"); + ASPxLabelDivisaTitoloBBG.Text = DivisaTitolo; + SalvaTitoli(); // salva record in TitoliGDN + ReloadTables(); + ASPxLabelQueryStatus.Text = string.Format("Titolo {0} salvato nel database", ASPxCodiceTitolo.Text); + } + else // Se Isin esiste allora aggiorna Px_Last,Px_Date,MercatiID e TipoStrumento in tabella TitoliGDN e Prezzo in tabella OrdiniGDN per tutti i record che hanno quel titolo + { + AggiornaTitoli_Ordini(); + ReloadTables(); + ASPxLabelQueryStatus.Text = string.Format("Titolo {0} rilevato nel database, dati aggiornati", ASPxCodiceTitolo.Text); + ASPxLabelISIN.Text = Isin; + if (ASPxStrumento.Text == "Certificates") + { + var layoutItem = ASPxFLTitoli.FindItemOrGroupByName("ASPxLayoutItemPrezzo"); + layoutItem.Caption = "Prezzo (Ask)"; + } + else + { + var layoutItem = ASPxFLTitoli.FindItemOrGroupByName("ASPxLayoutItemPrezzo"); + layoutItem.Caption = "Prezzo (Last)"; + } + ASPxLabelDescrizioneBBG.Text = (from r in dtTitoli.AsEnumerable() + where r.Field("ISIN").ToUpper() == Isin + select r.Field("Descrizione")).SingleOrDefault(); + ASPxLabelPrezzoBBG.Text = String.Format("{0:F}",(from r in dtTitoli.AsEnumerable() + where r.Field("ISIN").ToUpper() == Isin + select r.Field("Px_Last")).SingleOrDefault()); + ASPxLabelDataPrezzoBBG.Text = (from r in dtTitoli.AsEnumerable() + where r.Field("ISIN").ToUpper() == Isin + select r.Field("Px_Date")).SingleOrDefault().ToString("dd-MM-yyyy"); + ASPxLabelDivisaTitoloBBG.Text = (from r in dtTitoli.AsEnumerable() + where r.Field("ISIN").ToUpper() == Isin + select r.Field("DivisaTitolo")).SingleOrDefault(); + //ASPxMercato.SelectedItem.Value = (from r in dtTitoli.AsEnumerable() + // where r.Field("ISIN").ToUpper() == Isin + // select r.Field("MercatiID")).SingleOrDefault(); + // if (ASPxRBLTipoTitolo.SelectedIndex == 0) + // { + ASPxStrumento.SelectedItem.Value = (from r in dtTitoli.AsEnumerable() + where r.Field("ISIN").ToUpper() == Isin + select r.Field("TipoStrumento")).SingleOrDefault(); + //} + //else ASPxStrumento.SelectedIndex = -1; + } + ReloadOrdini(); + ReloadOrdiniPerExcel(); + ASPxOrdiniPerExcel.Selection.SelectAll(); + + } + + protected void ASPxMercato_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e) + { + (sender as DevExpress.Web.ASPxComboBox).DataBind(); + } + + protected void ASPxGVOrdini_BeforePerformDataSelect(object sender, EventArgs e) + { + Session["ISIN"] = ASPxLabelISIN.Text; + Session["fromDate"] = ASPxDataUltimaModifica.Date.ToString("yyyy-MM-dd"); + } + + protected void ASPxButtonCaricaClienti_Click(object sender, EventArgs e) + { + // Controllo Codice Titolo + if (String.IsNullOrEmpty(ASPxCodiceTitolo.Text)) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Codice Titolo mancante!\");", true); + return; + } + SalvaDataRegolamento(); + + ReloadOrdini(); + } + + private void SalvaDataRegolamento() + { + // Rileva gruppi selezionati per la visualizzazione degli ordini relativi ai clienti associati ai gruppi + paramGruppi = ""; + foreach (ListEditItem item in ASPxCBLGruppi.SelectedItems) + { + paramGruppi = paramGruppi + item.Text + ","; + } + // Salva DataRegolamento per quelle righe (ordini) che hanno solo un conto (quindi una valuta) in modo che l'utente non debba editare le righe a manina. + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.GDN_OrdiniDataRegUPD", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@ISIN", SqlDbType.VarChar).Value = ASPxLabelISIN.Text; + cmd.Parameters.Add("@Gruppi", SqlDbType.VarChar).Value = paramGruppi; + con.Open(); + cmd.ExecuteNonQuery(); + } + } + + protected void ASPxButtonSavePrezzo_Click(object sender, EventArgs e) + { + // Controlla Modifica prezzo valorizzato + if (String.IsNullOrEmpty(ASPxTextBoxModificaPrezzo.Text)) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Prezzo da aggiornare mancante!\");", true); + return; + } + // Controlla inserimento punto decimale invece che virgola + if (ASPxTextBoxModificaPrezzo.Text.IndexOf(",") != -1) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Inserire prezzo con punto (.) come decimale (es: 900.25)\");", true); + return; + } + // Ciclo per rilevare IDOrdini in griglia ASPxGVOrdini + for (int i = 0; i < ASPxGVOrdini.VisibleRowCount; i++) + { + if (ASPxGVOrdini.GetRowLevel(i) == ASPxGVOrdini.GroupCount) + { + object keyValue = ASPxGVOrdini.GetRowValues(i, new string[] { ASPxGVOrdini.KeyFieldName }); + if (keyValue != null) + //ASPxMemo1.Text += keyValue.ToString() + "\n"; + AggiornaPrezzo_Ordini(Convert.ToInt16(keyValue),Convert.ToDouble(ASPxTextBoxModificaPrezzo.Text)); + } + } + ReloadOrdini(); + ReloadOrdiniPerExcel(); + ASPxOrdiniPerExcel.Selection.SelectAll(); + } + + private void InserisceOrdini(string gruppo, string ISIN) + { + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.GDN_OrdiniINS_v1", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@Gruppo", SqlDbType.VarChar).Value = gruppo; + cmd.Parameters.Add("@ISIN", SqlDbType.VarChar).Value = ISIN; + con.Open(); + cmd.ExecuteNonQuery(); + } + } + + protected void ASPxButtonCaricaOrdiniExcel_Click(object sender, EventArgs e) + { + if (ASPxCBLGruppiExcel.SelectedItems.Count == 0) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Selezionare almeno un gruppo!\");", true); + return; + } + ReloadOrdiniPerExcel(); + + // Seleziona tutti i record (default) + ASPxOrdiniPerExcel.Selection.SelectAll(); + } + + private void AggiornaTitoli_Ordini() + { + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.GDN_TitoliUPD_v1", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + //cmd.Parameters.Add("@MercatiID", SqlDbType.Int).Value = Convert.ToInt16(ASPxMercato.SelectedItem.Value); + cmd.Parameters.Add("@ISIN", SqlDbType.VarChar).Value = Isin; + if (ASPxStrumento.Text == "Certificates") + { + cmd.Parameters.Add("@Px_Last", SqlDbType.Float).Value = Ask; + cmd.Parameters.Add("@Px_Date", SqlDbType.Date).Value = DateTime.Now.Date; + } + else + { + cmd.Parameters.Add("@Px_Last", SqlDbType.Float).Value = Last; + cmd.Parameters.Add("@Px_Date", SqlDbType.Date).Value = LastDate; + } + cmd.Parameters.Add("@TipoStrumento", SqlDbType.VarChar).Value = ASPxStrumento.SelectedItem.Value; + cmd.Parameters.Add("@DivisaTitolo", SqlDbType.VarChar).Value = DivisaTitolo; + + con.Open(); + cmd.ExecuteNonQuery(); + } + } + + protected void ASPxButtonExportOrdiniExcel_Click(object sender, EventArgs e) + { + // Controlla che la colonna cod_div_reg sia sempre valorizzata + bool bValutaMancante = false; + for (int i = 0; i < ASPxOrdiniPerExcel.VisibleRowCount; i++) + { + if (ASPxOrdiniPerExcel.Selection.IsRowSelected(i)) + { + if (ASPxOrdiniPerExcel.GetRowLevel(i) == ASPxOrdiniPerExcel.GroupCount) + { + object keyValue = ASPxOrdiniPerExcel.GetRowValues(i, "cod_div_reg"); + if (keyValue != null) + { + if (String.IsNullOrEmpty(keyValue.ToString())) + { + bValutaMancante = true; + } + } + } + } + } + if (bValutaMancante) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Verificare colonna Divisa Regolamento (cod_div_reg) , valuta mancante individuata in una o più righe!\");", true); + return; + } + // Aggiorna data invio in tutti gli ordini selezionati prima di generare l'excel + // Ciclo per rilevare IDOrdini in griglia ASPxGVOrdini + for (int i = 0; i < ASPxOrdiniPerExcel.VisibleRowCount; i++) + { + if (ASPxOrdiniPerExcel.Selection.IsRowSelected(i)) + { + if (ASPxOrdiniPerExcel.GetRowLevel(i) == ASPxOrdiniPerExcel.GroupCount) + { + object keyValue = ASPxOrdiniPerExcel.GetRowValues(i, new string[] { ASPxOrdiniPerExcel.KeyFieldName }); + if (keyValue != null) + AggiornaDataInvio_Ordini(Convert.ToInt16(keyValue), ASPxDataInvio.Date); + } + } + } + ReloadOrdiniPerExcel(); + + // Esporta Griglia in Excel + SettaColonneExcel(true); + ASPxGridViewExporter1.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - ordini"; + XlsxExportOptionsEx option = new XlsxExportOptionsEx { ExportType = ExportType.DataAware, TextExportMode = TextExportMode.Value }; + ASPxGridViewExporter1.WriteXlsxToResponse(option); + SettaColonneExcel(false); + } + + protected void ASPxGridViewExporter1_RenderBrick(object sender, ASPxGridViewExportRenderingEventArgs e) + { + // ref : https://www.devexpress.com/Support/Center/Question/Details/Q444559 + // Disabilita esportazione griglia in Excel + e.BrickStyle.BorderWidth = 1; + + // ref : https://www.devexpress.com/Support/Center/Question/Details/S37578 + // Formatta campo prezzo in excel in formato numerico (non usato perchè non risolve problema importazione in Guardian) + //GridViewDataColumn dataColumn = e.Column as GridViewDataColumn; + //if (e.RowType == GridViewRowType.Data && dataColumn != null && dataColumn.FieldName == "prezzo") + //{ + // e.TextValueFormatString = "{0:N2}"; + //} + } + + private void AggiornaDataInvio_Ordini(int idOrdini, DateTime dataInvio) + { + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.GDN_DataInvioOrdiniUPD", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@IDOrdini", SqlDbType.Int).Value = idOrdini; + cmd.Parameters.Add("@DataInvio", SqlDbType.Date).Value = dataInvio; + con.Open(); + cmd.ExecuteNonQuery(); + } + } + + private void AggiornaDataValidita_Ordini(int idOrdini, DateTime? dataValidita) + { + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.GDN_DataValiditaOrdiniUPD", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@IDOrdini", SqlDbType.Int).Value = idOrdini; + if (dataValidita != null) cmd.Parameters.Add("@DataValidita", SqlDbType.Date).Value = dataValidita; + else cmd.Parameters.Add("@DataValidita", SqlDbType.Date).Value = DBNull.Value; + con.Open(); + cmd.ExecuteNonQuery(); + } + } + + + + private void SalvaTitoli() + { + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.GDN_TitoliINS", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + //cmd.Parameters.Add("@MercatiID", SqlDbType.Int).Value = Convert.ToInt16(ASPxMercato.SelectedItem.Value); + cmd.Parameters.Add("@ISIN", SqlDbType.VarChar).Value = Isin; + if (ASPxRBLTipoTitolo.SelectedIndex == 1) cmd.Parameters.Add("@Ticker_bbg", SqlDbType.VarChar).Value = ASPxCodiceTitolo.Text; + if (ASPxRBLTipoTitolo.SelectedIndex == 0) cmd.Parameters.Add("@Ticker_bbg", SqlDbType.VarChar).Value = DBNull.Value; + cmd.Parameters.Add("@Descrizione", SqlDbType.VarChar).Value = ASPxLabelDescrizioneBBG.Text; + if (ASPxStrumento.Text == "Certificates") cmd.Parameters.Add("@Px_Last", SqlDbType.Float).Value = Ask; + else cmd.Parameters.Add("@Px_Last", SqlDbType.Float).Value = Last; + cmd.Parameters.Add("@Px_Date", SqlDbType.Date).Value = LastDateNET; + cmd.Parameters.Add("@DivisaTitolo", SqlDbType.VarChar).Value = DivisaTitolo; + cmd.Parameters.Add("@TipoStrumento", SqlDbType.VarChar).Value = ASPxStrumento.SelectedItem.Value; + con.Open(); + cmd.ExecuteNonQuery(); + } + } + + protected void ASPxPageControl1_ActiveTabChanged(object source, TabControlEventArgs e) + { + //if (ASPxPageControl1.ActiveTabPage.Name=="Crea Excel") + //{ + // ReloadOrdiniPerExcel(); + //} + } + + protected void ASPxGVOrdini_RowUpdated(object sender, DevExpress.Web.Data.ASPxDataUpdatedEventArgs e) + { + ReloadOrdiniPerExcel(); + ASPxOrdiniPerExcel.Selection.SelectAll(); + } + + protected void ASPxButtonCancellaOrdini_Click(object sender, EventArgs e) + { + // Controllo Codice Titolo + if (String.IsNullOrEmpty(ASPxCodiceTitolo.Text)) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Codice Titolo mancante!\");", true); + return; + } + + // Esegue codice sottostante solo se è stato accettato il confirm in ClientSideEvent in ASPxButtonCancellaOrdini + CancellaOrdini(); + } + + private void CancellaOrdini() + { + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.GDN_CancellaOrdiniPerTitolo", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@ISIN", SqlDbType.VarChar).Value = ASPxCodiceTitolo.Text; + con.Open(); + cmd.ExecuteNonQuery(); + } + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Ordini cancellati per "+ ASPxCodiceTitolo.Text+" !\");", true); + } + + protected void ASPxButtonSaveDataValidita_Click(object sender, EventArgs e) + { + + // Controlla Modifica Data Validità valorizzato + if (String.IsNullOrEmpty(ASPxDateDataValidita.Text)) + { + ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"Data Validità da aggiornare mancante!\");", true); + return; + } + + // Ciclo per rilevare IDOrdini in griglia ASPxGVOrdini + for (int i = 0; i < ASPxGVOrdini.VisibleRowCount; i++) + { + if (ASPxGVOrdini.GetRowLevel(i) == ASPxGVOrdini.GroupCount) + { + object keyValue = ASPxGVOrdini.GetRowValues(i, new string[] { ASPxGVOrdini.KeyFieldName }); + if (keyValue != null) + AggiornaDataValidita_Ordini(Convert.ToInt16(keyValue), ASPxDateDataValidita.Date); + } + } + ReloadOrdini(); + ReloadOrdiniPerExcel(); + ASPxOrdiniPerExcel.Selection.SelectAll(); + } + + protected void ASPxCancellaDataValidita_Click(object sender, EventArgs e) + { + // Ciclo per rilevare IDOrdini in griglia ASPxGVOrdini + for (int i = 0; i < ASPxGVOrdini.VisibleRowCount; i++) + { + if (ASPxGVOrdini.GetRowLevel(i) == ASPxGVOrdini.GroupCount) + { + object keyValue = ASPxGVOrdini.GetRowValues(i, new string[] { ASPxGVOrdini.KeyFieldName }); + if (keyValue != null) + { + DateTime? dataValidita = null; + AggiornaDataValidita_Ordini(Convert.ToInt16(keyValue), dataValidita); + } + } + } + ReloadOrdini(); + ReloadOrdiniPerExcel(); + ASPxOrdiniPerExcel.Selection.SelectAll(); + } + + protected void ASPxOrdiniPerExcel_BeforePerformDataSelect(object sender, EventArgs e) + { + string paramGruppi = ""; + if (ASPxCBLGruppiExcel.SelectedItems.Count > 0) + { + foreach (ListEditItem item in ASPxCBLGruppiExcel.SelectedItems) + { + paramGruppi = paramGruppi + item.Text + ","; + } + + Session["Gruppi"] = paramGruppi; + Session["fromDate"] = ASPxDataUltimaModifica.Date; + } + } + + protected void ASPxButtonSaveTipoOp_Click(object sender, EventArgs e) + { + // Ciclo per rilevare IDOrdini in griglia ASPxGVOrdini + for (int i = 0; i < ASPxGVOrdini.VisibleRowCount; i++) + { + if (ASPxGVOrdini.GetRowLevel(i) == ASPxGVOrdini.GroupCount) + { + object keyValue = ASPxGVOrdini.GetRowValues(i, new string[] { ASPxGVOrdini.KeyFieldName }); + if (keyValue != null) + AggiornaTipoOp_Ordini(Convert.ToInt16(keyValue), ASPxRBLTipoOp.SelectedItem.Value.ToString()); + } + } + + ReloadOrdini(); + ReloadOrdiniPerExcel(); + ASPxOrdiniPerExcel.Selection.SelectAll(); + } + + private void AggiornaTipoOp_Ordini(int idOrdini, string tipoOp) + { + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.GDN_TipoOpOrdiniUPD", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@IDOrdini", SqlDbType.Int).Value = idOrdini; + cmd.Parameters.Add("@TipoOp", SqlDbType.VarChar).Value = tipoOp; + con.Open(); + cmd.ExecuteNonQuery(); + } + } + + //private void AzzeraDataValidita_Ordini(int idOrdini) + //{ + // string connectionString = Properties.Settings.Default.DBSettings; + // using (var con = new SqlConnection(connectionString)) + // { + // var cmd = new SqlCommand + // { + // CommandText = "dbo.GDN_DataValiditaNULLOrdiniUPD", + // CommandType = CommandType.StoredProcedure, + // Connection = con + // }; + // cmd.Parameters.Add("@IDOrdini", SqlDbType.Int).Value = idOrdini; + // con.Open(); + // cmd.ExecuteNonQuery(); + // } + //} + + private static string ExecSP(string proc, string param) + { + string result; + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = proc, + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@Isin", SqlDbType.VarChar).Value = param; + con.Open(); // Open the SqlConnection. + result = cmd.ExecuteScalar().ToString(); + } + return (result); + } + + protected void ASPxImportaQty_Click(object sender, EventArgs e) + { + // Ciclo per rilevare IDOrdini in griglia ASPxGVOrdini + for (int i = 0; i < ASPxGVOrdini.VisibleRowCount; i++) + { + if (ASPxGVOrdini.GetRowLevel(i) == ASPxGVOrdini.GroupCount) + { + object keyValue = ASPxGVOrdini.GetRowValues(i, new string[] { ASPxGVOrdini.KeyFieldName }); + object Qta = ASPxGVOrdini.GetRowValues(i, "QtaInPtf"); + if (keyValue != null) AggiornaQty_Ordini(Convert.ToInt16(keyValue), Convert.ToDecimal(Qta)); + } + } + ReloadOrdini(); + ReloadOrdiniPerExcel(); + ASPxOrdiniPerExcel.Selection.SelectAll(); + } + + private void AggiornaQty_Ordini(int idOrdini, Decimal QtaInPtf) + { + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.GDN_QtaOrdiniUPD", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@IDOrdini", SqlDbType.Int).Value = idOrdini; + cmd.Parameters.Add("@Qta", SqlDbType.Decimal).Value = QtaInPtf; + con.Open(); + cmd.ExecuteNonQuery(); + } + //ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"ID Ordini = "+idOrdini + " QtaInPtf = " + QtaInPtf + "\");", true); + } + + protected void ASPxGVOrdini_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) + { + // Colora cella della colonna DivisaRegolamento se è presente (*) ovvero non è salvato nel db il valore + if (e.DataColumn.FieldName.Contains("DivisaRegolamento") && e.CellValue.ToString().IndexOf("(*)") != -1) + { + e.Cell.BackColor = System.Drawing.Color.OrangeRed; + } + // Colora cella della colonna DivisaRegolamento se è vuota + if (e.DataColumn.FieldName.Contains("DivisaRegolamento") && String.IsNullOrEmpty(e.CellValue.ToString())) + { + e.Cell.BackColor = System.Drawing.Color.Red; + } + } + + //protected void ASPxStrumento_SelectedIndexChanged(object sender, EventArgs e) + //{ + // ASPxPCSObbligazioni.Enabled = (ASPxStrumento.SelectedIndex == 4); + //} + + private void ReloadTables() + { + //dtMercati = ((DataView)SqlDSMercati.Select(DataSourceSelectArguments.Empty)).Table; + dtTitoli = ((DataView)SqlDSTitoli.Select(DataSourceSelectArguments.Empty)).Table; + dtClienti = ((DataView)SqlDSClienti.Select(DataSourceSelectArguments.Empty)).Table; + //ReloadOrdini(); + } + + private void ReloadOrdini() + { + // Rileva gruppi selezionati per la visualizzazione degli ordini relativi ai clienti associati ai gruppi + paramGruppi = ""; + foreach (ListEditItem item in ASPxCBLGruppi.SelectedItems) + { + InserisceOrdini(item.Text, ASPxLabelISIN.Text); // *** da rimettere + //InserisceOrdini(item.Text, "XS1119159546"); *** per debug + paramGruppi = paramGruppi + item.Text + ","; + } + + SqlDSOrdini.SelectCommand = "GDN_LoadOrdini_v3"; + SqlDSOrdini.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; + Parameter p = SqlDSOrdini.SelectParameters["ISIN"]; + SqlDSOrdini.SelectParameters.Remove(p); + Parameter q = SqlDSOrdini.SelectParameters["Gruppi"]; + SqlDSOrdini.SelectParameters.Remove(q); + SqlDSOrdini.SelectParameters.Add("ISIN", ASPxLabelISIN.Text); //*** da rimettere + //SqlDSOrdini.SelectParameters.Add("ISIN", "XS1119159546"); *** per debug + SqlDSOrdini.SelectParameters.Add("Gruppi", paramGruppi); + ASPxGVOrdini.KeyFieldName = "IDOrdini"; + ASPxGVOrdini.DataBind(); + } + + private void ReloadOrdiniPerExcel() + { + // Rileva gruppi selezionati per il caricamento degli ordini relativi ai clienti associati ai gruppi + string paramGruppi = ""; + if (ASPxCBLGruppiExcel.SelectedItems.Count > 0) + { + foreach (ListEditItem item in ASPxCBLGruppiExcel.SelectedItems) + { + paramGruppi = paramGruppi + item.Text + ","; + } + + SqlDSOrdiniPerExcel.SelectCommand = "GDN_LoadExcelOrdini_v3"; + SqlDSOrdiniPerExcel.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; + Parameter p = SqlDSOrdiniPerExcel.SelectParameters["fromDate"]; + SqlDSOrdiniPerExcel.SelectParameters.Remove(p); + Parameter q = SqlDSOrdiniPerExcel.SelectParameters["Gruppi"]; + SqlDSOrdiniPerExcel.SelectParameters.Remove(q); + SqlDSOrdiniPerExcel.SelectParameters.Add("fromDate", ASPxDataUltimaModifica.Date.ToString("yyyy-MM-dd")); + SqlDSOrdiniPerExcel.SelectParameters.Add("Gruppi", paramGruppi); + ASPxOrdiniPerExcel.KeyFieldName = "IDOrdini"; + ASPxOrdiniPerExcel.DataBind(); + } + } + + private void AggiornaPrezzo_Ordini(int idOrdini, double prezzo) + { + string connectionString = Properties.Settings.Default.SqlConnection; + using (var con = new SqlConnection(connectionString)) + { + var cmd = new SqlCommand + { + CommandText = "dbo.GDN_PrezzoOrdiniUPD", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@IDOrdini", SqlDbType.Int).Value = idOrdini; + cmd.Parameters.Add("@Prezzo", SqlDbType.Float).Value = prezzo; + con.Open(); + cmd.ExecuteNonQuery(); + } + } + + private void SettaColonneExcel(bool Show) + { + ASPxOrdiniPerExcel.Columns["prog"].Visible = Show; + //ASPxOrdiniPerExcel.Columns["prog"].ExportWidth = 5; + ASPxOrdiniPerExcel.Columns["rif"].Visible = Show; + //ASPxOrdiniPerExcel.Columns["rif"].ExportWidth = 5; + ASPxOrdiniPerExcel.Columns["simulazione"].Visible = Show; + //ASPxOrdiniPerExcel.Columns["simulazione"].ExportWidth = 5; + ASPxOrdiniPerExcel.Columns["spuntato"].Visible = Show; + ASPxOrdiniPerExcel.Columns["storicizzato"].Visible = Show; + ASPxOrdiniPerExcel.Columns["storno"].Visible = Show; + ASPxOrdiniPerExcel.Columns["annullato"].Visible = Show; + ASPxOrdiniPerExcel.Columns["ora_ope"].Visible = Show; + ASPxOrdiniPerExcel.Columns["cod_tit"].Visible = Show; + ASPxOrdiniPerExcel.Columns["cod_esterno"].Visible = Show; + ASPxOrdiniPerExcel.Columns["rateo"].Visible = Show; + ASPxOrdiniPerExcel.Columns["cambiom"].Visible = Show; + ASPxOrdiniPerExcel.Columns["cod_dep_liq"].Visible = Show; + ASPxOrdiniPerExcel.Columns["cod_dep_liq2"].Visible = Show; + ASPxOrdiniPerExcel.Columns["ctv_rat_dn"].Visible = Show; + ASPxOrdiniPerExcel.Columns["comp_dep_dn"].Visible = Show; + ASPxOrdiniPerExcel.Columns["coma_dep_dn"].Visible = Show; + ASPxOrdiniPerExcel.Columns["comp_alt_dn"].Visible = Show; + ASPxOrdiniPerExcel.Columns["coma_alt_dn"].Visible = Show; + ASPxOrdiniPerExcel.Columns["spese_dn"].Visible = Show; + ASPxOrdiniPerExcel.Columns["imposte_dn"].Visible = Show; + ASPxOrdiniPerExcel.Columns["margini_dn"].Visible = Show; + ASPxOrdiniPerExcel.Columns["ctv_rat_dr"].Visible = Show; + ASPxOrdiniPerExcel.Columns["comp_dep_dr"].Visible = Show; + ASPxOrdiniPerExcel.Columns["coma_dep_dr"].Visible = Show; + ASPxOrdiniPerExcel.Columns["comp_alt_dr"].Visible = Show; + ASPxOrdiniPerExcel.Columns["coma_alt_dr"].Visible = Show; + ASPxOrdiniPerExcel.Columns["spese_dr"].Visible = Show; + ASPxOrdiniPerExcel.Columns["imposte_dr"].Visible = Show; + ASPxOrdiniPerExcel.Columns["des_mov"].Visible = Show; + ASPxOrdiniPerExcel.Columns["rif_est"].Visible = Show; + ASPxOrdiniPerExcel.Columns["coordinate1"].Visible = Show; + ASPxOrdiniPerExcel.Columns["coordinate2"].Visible = Show; + ASPxOrdiniPerExcel.Columns["data_sto"].Visible = Show; + ASPxOrdiniPerExcel.Columns["progr_sto"].Visible = Show; + ASPxOrdiniPerExcel.Columns["prezzo_car"].Visible = Show; + ASPxOrdiniPerExcel.Columns["cod_div_ds"].Visible = Show; + ASPxOrdiniPerExcel.Columns["cambiom_ds"].Visible = Show; + ASPxOrdiniPerExcel.Columns["cambiod_ds"].Visible = Show; + ASPxOrdiniPerExcel.Columns["ctv_tot_ds"].Visible = Show; + ASPxOrdiniPerExcel.Columns["cod_mer"].Visible = Show; + ASPxOrdiniPerExcel.Columns["cash"].Visible = Show; + ASPxOrdiniPerExcel.Columns["des_tit"].Visible = Show; + ASPxOrdiniPerExcel.Columns["divisore"].Visible = Show; + ASPxOrdiniPerExcel.Columns["moltiplicatore"].Visible = Show; + ASPxOrdiniPerExcel.Columns["leva"].Visible = Show; + + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/GestioneOrdini.aspx.designer.cs b/OlympiaIntranet/GestioneOrdini.aspx.designer.cs new file mode 100644 index 0000000..cf2a63f --- /dev/null +++ b/OlympiaIntranet/GestioneOrdini.aspx.designer.cs @@ -0,0 +1,456 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class GestioneOrdiniGuardian { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxPageControl1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPageControl ASPxPageControl1; + + /// + /// ASPxRoundPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel1; + + /// + /// ASPxGVClienti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView ASPxGVClienti; + + /// + /// ASPxRoundPanel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel2; + + /// + /// ASPxGVMercati control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView ASPxGVMercati; + + /// + /// ASPxFLTitoli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFLTitoli; + + /// + /// ASPxCodiceTitolo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox ASPxCodiceTitolo; + + /// + /// ASPxRBLTipoTitolo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRadioButtonList ASPxRBLTipoTitolo; + + /// + /// ASPxStrumento control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxComboBox ASPxStrumento; + + /// + /// ASPxMercato control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxComboBox ASPxMercato; + + /// + /// ASPxPCSObbligazioni control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxComboBox ASPxPCSObbligazioni; + + /// + /// ASPxPCS control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox ASPxPCS; + + /// + /// ASPxLabelISIN control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabelISIN; + + /// + /// ASPxLabelDescrizioneBBG control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabelDescrizioneBBG; + + /// + /// ASPxLabelPrezzoBBG control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabelPrezzoBBG; + + /// + /// ASPxLabelDataPrezzoBBG control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabelDataPrezzoBBG; + + /// + /// ASPxLabelDivisaTitoloBBG control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabelDivisaTitoloBBG; + + /// + /// ASPxLabelQueryStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabelQueryStatus; + + /// + /// ASPxButtonQueryBBG control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxButtonQueryBBG; + + /// + /// ASPxRoundPanel3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel3; + + /// + /// ASPxCBLGruppi control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxCheckBoxList ASPxCBLGruppi; + + /// + /// ASPxButtonCaricaOrdini control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxButtonCaricaOrdini; + + /// + /// ASPxButtonCancellaOrdini control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxButtonCancellaOrdini; + + /// + /// ASPxLabel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel1; + + /// + /// ASPxTextBoxModificaPrezzo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox ASPxTextBoxModificaPrezzo; + + /// + /// ASPxButtonSavePrezzo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxButtonSavePrezzo; + + /// + /// ASPxLabel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel2; + + /// + /// ASPxDateDataValidita control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxDateEdit ASPxDateDataValidita; + + /// + /// ASPxButtonSaveDataValidita control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxButtonSaveDataValidita; + + /// + /// ASPxCancellaDataValidita control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxCancellaDataValidita; + + /// + /// ASPxLabel3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel3; + + /// + /// ASPxRBLTipoOp control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRadioButtonList ASPxRBLTipoOp; + + /// + /// ASPxButtonSaveTipoOp control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxButtonSaveTipoOp; + + /// + /// ASPxImportaQty control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxImportaQty; + + /// + /// ASPxGVOrdini control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView ASPxGVOrdini; + + /// + /// ASPxCBLGruppiExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxCheckBoxList ASPxCBLGruppiExcel; + + /// + /// ASPxDataUltimaModifica control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxDateEdit ASPxDataUltimaModifica; + + /// + /// ASPxButtonCaricaOrdiniExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxButtonCaricaOrdiniExcel; + + /// + /// ASPxDataInvio control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxDateEdit ASPxDataInvio; + + /// + /// ASPxButtonExportOrdiniExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxButtonExportOrdiniExcel; + + /// + /// ASPxRoundPanel4 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel4; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + + /// + /// ASPxOrdiniPerExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView ASPxOrdiniPerExcel; + + /// + /// SqlDSOrdini control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSOrdini; + + /// + /// SqlDSClienti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSClienti; + + /// + /// SqlDSMercati control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSMercati; + + /// + /// SqlDSTitoli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSTitoli; + + /// + /// SqlDSOrdiniPerExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSOrdiniPerExcel; + } +} diff --git a/OlympiaIntranet/Global.asax b/OlympiaIntranet/Global.asax new file mode 100644 index 0000000..364ff94 --- /dev/null +++ b/OlympiaIntranet/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="OlympiaIntranet.Global" Language="C#" %> diff --git a/OlympiaIntranet/Global.asax.cs b/OlympiaIntranet/Global.asax.cs new file mode 100644 index 0000000..bb61473 --- /dev/null +++ b/OlympiaIntranet/Global.asax.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Security; +using System.Web.SessionState; + +namespace OlympiaIntranet +{ + public class Global : System.Web.HttpApplication + { + protected void Application_Start(object sender, EventArgs e) + { + DevExpress.XtraReports.Web.ASPxReportDesigner.StaticInitialize(); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/Images/list.png b/OlympiaIntranet/Images/list.png new file mode 100644 index 0000000..1759ffb Binary files /dev/null and b/OlympiaIntranet/Images/list.png differ diff --git a/OlympiaIntranet/Images/lock.png b/OlympiaIntranet/Images/lock.png new file mode 100644 index 0000000..2ebc4f6 Binary files /dev/null and b/OlympiaIntranet/Images/lock.png differ diff --git a/OlympiaIntranet/Images/lock_open.png b/OlympiaIntranet/Images/lock_open.png new file mode 100644 index 0000000..a471765 Binary files /dev/null and b/OlympiaIntranet/Images/lock_open.png differ diff --git a/OlympiaIntranet/Images/logo_Olympia.jpg b/OlympiaIntranet/Images/logo_Olympia.jpg new file mode 100644 index 0000000..a53d55f Binary files /dev/null and b/OlympiaIntranet/Images/logo_Olympia.jpg differ diff --git a/OlympiaIntranet/Images/logo_bbg.jpg b/OlympiaIntranet/Images/logo_bbg.jpg new file mode 100644 index 0000000..32873b0 Binary files /dev/null and b/OlympiaIntranet/Images/logo_bbg.jpg differ diff --git a/OlympiaIntranet/Images/logo_sito.jpg b/OlympiaIntranet/Images/logo_sito.jpg new file mode 100644 index 0000000..b4c6a50 Binary files /dev/null and b/OlympiaIntranet/Images/logo_sito.jpg differ diff --git a/OlympiaIntranet/JsonInfoPortafoglio.cs b/OlympiaIntranet/JsonInfoPortafoglio.cs new file mode 100644 index 0000000..6885973 --- /dev/null +++ b/OlympiaIntranet/JsonInfoPortafoglio.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace InfoPortafoglio +{ + public partial class JsonInfoPortafoglio + { + [JsonProperty("errors")] + public Error[][] Errors { get; set; } + + [JsonProperty("results")] + public Results Results { get; set; } + } + + public partial class Results + { + [JsonProperty("covered_exposure")] + public double CoveredExposure { get; set; } + } + + public partial struct Error + { + public long? Integer; + public string String; + public string[] StringArray; + + public bool IsNull => StringArray == null && Integer == null && String == null; + } + + public partial class JsonInfoPortafoglio + { + public static JsonInfoPortafoglio FromJson(string json) => JsonConvert.DeserializeObject(json, InfoPortafoglio.Converter.Settings); + } + + public static class Serialize + { + public static string ToJson(this JsonInfoPortafoglio self) => JsonConvert.SerializeObject(self, InfoPortafoglio.Converter.Settings); + } + + internal static class Converter + { + public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings + { + MetadataPropertyHandling = MetadataPropertyHandling.Ignore, + DateParseHandling = DateParseHandling.None, + Converters = { + ErrorConverter.Singleton, + new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } + }, + }; + } + + internal class ErrorConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(Error) || t == typeof(Error?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + switch (reader.TokenType) + { + case JsonToken.Integer: + var integerValue = serializer.Deserialize(reader); + return new Error { Integer = integerValue }; + case JsonToken.String: + case JsonToken.Date: + var stringValue = serializer.Deserialize(reader); + return new Error { String = stringValue }; + case JsonToken.StartArray: + var arrayValue = serializer.Deserialize(reader); + return new Error { StringArray = arrayValue }; + } + throw new Exception("Cannot unmarshal type Error"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + var value = (Error)untypedValue; + if (value.Integer != null) + { + serializer.Serialize(writer, value.Integer.Value); + return; + } + if (value.String != null) + { + serializer.Serialize(writer, value.String); + return; + } + if (value.StringArray != null) + { + serializer.Serialize(writer, value.StringArray); + return; + } + throw new Exception("Cannot marshal type Error"); + } + + public static readonly ErrorConverter Singleton = new ErrorConverter(); + } + +} diff --git a/OlympiaIntranet/JsonVarPortafoglio.cs b/OlympiaIntranet/JsonVarPortafoglio.cs new file mode 100644 index 0000000..b74b80b --- /dev/null +++ b/OlympiaIntranet/JsonVarPortafoglio.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; + +using System.Globalization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace VarPortafoglio +{ + + public partial class JsonVarPortafoglio + { + [JsonProperty("errors")] + public Error[][] Errors { get; set; } + + [JsonProperty("results")] + public Result[] Results { get; set; } + } + + public partial class Result + { + [JsonProperty("var")] + //public double Var { get; set; } + public double? Var { get; set; } + + [JsonProperty("percentile")] + public double Percentile { get; set; } + + [JsonProperty("frequency")] + public long Frequency { get; set; } + + [JsonProperty("horizon")] + public long Horizon { get; set; } + + [JsonProperty("lookback_days")] + public long LookbackDays { get; set; } + } + + public partial struct Error + { + public long? Integer; + public string String; + public string[] StringArray; + + public bool IsNull => StringArray == null && Integer == null && String == null; + } + + public partial class JsonVarPortafoglio + { + public static JsonVarPortafoglio FromJson(string json) => JsonConvert.DeserializeObject(json, Converter.Settings); + } + + public static class Serialize + { + public static string ToJson(this JsonVarPortafoglio self) => JsonConvert.SerializeObject(self, Converter.Settings); + } + + internal static class Converter + { + public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings + { + MetadataPropertyHandling = MetadataPropertyHandling.Ignore, + DateParseHandling = DateParseHandling.None, + Converters = { + ErrorConverter.Singleton, + new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } + }, + }; + } + + internal class ErrorConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(Error) || t == typeof(Error?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + switch (reader.TokenType) + { + case JsonToken.Integer: + var integerValue = serializer.Deserialize(reader); + return new Error { Integer = integerValue }; + case JsonToken.String: + case JsonToken.Date: + var stringValue = serializer.Deserialize(reader); + return new Error { String = stringValue }; + case JsonToken.StartArray: + var arrayValue = serializer.Deserialize(reader); + return new Error { StringArray = arrayValue }; + } + throw new Exception("Cannot unmarshal type Error"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + var value = (Error)untypedValue; + if (value.Integer != null) + { + serializer.Serialize(writer, value.Integer.Value); + return; + } + if (value.String != null) + { + serializer.Serialize(writer, value.String); + return; + } + if (value.StringArray != null) + { + serializer.Serialize(writer, value.StringArray); + return; + } + throw new Exception("Cannot marshal type Error"); + } + + public static readonly ErrorConverter Singleton = new ErrorConverter(); + } +} diff --git a/OlympiaIntranet/JsonVarTitolo.cs b/OlympiaIntranet/JsonVarTitolo.cs new file mode 100644 index 0000000..f0ee41b --- /dev/null +++ b/OlympiaIntranet/JsonVarTitolo.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace VarTitolo +{ + + + public partial class JsonVarTitolo + { + [JsonProperty("errors")] + public Error[][] Errors { get; set; } + + [JsonProperty("results")] + public Result[] Results { get; set; } + } + + public partial class Result + { + [JsonProperty("var")] + //public object Var { get; set; } + public double? Var { get; set; } + + [JsonProperty("percentile")] + public double Percentile { get; set; } + + [JsonProperty("frequency")] + public long Frequency { get; set; } + + [JsonProperty("horizon")] + public long Horizon { get; set; } + + [JsonProperty("lookback_days")] + public long LookbackDays { get; set; } + } + + public partial struct Error + { + public long? Integer; + public string String; + public string[] StringArray; + + public bool IsNull => StringArray == null && Integer == null && String == null; + } + + public partial class JsonVarTitolo + { + public static JsonVarTitolo FromJson(string json) => JsonConvert.DeserializeObject(json, Converter.Settings); + } + + public static class Serialize + { + public static string ToJson(this JsonVarTitolo self) => JsonConvert.SerializeObject(self, Converter.Settings); + } + + internal static class Converter + { + public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings + { + MetadataPropertyHandling = MetadataPropertyHandling.Ignore, + DateParseHandling = DateParseHandling.None, + Converters = { + ErrorConverter.Singleton, + new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } + }, + }; + } + + internal class ErrorConverter : JsonConverter + { + public override bool CanConvert(Type t) => t == typeof(Error) || t == typeof(Error?); + + public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) + { + switch (reader.TokenType) + { + case JsonToken.Integer: + var integerValue = serializer.Deserialize(reader); + return new Error { Integer = integerValue }; + case JsonToken.String: + case JsonToken.Date: + var stringValue = serializer.Deserialize(reader); + return new Error { String = stringValue }; + case JsonToken.StartArray: + var arrayValue = serializer.Deserialize(reader); + return new Error { StringArray = arrayValue }; + } + throw new Exception("Cannot unmarshal type Error"); + } + + public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) + { + var value = (Error)untypedValue; + if (value.Integer != null) + { + serializer.Serialize(writer, value.Integer.Value); + return; + } + if (value.String != null) + { + serializer.Serialize(writer, value.String); + return; + } + if (value.StringArray != null) + { + serializer.Serialize(writer, value.StringArray); + return; + } + throw new Exception("Cannot marshal type Error"); + } + + public static readonly ErrorConverter Singleton = new ErrorConverter(); + } +} diff --git a/OlympiaIntranet/LimitiUcits.aspx b/OlympiaIntranet/LimitiUcits.aspx new file mode 100644 index 0000000..53bea99 --- /dev/null +++ b/OlympiaIntranet/LimitiUcits.aspx @@ -0,0 +1,141 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LimitiUcits.aspx.cs" Inherits="OlympiaIntranet.LimitiUcits" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + + +
+
+ + + + + + + + + + +
+ + + + + + + + + + + + <%----%> + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + diff --git a/OlympiaIntranet/LimitiUcits.aspx.cs b/OlympiaIntranet/LimitiUcits.aspx.cs new file mode 100644 index 0000000..e9ce075 --- /dev/null +++ b/OlympiaIntranet/LimitiUcits.aspx.cs @@ -0,0 +1,155 @@ +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class LimitiUcits : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + } + + protected void btnCaricaDati_Click(object sender, EventArgs e) + { + Session["cod_rap"] = txtPortafoglio.Text; + + // Formattazioni condizionali - colonna 10% (OLY) + GridViewFormatConditionHighlight Rule1 = new GridViewFormatConditionHighlight(); + Rule1.FieldName = "10% (OLY)"; + Rule1.Expression = "[10% (OLY)] <= 0.1 and [10% (OLY)] > 0"; + Rule1.Format = GridConditionHighlightFormat.YellowFillWithDarkYellowText; + gvLimitiUcits.FormatConditions.Add(Rule1); + + GridViewFormatConditionHighlight Rule11 = new GridViewFormatConditionHighlight(); + Rule11.FieldName = "10% (OLY)"; + Rule11.Expression = "[10% (OLY)] > 0.1"; + Rule11.Format = GridConditionHighlightFormat.LightRedFillWithDarkRedText; + gvLimitiUcits.FormatConditions.Add(Rule11); + + // Formattazioni condizionali - colonna 10% (C4F) + GridViewFormatConditionHighlight Rule2 = new GridViewFormatConditionHighlight(); + Rule2.FieldName = "10% (C4F)"; + Rule2.Expression = "[10% (C4F)] <= 0.1 and [10% (C4F)] > 0"; + Rule2.Format = GridConditionHighlightFormat.YellowFillWithDarkYellowText; + gvLimitiUcits.FormatConditions.Add(Rule2); + + GridViewFormatConditionHighlight Rule21 = new GridViewFormatConditionHighlight(); + Rule21.FieldName = "10% (C4F)"; + Rule21.Expression = "[10% (C4F)] > 0.1"; + Rule21.Format = GridConditionHighlightFormat.LightRedFillWithDarkRedText; + gvLimitiUcits.FormatConditions.Add(Rule21); + + // Formattazioni condizionali - colonna 5%-40% (OLY) + GridViewFormatConditionHighlight Rule3 = new GridViewFormatConditionHighlight(); + Rule3.FieldName = "5%-40% (OLY)"; + Rule3.Expression = "[5%-40% (OLY)] >= 0.05 and [5%-40% (OLY)] <= 0.1"; + Rule3.Format = GridConditionHighlightFormat.YellowFillWithDarkYellowText; + gvLimitiUcits.FormatConditions.Add(Rule3); + + GridViewFormatConditionHighlight Rule31 = new GridViewFormatConditionHighlight(); + Rule31.FieldName = "5%-40% (OLY)"; + Rule31.Expression = "[5%-40% (OLY)] > 0.1 and [5%-40% (OLY)] <> 0"; + Rule31.Format = GridConditionHighlightFormat.LightRedFillWithDarkRedText; + gvLimitiUcits.FormatConditions.Add(Rule31); + + // Formattazioni condizionali - colonna 10% (C4F) + GridViewFormatConditionHighlight Rule4 = new GridViewFormatConditionHighlight(); + Rule4.FieldName = "5%-40% (C4F)"; + Rule4.Expression = "[5%-40% (C4F)] >= 0.05 and [5%-40% (C4F)] <= 0.1"; + Rule4.Format = GridConditionHighlightFormat.YellowFillWithDarkYellowText; + gvLimitiUcits.FormatConditions.Add(Rule4); + + GridViewFormatConditionHighlight Rule41 = new GridViewFormatConditionHighlight(); + Rule41.FieldName = "5%-40% (C4F)"; + Rule41.Expression = "[5%-40% (C4F)] > 0.1 and [5%-40% (C4F)] <> 0"; + Rule41.Format = GridConditionHighlightFormat.LightRedFillWithDarkRedText; + gvLimitiUcits.FormatConditions.Add(Rule41); + + gvLimitiUcits.DataBind(); + + if (gvLimitiUcits.VisibleRowCount == 0) + { + CommonClass.MessageBox(this,"Consultare la posizione in Guardian e ripetere la richiesta!"); + // throw new MyException("Consultare la posizione in Guardian e ripetere la richiesta!"); + } + } + + protected void gvLimitiUcits_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridViewTableRowEventArgs e) + { + if (e.RowType != GridViewRowType.Data) return; + + // Colora sottostanti che non hanno emittente + string Emittente = e.GetValue("Emittente").ToString(); + string Descrizione = e.GetValue("Descrizione").ToString(); + + if (String.IsNullOrEmpty(Emittente) && Descrizione== "SOTTOSTANTE NON TROVATO!") + { + e.Row.BackColor = Color.OrangeRed; + } + + } + + protected void btnEsportaExcel_Click(object sender, EventArgs e) + { + ASPxGridViewExporter1.ExportSelectedRowsOnly = false; + ASPxGridViewExporter1.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - Esposizione Titoli"; + XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.WYSIWYG }; + ASPxGridViewExporter1.WriteXlsxToResponse(op); + } + + protected void gvLimitiUcits_CustomErrorText(object sender, ASPxGridViewCustomErrorTextEventArgs e) + { + // https://supportcenter.devexpress.com/ticket/details/e59/how-to-show-an-error-message-when-a-record-cannot-be-deleted + if (e.Exception is MyException) e.ErrorText = e.Exception.Message; + } + + protected void gvLimitiUcits_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) + { + if (e.DataColumn.FieldName == "Descrizione") + { + if (e.CellValue != null) + { + // Se viene rilevato un sintetico , allora viene caricato l'elenco dei possibili certificati all'interno del portafoglio guardian eventualmente da controllare + if (e.CellValue.ToString() == "POSSIBILE SINTETICO") + { + e.Cell.BackColor = ColorTranslator.FromHtml("#e44e2f"); // evidenzia cella con possibile errore da sistemare + + if (Session["cod_rap"] != null) + { + using (var con = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var cmd = new SqlCommand + { + CommandText = "GDN_EsposizioneTitoli_CTF", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.Add("@cod_rap", SqlDbType.VarChar).Value = Session["cod_rap"].ToString(); + con.Open(); // Open the SqlConnection. + object objResult = cmd.ExecuteScalar(); + if (objResult != null) + { + e.Cell.ToolTip = (string)objResult; + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/LimitiUcits.aspx.designer.cs b/OlympiaIntranet/LimitiUcits.aspx.designer.cs new file mode 100644 index 0000000..43b42bb --- /dev/null +++ b/OlympiaIntranet/LimitiUcits.aspx.designer.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class LimitiUcits { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxLabel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel ASPxLabel1; + + /// + /// ASPxPanel29 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel29; + + /// + /// txtPortafoglio control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxTextBox txtPortafoglio; + + /// + /// ASPxPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel1; + + /// + /// btnCaricaDati control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnCaricaDati; + + /// + /// ASPxPanel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPanel ASPxPanel2; + + /// + /// btnEsportaExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnEsportaExcel; + + /// + /// gvLimitiUcits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvLimitiUcits; + + /// + /// SqlDSEsposizioneTitoli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSEsposizioneTitoli; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + } +} diff --git a/OlympiaIntranet/LimitiViolati.aspx b/OlympiaIntranet/LimitiViolati.aspx new file mode 100644 index 0000000..e844c2f --- /dev/null +++ b/OlympiaIntranet/LimitiViolati.aspx @@ -0,0 +1,125 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LimitiViolati.aspx.cs" Inherits="OlympiaIntranet.LimitiViolati" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + Limiti Violati + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+ + diff --git a/OlympiaIntranet/LimitiViolati.aspx.cs b/OlympiaIntranet/LimitiViolati.aspx.cs new file mode 100644 index 0000000..afaac97 --- /dev/null +++ b/OlympiaIntranet/LimitiViolati.aspx.cs @@ -0,0 +1,323 @@ +using DevExpress.Web; +using System; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Web; + +namespace OlympiaIntranet +{ + public partial class LimitiViolati : System.Web.UI.Page + { + private static readonly string[] AdminUsers = { "fcostalonga", "fpisoni", "glicciardello", "erigo", "malfonsi" }; + + protected bool IsRiskManager + { + get { return Session["is_risk"] != null && (bool)Session["is_risk"]; } + } + + private string ConnectionString + { + get { return System.Configuration.ConfigurationManager.ConnectionStrings["OlympiaIntranet.Properties.Settings.SqlConnection"].ConnectionString; } + } + + // http://localhost:63155/LimitiViolati.aspx → usa l'utente loggato + // http://localhost:63155/LimitiViolati.aspx?user=fcostalonga → simula Risk Manager + // http://localhost:63155/LimitiViolati.aspx → usa l'utente loggato + + //protected void Page_Load(object sender, EventArgs e) + //{ + // if (!HttpContext.Current.User.Identity.IsAuthenticated) + // { + // Response.Redirect("~/SignIn.aspx"); + // return; + // } + + // // Usa il parametro URL se presente (solo per debug), altrimenti l'utente loggato + // string loggedUser = Request.QueryString["user"]; + // if (string.IsNullOrEmpty(loggedUser)) + // { + // loggedUser = HttpContext.Current.User.Identity.Name; + // } + + // if (!IsPostBack) + // { + // bool isRisk = AdminUsers.Contains(loggedUser); + // Session["is_risk"] = isRisk; + // Session["user_display"] = loggedUser; + + // if (isRisk) + // { + // Session["user"] = loggedUser; + // gridLookupGestore.Enabled = true; + // Session["cod_ges"] = string.Empty; + + // gridLookupGestore.DataBind(); + // gridLookupGestore.Value = "-- TUTTI --"; + // } + // else + // { + // string gestoreCode = loggedUser.Length > 1 + // ? loggedUser.Substring(1).ToUpper() + // : loggedUser.ToUpper(); + + // Session["user"] = loggedUser; + // Session["cod_ges"] = gestoreCode; + // gridLookupGestore.Enabled = false; + + // gridLookupGestore.DataBind(); + // gridLookupGestore.Value = gestoreCode; + // } + + + // // Bind SEMPRE - necessario per DevExpress + // BindGrid(); + // } + //} + + protected void Page_Load(object sender, EventArgs e) + { + if (!HttpContext.Current.User.Identity.IsAuthenticated) + { + Response.Redirect("~/SignIn.aspx"); + return; + } + + // Usa il parametro URL se presente (solo per debug), altrimenti l'utente loggato + string loggedUser = Request.QueryString["user"]; + if (string.IsNullOrEmpty(loggedUser)) + { + loggedUser = HttpContext.Current.User.Identity.Name; + } + + // SEMPRE determinare e impostare il ruolo ad ogni request + bool isRisk = AdminUsers.Contains(loggedUser); + Session["is_risk"] = isRisk; + Session["user_display"] = loggedUser; + Session["user"] = loggedUser; + + if (!IsPostBack) + { + // Forza il rebind del dropdown con l'utente corretto + gridLookupGestore.DataBind(); + + if (isRisk) + { + gridLookupGestore.Enabled = true; + Session["cod_ges"] = string.Empty; + gridLookupGestore.Value = "-- TUTTI --"; + } + else + { + string gestoreCode = loggedUser.Length > 1 + ? loggedUser.Substring(1).ToUpper() + : loggedUser.ToUpper(); + + Session["cod_ges"] = gestoreCode; + gridLookupGestore.Enabled = false; + gridLookupGestore.Value = gestoreCode; + } + + BindGrid(); + } + } + + protected void gridLookupGestore_ValueChanged(object sender, EventArgs e) + { + var gridLookup = sender as ASPxGridLookup; + + if (gridLookup?.Value != null) + { + string selectedValue = gridLookup.Value.ToString(); + Session["cod_ges"] = (selectedValue == "-- TUTTI --") ? string.Empty : selectedValue; + } + else + { + Session["cod_ges"] = string.Empty; + } + + BindGrid(); + } + + //private void BindGrid() + //{ + // string gestore = Session["cod_ges"]?.ToString() ?? string.Empty; + + // using (var conn = new SqlConnection(ConnectionString)) + // { + // using (var cmd = new SqlCommand("GDN_GetLimitiViolatiMensili", conn)) + // { + // cmd.CommandType = CommandType.StoredProcedure; + // cmd.Parameters.AddWithValue("@Gestore", gestore); + + // var adapter = new SqlDataAdapter(cmd); + // var dt = new DataTable(); + // adapter.Fill(dt); + + // gvLimitiViolati.DataSource = dt; + // gvLimitiViolati.DataBind(); + + // // Aggiorna label mese riferimento + // if (dt.Rows.Count > 0 && dt.Columns.Contains("DataRiferimento")) + // { + // object dataRif = dt.Rows[0]["DataRiferimento"]; + // if (dataRif != null && dataRif != DBNull.Value) + // { + // DateTime data = Convert.ToDateTime(dataRif); + // lblMeseRiferimento.Text = "Data di riferimento: " + data.ToString("dd-MM-yyyy"); + // } + // } + // else + // { + // lblMeseRiferimento.Text = "Nessun limite violato trovato"; + // } + // } + // } + //} + + protected void gvLimitiViolati_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) + { + try + { + int id = Convert.ToInt32(e.Keys["Id"]); + string commento = e.NewValues["Commento"]?.ToString() ?? string.Empty; + bool bloccoCommento = e.NewValues["BloccoCommento"] != null && Convert.ToBoolean(e.NewValues["BloccoCommento"]); + string utente = Session["user_display"]?.ToString() ?? "unknown"; + bool isRiskManager = IsRiskManager; + + using (var conn = new SqlConnection(ConnectionString)) + { + using (var cmd = new SqlCommand("GDN_AggiornaCommentoLimite", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@Id", id); + cmd.Parameters.AddWithValue("@Commento", commento); + cmd.Parameters.AddWithValue("@BloccoCommento", bloccoCommento); + cmd.Parameters.AddWithValue("@Utente", utente); + cmd.Parameters.AddWithValue("@IsRiskManager", isRiskManager); + + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + + e.Cancel = true; + gvLimitiViolati.CancelEdit(); + BindGrid(); + } + catch (SqlException ex) + { + e.Cancel = true; + gvLimitiViolati.CancelEdit(); + lblMeseRiferimento.Text = "Errore: " + ex.Message; + } + } + + protected void gvLimitiViolati_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e) + { + var grid = sender as ASPxGridView; + + if (e.Column.FieldName == "Commento") + { + bool bloccato = false; + object valBlocco = grid.GetRowValues(e.VisibleIndex, "BloccoCommento"); + if (valBlocco != null && valBlocco != DBNull.Value) + { + bloccato = Convert.ToBoolean(valBlocco); + } + + if (bloccato && !IsRiskManager) + { + e.Editor.ReadOnly = true; + e.Editor.BackColor = Color.LightGray; + } + } + + if (e.Column.FieldName == "BloccoCommento") + { + if (!IsRiskManager) + { + e.Editor.ReadOnly = true; + e.Editor.Enabled = false; + } + } + } + + protected void gvLimitiViolati_DataBound(object sender, EventArgs e) + { + // Lasciato vuoto - la label viene aggiornata in BindGrid() + } + + protected void gvLimitiViolati_CancelRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e) + { + // Gestione annullamento edit + } + + protected void gvLimitiViolati_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) + { + // Solo per la colonna Commento + if (e.DataColumn.FieldName != "Commento") + return; + + // Leggi il valore di BloccoCommento per questa riga + object valBlocco = e.GetValue("BloccoCommento"); + bool bloccato = valBlocco != null && valBlocco != DBNull.Value && Convert.ToBoolean(valBlocco); + + if (bloccato) + { + e.Cell.BackColor = Color.FromArgb(255, 230, 230); // Rosso chiaro/rosa + e.Cell.ToolTip = "Commento bloccato"; + } + } + + private DataTable GetLimitiViolatiData() + { + string gestore = Session["cod_ges"]?.ToString() ?? string.Empty; + + using (var conn = new SqlConnection(ConnectionString)) + { + using (var cmd = new SqlCommand("GDN_GetLimitiViolatiMensili", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@Gestore", gestore); + + var adapter = new SqlDataAdapter(cmd); + var dt = new DataTable(); + adapter.Fill(dt); + return dt; + } + } + } + + private void BindGrid() + { + var dt = GetLimitiViolatiData(); + + gvLimitiViolati.DataSource = dt; + gvLimitiViolati.DataBind(); + + // Aggiorna label mese riferimento + if (dt.Rows.Count > 0 && dt.Columns.Contains("DataRiferimento")) + { + object dataRif = dt.Rows[0]["DataRiferimento"]; + if (dataRif != null && dataRif != DBNull.Value) + { + DateTime data = Convert.ToDateTime(dataRif); + lblMeseRiferimento.Text = "Mese di riferimento: " + data.ToString("dd-MM-yyyy"); + } + } + else + { + lblMeseRiferimento.Text = "Nessun limite violato trovato"; + } + } + + protected void gvLimitiViolati_DataBinding(object sender, EventArgs e) + { + //var grid = sender as ASPxGridView; + //grid.DataSource = GetLimitiViolatiData(); + gvLimitiViolati.DataSource = GetLimitiViolatiData(); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/LimitiViolati.aspx.designer.cs b/OlympiaIntranet/LimitiViolati.aspx.designer.cs new file mode 100644 index 0000000..30ee517 --- /dev/null +++ b/OlympiaIntranet/LimitiViolati.aspx.designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class LimitiViolati + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// gridLookupGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupGestore; + + /// + /// lblMeseRiferimento control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel lblMeseRiferimento; + + /// + /// gvLimitiViolati control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvLimitiViolati; + + /// + /// SqlDSGestori control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGestori; + } +} diff --git a/OlympiaIntranet/Login.aspx b/OlympiaIntranet/Login.aspx new file mode 100644 index 0000000..d112a9a --- /dev/null +++ b/OlympiaIntranet/Login.aspx @@ -0,0 +1,81 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Main.Login1" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Responsive image +
+
+
+
+
+ OLYMPIA INTRANET LOGIN +
+ + +
+
+ + +
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + diff --git a/OlympiaIntranet/Login.aspx.cs b/OlympiaIntranet/Login.aspx.cs new file mode 100644 index 0000000..29979a9 --- /dev/null +++ b/OlympiaIntranet/Login.aspx.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Main +{ + public partial class Login1 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + Response.Redirect("SignIn.aspx"); // redirect a nuova pagina login basata su ASP.NET Identity + + // vecchio metodo di login basato su asp.net membership login (non più usato) + //if (Request.Form["username"] != null && Request.Form["pass"] != null) + //{ + // if (Membership.ValidateUser(Request.Form["username"].ToString(), Request.Form["pass"].ToString())) + // { + // //Response.Redirect("Default.aspx"); + // FormsAuthentication.RedirectFromLoginPage(Request.Form["username"].ToString(), true); + // } + // else + // { + // Response.StatusCode = 401; + // Response.End(); + // } + //} + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/Login.aspx.designer.cs b/OlympiaIntranet/Login.aspx.designer.cs new file mode 100644 index 0000000..35a259d --- /dev/null +++ b/OlympiaIntranet/Login.aspx.designer.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Main { + + + public partial class Login1 { + } +} diff --git a/OlympiaIntranet/MSReset.aspx b/OlympiaIntranet/MSReset.aspx new file mode 100644 index 0000000..9b95486 --- /dev/null +++ b/OlympiaIntranet/MSReset.aspx @@ -0,0 +1,140 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MSReset.aspx.cs" Inherits="OlympiaIntranet.MSReset" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + + + + --%> + + + + + + + <%-- + + + + + + + --%> + + + + + + + + +
+ + diff --git a/OlympiaIntranet/MSReset.aspx.cs b/OlympiaIntranet/MSReset.aspx.cs new file mode 100644 index 0000000..1776816 --- /dev/null +++ b/OlympiaIntranet/MSReset.aspx.cs @@ -0,0 +1,531 @@ +using ClosedXML.Excel; +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using MySqlConnector; +using System; +using System.Collections.Generic; +using System.Data; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Threading; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class MSReset : System.Web.UI.Page + { + DataTable dtOutputTrades = new DataTable(); + + protected void Page_Init(object sender, EventArgs e) + { + CultureInfo ci = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone(); + ci.NumberFormat.NumberDecimalSeparator = ","; + Thread.CurrentThread.CurrentCulture = ci; + } + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + //Bind the grid only once + if (!IsPostBack) + gvInputCsv.DataBind(); + + } + + public DataTable ResetFileToDataTable(UploadedFile uploadedFile) + { + // ref link: https://www.c-sharpcorner.com/blogs/read-csv-file-into-data-table1 + + DataTable dtCsv = new DataTable(); + string Fulltext; + if (uploadedFile.IsValid) //if (FileUpload.HasFile && IsPostBack) + { + using (StreamReader sr = new StreamReader(uploadedFile.FileContent)) + { + while (!sr.EndOfStream) + { + Fulltext = sr.ReadToEnd().ToString(); //read full file text + string[] rows = Fulltext.Split('\n'); //split full file text into rows + for (int i = 1; i < rows.Count() - 2; i++) // la prima riga la ignora! + { + string[] rowValues = rows[i].Split(','); //split each row with , to get individual values + { + if (i == 1) + { + for (int j = 0; j < rowValues.Count(); j++) + { + if (rowValues[j] == "Security Description") dtCsv.Columns.Add("Stock description"); // se il file è giornaliero differisce solo per il nome colonna Security Description che deve diventare Stock description + else dtCsv.Columns.Add(rowValues[j]); //add headers + } + } + else + { + DataRow dr = dtCsv.NewRow(); + for (int k = 0; k < rowValues.Count(); k++) + { + dr[k] = rowValues[k].ToString().Replace(",", ".").Replace("\"",string.Empty); + } + dtCsv.Rows.Add(dr); //add other rows + } + } + } + } + } + } + return dtCsv; + } + + protected void uploadControl_FileUploadComplete(object sender, FileUploadCompleteEventArgs e) + { + if (radioButtonList.SelectedIndex == 0) // da fare caso radioButtonList.SelectedIndex == 1 ! + { + Session["dtResetFile"] = ResetFileToDataTable(e.UploadedFile); + + } + } + + protected void gvInputCsv_DataBinding(object sender, EventArgs e) + { + if (Session["dtResetFile"] != null) + { + gvInputCsv.DataSource = (DataTable)Session["dtResetFile"]; + } + } + + protected void btnElaboraInput_Click(object sender, EventArgs e) + { + // Serve solo per effettuare il postback e bindare gvInputCsv al datatable contenuto in Session["dtResetFile"] + + // Importa struttura colonne file excel in output per Guardian + dtOutputTrades = ElaboraTemplateGuardian(Server.MapPath("~/App_Data/TEMPLATE/sample_imp_tra.xlsx"), "Foglio1"); // Importa colonne file template in output per Guardian + + //if (radioButtonList.SelectedIndex == 0) ElaboraMSResetFileDaily(); // Elabora reset file NON PIU' USATO IL DAILY dal 30/07/2021 + + if (radioButtonList.SelectedIndex == 0) ElaboraMSResetFileWeekly(); // Elabora reset file + } + private void ElaboraMSResetFileWeekly() + { + DataTable dtResetFile = (DataTable)Session["dtResetFile"]; + if (dtResetFile.Rows.Count > 0) + { + double tempDouble = 0; + double quantity = 0; + foreach (DataRow rigaReset in dtResetFile.Rows) + { + if (rigaReset["Event"].ToString() != "RESET" + && rigaReset["Event"].ToString() != "C" + && rigaReset["Event"].ToString() != "DIV" + ) continue; // elabora la riga solo se Event=RESET o C o DIV altrimenti skippa, dr1,dr2 vengono create solo con EVENT=RESET, dr3 viene creata sia con RESET che C, dr4 viene creata solo se EVENT = DIV + + // Crea due righe in output per ogni riga in input + DataRow dr1 = dtOutputTrades.NewRow(); + DataRow dr2 = dtOutputTrades.NewRow(); + DataRow dr3 = dtOutputTrades.NewRow(); + DataRow dr4 = dtOutputTrades.NewRow(); + + // data_ope + dr1["data_ope"] = DateTime.ParseExact(rigaReset["End Date"].ToString(), "yyyy-MM-dd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy"); + dr2["data_ope"] = dr1["data_ope"]; + dr3["data_ope"] = dr1["data_ope"]; + dr4["data_ope"] = dr1["data_ope"]; + + // data_ins + dr1["data_ins"] = DateTime.ParseExact(rigaReset["End Date"].ToString(), "yyyy-MM-dd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy"); + dr2["data_ins"] = dr1["data_ins"]; + dr3["data_ins"] = dr1["data_ins"]; + dr4["data_ins"] = dr1["data_ins"]; + + // data_val + dr1["data_val"] = DateTime.ParseExact(rigaReset["Value Date"].ToString(), "yyyy-MM-dd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy"); + dr2["data_val"] = dr1["data_val"]; + dr3["data_val"] = dr1["data_val"]; + dr4["data_val"] = dr1["data_val"]; + + // prezzo + if (Double.TryParse(rigaReset["Mark Price2"].ToString().Replace(".", ","), out tempDouble)) dr1["prezzo"] = tempDouble; + else dr1["prezzo"] = DBNull.Value; + dr2["prezzo"] = dr1["prezzo"]; + + // cod_div_tit + dr1["cod_div_tit"] = rigaReset["Listing Ccy"]; + dr2["cod_div_tit"] = dr1["cod_div_tit"]; + dr3["cod_div_tit"] = dr1["cod_div_tit"]; + dr4["cod_div_tit"] = dr1["cod_div_tit"]; + + // qta e cod_ope (dr1 e dr2) + if (Double.TryParse(rigaReset["Quantity"].ToString().Replace(".", ","), out quantity)) { dr1["qta"] = quantity; dr2["qta"] = -quantity; } + else { dr1["qta"] = DBNull.Value; dr2["qta"] = DBNull.Value; } + if (quantity > 0) { dr1["cod_ope"] = "B"; dr2["cod_ope"] = "S"; } + else { dr1["cod_ope"] = "S"; dr2["cod_ope"] = "B"; } + + // qta,cod_ope,ctv_tit_dn,ctv_tot_dn,ctv_tit_dr,ctv_tot_dr (dr3) + if (Double.TryParse(rigaReset["Total"].ToString().Replace(".", ","), out tempDouble)) + { + dr3["qta"] = tempDouble; + if (tempDouble > 0) { dr3["cod_ope"] = "CREDMAR"; } else { dr3["cod_ope"] = "DEBTMAR"; } + dr3["ctv_tit_dn"] = tempDouble; + dr3["ctv_tot_dn"] = tempDouble; + dr3["ctv_tit_dr"] = tempDouble; + dr3["ctv_tot_dr"] = tempDouble; + + dr4["qta"] = tempDouble; + if (tempDouble > 0) { dr4["cod_ope"] = "CREDMAR"; } else { dr4["cod_ope"] = "DEBTMAR"; } + dr4["ctv_tit_dn"] = tempDouble; + dr4["ctv_tot_dn"] = tempDouble; + dr4["ctv_tit_dr"] = tempDouble; + dr4["ctv_tot_dr"] = tempDouble; + } + else + { + dr3["qta"] = DBNull.Value; + dr3["ctv_tit_dn"] = DBNull.Value; + dr3["ctv_tot_dn"] = DBNull.Value; + dr3["ctv_tit_dr"] = DBNull.Value; + dr3["ctv_tot_dr"] = DBNull.Value; + + dr4["qta"] = DBNull.Value; + dr4["ctv_tit_dn"] = DBNull.Value; + dr4["ctv_tot_dn"] = DBNull.Value; + dr4["ctv_tit_dr"] = DBNull.Value; + dr4["ctv_tot_dr"] = DBNull.Value; + } + + // cod_tit + string cod_tit = execSP_Scalar("SELECT t.cod_tit FROM tit t WHERE t.cod_isin_sot='" + rigaReset["ISIN"].ToString() + "' and t.cfd='S';"); + dr1["cod_tit"] = cod_tit; + dr2["cod_tit"] = cod_tit; + dr3["cod_tit"] = cod_tit; + dr4["cod_tit"] = cod_tit; + + // cod_rap + if (rigaReset["Account Number"].ToString() == "061787OC") { dr1["cod_rap"] = "DB6289"; dr2["cod_rap"] = "DB6289"; dr3["cod_rap"] = "DB6289"; dr4["cod_rap"] = "DB6289"; } // Fondo Plurima + if (rigaReset["Account Number"].ToString() == "061787VN") { dr1["cod_rap"] = "GP11950"; dr2["cod_rap"] = "GP11950"; dr3["cod_rap"] = "GP11950"; dr4["cod_rap"] = "GP11950"; } // Fondo Hector + + // cod_dep_liq + dr1["cod_dep_liq"] = "LIQCFD" + rigaReset["Swap Settlement Currency"].ToString(); + dr2["cod_dep_liq"] = dr1["cod_dep_liq"]; + + // cod_div_reg + dr1["cod_div_reg"] = rigaReset["Swap Settlement Currency"]; + dr2["cod_div_reg"] = dr1["cod_div_reg"]; + dr3["cod_div_reg"] = dr1["cod_div_reg"]; + dr4["cod_div_reg"] = dr1["cod_div_reg"]; + + // cod_dep_tit + dr1["cod_dep_tit"] = "DEPTIT"; + dr2["cod_dep_tit"] = "DEPTIT"; + + // cod_ctp + dr1["cod_ctp"] = "MSP"; + dr2["cod_ctp"] = "MSP"; + dr3["cod_ctp"] = "MSP"; + dr4["cod_ctp"] = "MSP"; + + // des_mov + dr1["des_mov"] = string.Format("Reset open {0}", rigaReset["Stock description"]); + dr2["des_mov"] = string.Format("Reset close {0} ", rigaReset["Stock description"]); + dr3["des_mov"] = string.Format("Reset payment {0}", rigaReset["Stock description"]); + dr4["des_mov"] = string.Format("Dividend payment {0}", rigaReset["Stock description"]); + + if (rigaReset["Event"].ToString() == "RESET") dtOutputTrades.Rows.Add(dr1); // creata solo se Event=RESET + if (rigaReset["Event"].ToString() == "RESET") dtOutputTrades.Rows.Add(dr2); // creata solo se Event=RESET + dtOutputTrades.Rows.Add(dr3); // creata sempre quindi Event=RESET o Event=C + if (rigaReset["Event"].ToString() == "DIV") dtOutputTrades.Rows.Add(dr4); // creata solo se Event=DIV + } + if (dtOutputTrades.Rows.Count > 0) + { + DataView dv = dtOutputTrades.DefaultView; + dv.Sort = "des_mov"; + DataTable sortedDT = dv.ToTable(); + + //Session["dtOutputTrades"] = (DataTable)dtOutputTrades; + Session["dtOutputTrades"] = (DataTable)sortedDT; + gvOutput.DataSource = Session["dtOutputTrades"]; + gvOutput.DataBind(); + } + } + } + + private void ElaboraMSResetFileDaily() + { + DataTable dtResetFile = (DataTable)Session["dtResetFile"]; + if (dtResetFile.Rows.Count > 0) + { + double tempDouble = 0; + double quantity = 0; + foreach (DataRow rigaReset in dtResetFile.Rows) + { + if (rigaReset["Event"].ToString() != "RESET" + && rigaReset["Event"].ToString() != "C" + && rigaReset["Event"].ToString() != "DIV" + ) continue; // elabora la riga solo se Event=RESET o C o DIV altrimenti skippa, dr1,dr2 vengono create solo con EVENT=RESET, dr3 viene creata sia con RESET che C, dr4 viene creata solo se EVENT = DIV + + // Crea due righe in output per ogni riga in input + DataRow dr1 = dtOutputTrades.NewRow(); + DataRow dr2 = dtOutputTrades.NewRow(); + DataRow dr3 = dtOutputTrades.NewRow(); + DataRow dr4 = dtOutputTrades.NewRow(); + + // data_ope + dr1["data_ope"] = DateTime.ParseExact(rigaReset["End Date"].ToString(), "yyyy-MM-dd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy"); + dr2["data_ope"] = dr1["data_ope"]; + dr3["data_ope"] = dr1["data_ope"]; + dr4["data_ope"] = dr1["data_ope"]; + + // data_ins + dr1["data_ins"] = DateTime.ParseExact(rigaReset["End Date"].ToString(), "yyyy-MM-dd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy"); + dr2["data_ins"] = dr1["data_ins"]; + dr3["data_ins"] = dr1["data_ins"]; + dr4["data_ins"] = dr1["data_ins"]; + + // data_val + dr1["data_val"] = DateTime.ParseExact(rigaReset["Value Date"].ToString(), "yyyy-MM-dd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy"); + dr2["data_val"] = dr1["data_val"]; + dr3["data_val"] = dr1["data_val"]; + dr4["data_val"] = dr1["data_val"]; + + // prezzo + if (Double.TryParse(rigaReset["Mark Price2"].ToString().Replace(".", ","), out tempDouble)) dr1["prezzo"] = tempDouble; + else dr1["prezzo"] = DBNull.Value; + dr2["prezzo"] = dr1["prezzo"]; + + // cod_div_tit + dr1["cod_div_tit"] = rigaReset["Listing Ccy"]; + dr2["cod_div_tit"] = dr1["cod_div_tit"]; + dr3["cod_div_tit"] = dr1["cod_div_tit"]; + dr4["cod_div_tit"] = dr1["cod_div_tit"]; + + // qta e cod_ope (dr1 e dr2) + if (Double.TryParse(rigaReset["Quantity"].ToString().Replace(".", ","), out quantity)) { dr1["qta"] = quantity; dr2["qta"] = -quantity; } + else { dr1["qta"] = DBNull.Value; dr2["qta"] = DBNull.Value; } + if (quantity > 0) { dr1["cod_ope"] = "B"; dr2["cod_ope"] = "S"; } + else { dr1["cod_ope"] = "S"; dr2["cod_ope"] = "B"; } + + // qta,cod_ope,ctv_tit_dn,ctv_tot_dn,ctv_tit_dr,ctv_tot_dr (dr3) + if (Double.TryParse(rigaReset["Total"].ToString().Replace(".", ","), out tempDouble)) + { + dr3["qta"] = tempDouble; + if (tempDouble > 0) { dr3["cod_ope"] = "CREDMAR"; } else { dr3["cod_ope"] = "DEBTMAR"; } + dr3["ctv_tit_dn"] = tempDouble; + dr3["ctv_tot_dn"] = tempDouble; + dr3["ctv_tit_dr"] = tempDouble; + dr3["ctv_tot_dr"] = tempDouble; + + dr4["qta"] = tempDouble; + if (tempDouble > 0) { dr4["cod_ope"] = "CREDMAR"; } else { dr4["cod_ope"] = "DEBTMAR"; } + dr4["ctv_tit_dn"] = tempDouble; + dr4["ctv_tot_dn"] = tempDouble; + dr4["ctv_tit_dr"] = tempDouble; + dr4["ctv_tot_dr"] = tempDouble; + } + else + { + dr3["qta"] = DBNull.Value; + dr3["ctv_tit_dn"] = DBNull.Value; + dr3["ctv_tot_dn"] = DBNull.Value; + dr3["ctv_tit_dr"] = DBNull.Value; + dr3["ctv_tot_dr"] = DBNull.Value; + + dr4["qta"] = DBNull.Value; + dr4["ctv_tit_dn"] = DBNull.Value; + dr4["ctv_tot_dn"] = DBNull.Value; + dr4["ctv_tit_dr"] = DBNull.Value; + dr4["ctv_tot_dr"] = DBNull.Value; + } + + // cod_tit + string cod_tit = execSP_Scalar("SELECT t.cod_tit FROM tit t WHERE t.cod_isin_sot='" + rigaReset["ISIN"].ToString() + "' and t.cfd='S';"); + dr1["cod_tit"] = cod_tit; + dr2["cod_tit"] = cod_tit; + dr3["cod_tit"] = cod_tit; + dr4["cod_tit"] = cod_tit; + + // cod_rap + if (rigaReset["Account Number"].ToString() == "061787OC") { dr1["cod_rap"] = "DB6289"; dr2["cod_rap"] = "DB6289"; dr3["cod_rap"] = "DB6289"; dr4["cod_rap"] = "DB6289"; } // Fondo Plurima + if (rigaReset["Account Number"].ToString() == "061787VN") { dr1["cod_rap"] = "GP11950"; dr2["cod_rap"] = "GP11950"; dr3["cod_rap"] = "GP11950"; dr4["cod_rap"] = "GP11950"; } // Fondo Hector + + // cod_dep_liq + dr1["cod_dep_liq"] = "LIQCFD" + rigaReset["Swap Settlement Currency"].ToString(); + dr2["cod_dep_liq"] = dr1["cod_dep_liq"]; + + // cod_div_reg + dr1["cod_div_reg"] = rigaReset["Swap Settlement Currency"]; + dr2["cod_div_reg"] = dr1["cod_div_reg"]; + dr3["cod_div_reg"] = dr1["cod_div_reg"]; + dr4["cod_div_reg"] = dr1["cod_div_reg"]; + + // cod_dep_tit + dr1["cod_dep_tit"] = "DEPTIT"; + dr2["cod_dep_tit"] = "DEPTIT"; + + // cod_ctp + dr1["cod_ctp"] = "MSP"; + dr2["cod_ctp"] = "MSP"; + dr3["cod_ctp"] = "MSP"; + dr4["cod_ctp"] = "MSP"; + + // des_mov + dr1["des_mov"] = string.Format("Reset open {0}", rigaReset["Security Description"]); + dr2["des_mov"] = string.Format("Reset close {0} ", rigaReset["Security Description"]); + dr3["des_mov"] = string.Format("Reset payment {0}", rigaReset["Security Description"]); + dr4["des_mov"] = string.Format("Dividend payment {0}", rigaReset["Security Description"]); + + if (rigaReset["Event"].ToString() == "RESET") dtOutputTrades.Rows.Add(dr1); // creata solo se Event=RESET + if (rigaReset["Event"].ToString() == "RESET") dtOutputTrades.Rows.Add(dr2); // creata solo se Event=RESET + dtOutputTrades.Rows.Add(dr3); // creata sempre quindi Event=RESET o Event=C + if (rigaReset["Event"].ToString() == "DIV") dtOutputTrades.Rows.Add(dr4); // creata solo se Event=DIV + } + if (dtOutputTrades.Rows.Count > 0) + { + DataView dv = dtOutputTrades.DefaultView; + dv.Sort = "des_mov"; + DataTable sortedDT = dv.ToTable(); + + //Session["dtOutputTrades"] = (DataTable)dtOutputTrades; + Session["dtOutputTrades"] = (DataTable)sortedDT; + gvOutput.DataSource = Session["dtOutputTrades"]; + gvOutput.DataBind(); + } + } + } + + private static string execSP_Scalar(string query) + { + object objResult; + string result = String.Empty; + using (var con = new MySqlConnection(Properties.Settings.Default.mySqlConnection)) + { + var cmd = new MySqlCommand + { + CommandText = query, + CommandType = CommandType.Text, + Connection = con + }; + cmd.CommandTimeout = 0; + con.Open(); // Open the SqlConnection. + objResult = cmd.ExecuteScalar(); + + if (objResult != null) result = objResult.ToString(); + } + return (result); + } + + public static DataTable ElaboraTemplateGuardian(string file, string sheetName) + { + // Open the Excel file using ClosedXML. + // Keep in mind the Excel file cannot be open when trying to read it + using (XLWorkbook workBook = new XLWorkbook(file)) + { + //Read the first Sheet from Excel file. + IXLWorksheet workSheet = workBook.Worksheet(1); + + //Create a new DataTable. + DataTable dt = new DataTable(); + + //Loop through the Worksheet rows. + bool firstRow = true; + foreach (IXLRow row in workSheet.Rows()) + { + //Use the first row to add columns to DataTable. + if (firstRow) + { + foreach (IXLCell cell in row.Cells()) + { + // Definisco tipo di colonna in tabella dt a seconda delle colonne di partenza del template + switch (cell.Value.ToString()) + { + //case "qta": + // dt.Columns.Add(cell.Value.ToString(),typeof(Int64)); + // break; + + case "qta": + case "prezzo": + case "cambiom": + case "ctv_tit_dr": + case "coma_dep_dr": + case "spese_dr": + case "ctv_tot_dr": + case "imposte_dr": + case "ctv_tit_dn": + case "imposte_dn": + case "ctv_tot_dn": + dt.Columns.Add(cell.Value.ToString(), typeof(double)); + break; + default: + dt.Columns.Add(cell.Value.ToString()); + break; + } + // dt.Columns.Add(cell.Value.ToString()); + } + firstRow = false; + } + else + { + //Add rows to DataTable. + dt.Rows.Add(); + int i = 0; + + foreach (IXLCell cell in row.Cells(row.FirstCellUsed().Address.ColumnNumber, row.LastCellUsed().Address.ColumnNumber)) + { + dt.Rows[dt.Rows.Count - 1][i] = cell.Value.ToString(); + i++; + } + } + } + + return dt; + } + } + + protected void btnOutputGuardian_Click(object sender, EventArgs e) + { + // Metodo 1) - Crea file di output in formato .xlsx per guardian relativo a MS Trades + // Prepare the response + string fileType = string.Empty; + if (radioButtonList.SelectedIndex == 0) fileType = "msreset"; + else fileType = "normaltrade"; + string excelTrades = string.Format("{0}_trades_{1:yyyyMMdd}.xlsx", fileType, DateTime.Today.Date); + HttpResponse httpResponse = Response; + httpResponse.Clear(); + httpResponse.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + httpResponse.AddHeader("content-disposition", string.Format("attachment;filename={0}", excelTrades)); + + // Flush the workbook to the Response.OutputStream + DataTable dt = (DataTable)Session["dtOutputTrades"]; + using (var workbook = new XLWorkbook()) + { + using (MemoryStream memoryStream = new MemoryStream()) + { + workbook.Worksheets.Add(dt, "Foglio1"); + workbook.SaveAs(memoryStream); + memoryStream.WriteTo(httpResponse.OutputStream); + memoryStream.Close(); + } + } + httpResponse.End(); + + // Metodo 2) Utilizzo AspxGridviewExporter per salvare xlsx in ouutput + //if (Session["dtOutputTrades"] != null) + //{ + // gvOutput.DataSource = (DataTable)Session["dtOutputTrades"]; + // gvOutput.DataBind(); + + // string fileType = string.Empty; + // if (radioButtonList.SelectedIndex == 0) fileType = "msreset"; + // else fileType = "normaltrade"; + // ASPxGridViewExporter1.FileName = String.Format("{0}_trades_{1:yyyyMMdd}.xlsx", fileType, DateTime.Today.Date); + // XlsxExportOptionsEx option = new XlsxExportOptionsEx { ExportType = ExportType.DataAware, TextExportMode = TextExportMode.Value }; + // ASPxGridViewExporter1.WriteXlsxToResponse(option); + //} + + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/MSReset.aspx.designer.cs b/OlympiaIntranet/MSReset.aspx.designer.cs new file mode 100644 index 0000000..386f3d5 --- /dev/null +++ b/OlympiaIntranet/MSReset.aspx.designer.cs @@ -0,0 +1,132 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class MSReset { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// radioButtonList control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRadioButtonList radioButtonList; + + /// + /// uploadControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxUploadControl uploadControl; + + /// + /// btnElaboraInput control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnElaboraInput; + + /// + /// btnOutputGuardian control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnOutputGuardian; + + /// + /// ASPxRoundPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel1; + + /// + /// ASPxPageControl1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPageControl ASPxPageControl1; + + /// + /// gvInputCsv control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvInputCsv; + + /// + /// gvOutput control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvOutput; + + /// + /// ASPxRoundPanel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel2; + + /// + /// ASPxRoundPanel3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel3; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + } +} diff --git a/OlympiaIntranet/Margini.aspx b/OlympiaIntranet/Margini.aspx new file mode 100644 index 0000000..b4b2900 --- /dev/null +++ b/OlympiaIntranet/Margini.aspx @@ -0,0 +1,131 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Margini.aspx.cs" Inherits="OlympiaIntranet.Margini" UICulture="it" Culture="it-IT" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/OlympiaIntranet/Margini.aspx.cs b/OlympiaIntranet/Margini.aspx.cs new file mode 100644 index 0000000..e5907b4 --- /dev/null +++ b/OlympiaIntranet/Margini.aspx.cs @@ -0,0 +1,433 @@ +using ClosedXML.Excel; +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using MySqlConnector; +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class Margini : System.Web.UI.Page + { + DataTable dtOutputTrades = new DataTable(); + protected override void InitializeCulture() // Aggiunto altrimenti in produzione prendeva settaggi USA per i decimali con il punto invece che con la virgola + { + Culture = "it-IT"; + UICulture = "it"; + + } + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + //Bind the grid only once + if (!IsPostBack) + { + gvInputCsv.DataBind(); + gvOutput.DataBind(); + gvPlurima10.DataBind(); + gvPlurimaVB.DataBind(); + } + } + + protected void uploadControl_FileUploadComplete(object sender, FileUploadCompleteEventArgs e) + { + Session["dtInputFile"] = ProcessInputFile(e.UploadedFile); + } + + public DataTable ProcessInputFile(UploadedFile uploadedFile) + { + // ref link: https://www.c-sharpcorner.com/blogs/read-csv-file-into-data-table1 + DataTable dtCsv = new DataTable(); + string Fulltext; + if (uploadedFile.IsValid) //if (FileUpload.HasFile && IsPostBack) + { + using (StreamReader sr = new StreamReader(uploadedFile.FileContent)) + { + while (!sr.EndOfStream) + { + Fulltext = sr.ReadToEnd().ToString(); //read full file text + string[] rows = Fulltext.Split('\n'); //split full file text into rows + for (int i = 0; i < rows.Count() - 1; i++) + { + string[] rowValues = rows[i].Split(','); //split each row with , to get individual values + { + if (i == 0) + { + for (int j = 0; j < rowValues.Count(); j++) + { + if (j == 0 || j == 1 || j == 3 || j == 10 || j == 13 || j == 15) dtCsv.Columns.Add(rowValues[j]); //add headers 0 - Business Date, 1 - Account ID,3 - Currency,10 - Open Trade Equity,13 - Initial Margin,15 - Margin Excess Deficit + } + } + else + { + DataRow dr = dtCsv.NewRow(); + int cont = 0; + for (int k = 0; k < rowValues.Count(); k++) + { + if (k == 0 || k == 1 || k == 3 || k == 10 || k == 13 || k == 15) + { + if (k == 13) // Se è colonna InitialMargin aggiungo un - davanti + { + if (rowValues[k].ToString() != "0" && rowValues[k].ToString().IndexOf("-")==-1) // se il valore non è 0 e non è negativo allora aggiunge il meno + { + dr[cont] = "-" + rowValues[k].ToString().Replace("\"", string.Empty); + } + if (rowValues[k].ToString() != "0" && rowValues[k].ToString().IndexOf("-") != -1) // se il valore non è 0 ed è negativo allora toglie il meno + { + dr[cont] = rowValues[k].ToString().Replace("\"", string.Empty).Replace("-",string.Empty); + } + if (rowValues[k].ToString() == "0") // se il valore e 0 non modifica niente + { + dr[cont] = "0"; + } + + } + else dr[cont] = rowValues[k].ToString().Replace("\"", string.Empty); + cont++; + } + } + dtCsv.Rows.Add(dr); //add other rows + } + } + } + } + } + } + return dtCsv; + } + + protected void gvInputCsv_DataBinding(object sender, EventArgs e) + { + if (Session["dtInputFile"] != null) + { + gvInputCsv.DataSource = (DataTable)Session["dtInputFile"]; + } + } + + protected void btnElaboraInput_Click(object sender, EventArgs e) + { + // Serve solo per effettuare il postback e bindare gvInputCsv al datatable contenuto in Session["dtResetFile"] + + // Importa struttura colonne file excel in output per Guardian + dtOutputTrades = ElaboraTemplateGuardian(Server.MapPath("~/App_Data/TEMPLATE/sample_imp_tra.xlsx"), "Foglio1"); // Importa colonne file template in output per Guardian + + //if (radioButtonList.SelectedIndex == 0) ElaboraMSResetFile(); // Elabora reset file + ElaboraOutputFile(); + + } + + private void ElaboraOutputFile() + { + DataTable dt = (DataTable)Session["dtInputFile"]; + DataTable dtPlurima10 = new DataTable(); + dtPlurima10.Columns.Add("Conto", typeof(string)); + dtPlurima10.Columns.Add("Descrizione", typeof(string)); + dtPlurima10.Columns.Add("Currency", typeof(string)); + dtPlurima10.Columns.Add("RBC", typeof(double)); + dtPlurima10.Columns.Add("Guardian", typeof(double)); + DataTable dtPlurimaVB = new DataTable(); + dtPlurimaVB.Columns.Add("Conto", typeof(string)); + dtPlurimaVB.Columns.Add("Descrizione", typeof(string)); + dtPlurimaVB.Columns.Add("Currency", typeof(string)); + dtPlurimaVB.Columns.Add("RBC", typeof(double)); + dtPlurimaVB.Columns.Add("Guardian", typeof(double)); + if (dt.Rows.Count > 0) + { + string currency = string.Empty; + string cod_rap = string.Empty; + foreach (DataRow rigaInput in dt.Rows) + { + /* + RBC Guardian + InitialMargin ETD Initial Marg + MarginExcessDeficit ETD Cash + OpenTradeEquity ETD Open Trade + */ + // Rileva valori da cui poi creare le righe se sono > 0 + if (rigaInput["AccountID"].ToString() == "C77261") cod_rap = "10CONV"; + if (rigaInput["AccountID"].ToString() == "C77260") cod_rap = "DB6289"; + currency = rigaInput["Currency"].ToString(); + double initialMargin, marginExcessDeficit, openTradeEquity, initialMarginGDN, marginExcessDeficitGDN, openTradeEquityGDN = 0; + double diffInitialMargin, diffMarginExcessDeficit, diffOpenTradeEquity = 0; + string temp = string.Empty; + + /// + /// Elabora InitialMargin (ETD Initial Marg) + /// + Double.TryParse(rigaInput["InitialMargin"].ToString().Replace(".", ","), out initialMargin); // Nota: E' stato necessario settare in aspx nella direttiva <%@ Page: UICulture="it" Culture="it-IT" e fare override InitializeCulture altrimenti in produzione prendeva il settaggio USA per i decimali con il punto come decimale invece della virgola ! + string cod_dep_liq_initialMarginGDN = String.Empty; + string descrInitialMarginGDN = String.Empty; + + temp = execSP_Scalar("SELECT tmp2.qta FROM tmppostit2 tmp2 LEFT JOIN tit t ON(t.cod_tit = tmp2.cod_tit) LEFT JOIN rap r ON(r.cod_rap = tmp2.cod_rap) WHERE r.cod_rap = '" + cod_rap + "' and t.cod_div = '" + currency + "' and t.des_tit like '%ETD Initial Marg%' AND r.cod_sta in ('ATTIVO', 'PENDING') LIMIT 1; "); + if (!String.IsNullOrEmpty(temp)) initialMarginGDN = Convert.ToDouble(temp); + else initialMarginGDN = 0; + cod_dep_liq_initialMarginGDN = execSP_Scalar("SELECT d.cod_dep_liq from depliq d where d.cod_rap = '" + cod_rap + "' and d.cod_div = '" + currency + "' and d.des_dep_liq like '%ETD Initial Marg%';"); + descrInitialMarginGDN = execSP_Scalar("SELECT t.des_tit FROM depliq d LEFT JOIN tit t ON (t.cod_tit = d.cod_dep_liq) WHERE d.cod_rap = '" + cod_rap + "' and d.cod_div = '" + currency + "' and d.des_dep_liq like '%ETD Initial Marg%';"); + + diffInitialMargin = Math.Round(initialMargin - initialMarginGDN, 2); + if (diffInitialMargin != 0) CreaRiga(currency, cod_rap, rigaInput, cod_dep_liq_initialMarginGDN, diffInitialMargin); + + if (cod_rap == "10CONV") CreaRigaPlurima(cod_dep_liq_initialMarginGDN, descrInitialMarginGDN, currency, initialMargin, initialMarginGDN, dtPlurima10); + if (cod_rap == "DB6289") CreaRigaPlurima(cod_dep_liq_initialMarginGDN, descrInitialMarginGDN, currency, initialMargin, initialMarginGDN, dtPlurimaVB); + + + /// + /// Elabora MarginExcessDeficit (ETD Cash) + /// + Double.TryParse(rigaInput["MarginExcessDeficit"].ToString().Replace(".", ","), out marginExcessDeficit); + string cod_dep_liq_marginExcessDeficitGDN = String.Empty; + string descrMarginExcessDeficitGDN = string.Empty; + temp = execSP_Scalar("SELECT tmp2.qta FROM tmppostit2 tmp2 LEFT JOIN tit t ON (t.cod_tit = tmp2.cod_tit) LEFT JOIN rap r ON (r.cod_rap = tmp2.cod_rap) WHERE r.cod_rap = '" + cod_rap + "' and t.cod_div = '" + currency + "' and t.des_tit like '%ETD Cash%' AND r.cod_sta in ('ATTIVO', 'PENDING') LIMIT 1;"); + if (!String.IsNullOrEmpty(temp)) marginExcessDeficitGDN = Convert.ToDouble(temp); + else marginExcessDeficitGDN = 0; + cod_dep_liq_marginExcessDeficitGDN = execSP_Scalar("SELECT d.cod_dep_liq from depliq d where d.cod_rap = '" + cod_rap + "' and d.cod_div = '" + currency + "' and d.des_dep_liq like '%ETD Cash%';"); + descrMarginExcessDeficitGDN = execSP_Scalar("SELECT t.des_tit FROM depliq d LEFT JOIN tit t ON (t.cod_tit = d.cod_dep_liq) WHERE d.cod_rap = '" + cod_rap + "' and d.cod_div = '" + currency + "' and d.des_dep_liq like '%ETD Cash%';"); + + diffMarginExcessDeficit = Math.Round(marginExcessDeficit - marginExcessDeficitGDN, 2); + if (diffMarginExcessDeficit != 0) CreaRiga(currency, cod_rap, rigaInput, cod_dep_liq_marginExcessDeficitGDN, diffMarginExcessDeficit); + + if (cod_rap == "10CONV") CreaRigaPlurima(cod_dep_liq_marginExcessDeficitGDN, descrMarginExcessDeficitGDN, currency, marginExcessDeficit, marginExcessDeficitGDN, dtPlurima10); + if (cod_rap == "DB6289") CreaRigaPlurima(cod_dep_liq_marginExcessDeficitGDN, descrMarginExcessDeficitGDN, currency, marginExcessDeficit, marginExcessDeficitGDN, dtPlurimaVB); + + /// + /// Elabora OpenTradeEquity (ETD Open Trade) + /// + Double.TryParse(rigaInput["OpenTradeEquity"].ToString().Replace(".", ","), out openTradeEquity); + string cod_dep_liq_openTradeEquityGDN = String.Empty; + string descrOpenTradeEquityGDN = String.Empty; + + temp = execSP_Scalar("SELECT tmp2.qta FROM tmppostit2 tmp2 LEFT JOIN tit t ON (t.cod_tit = tmp2.cod_tit) LEFT JOIN rap r ON (r.cod_rap = tmp2.cod_rap) WHERE r.cod_rap = '" + cod_rap + "' and t.cod_div = '" + currency + "' and t.des_tit like '%ETD Open Trade%' AND r.cod_sta in ('ATTIVO', 'PENDING') LIMIT 1;"); + if (!String.IsNullOrEmpty(temp)) openTradeEquityGDN = Convert.ToDouble(temp); + else openTradeEquityGDN = 0; + cod_dep_liq_openTradeEquityGDN = execSP_Scalar("SELECT d.cod_dep_liq from depliq d where d.cod_rap = '" + cod_rap + "' and d.cod_div = '" + currency + "' and d.des_dep_liq like '%ETD Open Trade%';"); + descrOpenTradeEquityGDN = execSP_Scalar("SELECT t.des_tit FROM depliq d LEFT JOIN tit t ON (t.cod_tit = d.cod_dep_liq) WHERE d.cod_rap = '" + cod_rap + "' and d.cod_div = '" + currency + "' and d.des_dep_liq like '%ETD Open Trade%';"); + + diffOpenTradeEquity = Math.Round(openTradeEquity - openTradeEquityGDN, 2); + if (diffOpenTradeEquity != 0) CreaRiga(currency, cod_rap, rigaInput, cod_dep_liq_openTradeEquityGDN, diffOpenTradeEquity); + + if (cod_rap == "10CONV") CreaRigaPlurima(cod_dep_liq_openTradeEquityGDN, descrOpenTradeEquityGDN, currency, openTradeEquity, openTradeEquityGDN, dtPlurima10); + if (cod_rap == "DB6289") CreaRigaPlurima(cod_dep_liq_openTradeEquityGDN, descrOpenTradeEquityGDN, currency, openTradeEquity, openTradeEquityGDN, dtPlurimaVB); + + + } + if (dtOutputTrades.Rows.Count > 0) + { + Session["dtOutputTrades"] = (DataTable)dtOutputTrades; + gvOutput.DataSource = Session["dtOutputTrades"]; + gvOutput.DataBind(); + + Session["dtPlurima10"] = (DataTable)dtPlurima10; + gvPlurima10.DataSource = Session["dtPlurima10"]; + gvPlurima10.DataBind(); + + Session["dtPlurimaVB"] = (DataTable)dtPlurimaVB; + gvPlurimaVB.DataSource = Session["dtPlurimaVB"]; + gvPlurimaVB.DataBind(); + } + } + } + + private void CreaRigaPlurima(string Conto, string DescrizioneConto, string Currency, double RBCValue, double GuardianValue, DataTable dtPlurima) + { + if (!String.IsNullOrEmpty(Conto)) + { + DataRow drPlurima = dtPlurima.NewRow(); + drPlurima["Conto"] = Conto; + drPlurima["Descrizione"] = DescrizioneConto; + drPlurima["Currency"] = Currency; + drPlurima["RBC"] = RBCValue; + drPlurima["Guardian"] = GuardianValue; + dtPlurima.Rows.Add(drPlurima); + } + } + + private void CreaRiga(string currency, string cod_rap, DataRow rigaInput, string cod_dep_liq, double diffValori) + { + DataRow dr1 = dtOutputTrades.NewRow(); + + dr1["spuntato"] = "S"; + dr1["data_ope"] = DateTime.ParseExact(rigaInput["BusinessDate"].ToString(), "yyyyMMdd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy"); + dr1["data_ins"] = DateTime.ParseExact(rigaInput["BusinessDate"].ToString(), "yyyyMMdd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy"); + dr1["data_val"] = DateTime.ParseExact(rigaInput["BusinessDate"].ToString(), "yyyyMMdd", CultureInfo.InvariantCulture).ToString("dd.MM.yyyy"); + if (diffValori <= 0) dr1["cod_ope"] = "DEBTMAR"; + else dr1["cod_ope"] = "CREDMAR"; + dr1["cod_rap"] = cod_rap; + //string cod_tit = execSP_Scalar("SELECT t.cod_tit FROM tmppostit2 tmp2 LEFT JOIN tit t ON (t.cod_tit = tmp2.cod_tit) LEFT JOIN rap r ON (r.cod_rap = tmp2.cod_rap) WHERE r.cod_rap = '" + cod_rap + "' and t.cod_div = '" + currency + "' and(t.options = 'S' or t.cod_tiptit like 'O1%') AND r.cod_sta in ('ATTIVO', 'PENDING') LIMIT 1;"); + string cod_tit = execSP_Scalar("SELECT t.cod_tit FROM tra LEFT JOIN tit t ON (t.cod_tit = tra.cod_tit) LEFT JOIN rap r ON (r.cod_rap = tra.cod_rap) WHERE r.cod_rap = '" + cod_rap + "' and t.cod_div = '" + currency + "' and (t.options = 'S' or t.cod_tiptit like 'O1%') AND r.cod_sta in ('ATTIVO', 'PENDING') ORDER BY t.data_ins desc LIMIT 1;"); + dr1["cod_tit"] = cod_tit; + dr1["cod_div_tit"] = currency; + dr1["cod_ctp"] = "RBEF"; + dr1["cod_dep_liq"] = cod_dep_liq; + dr1["qta"] = diffValori; + dr1["ctv_tit_dn"] = diffValori; + dr1["ctv_tot_dn"] = diffValori; + dr1["ctv_tit_dr"] = diffValori; + dr1["ctv_tot_dr"] = diffValori; + + dtOutputTrades.Rows.Add(dr1); + } + + private static string execSP_Scalar(string query) + { + object objResult; + string result = String.Empty; + using (var con = new MySqlConnection(Properties.Settings.Default.mySqlConnection)) + { + var cmd = new MySqlCommand + { + CommandText = query, + CommandType = CommandType.Text, + Connection = con + }; + cmd.CommandTimeout = 0; + con.Open(); // Open the SqlConnection. + objResult = cmd.ExecuteScalar(); + + if (objResult != null) result = objResult.ToString(); + } + return (result); + } + + public static DataTable ElaboraTemplateGuardian(string file, string sheetName) + { + // Open the Excel file using ClosedXML. + // Keep in mind the Excel file cannot be open when trying to read it + using (XLWorkbook workBook = new XLWorkbook(file)) + { + //Read the first Sheet from Excel file. + IXLWorksheet workSheet = workBook.Worksheet(1); + + //Create a new DataTable. + DataTable dt = new DataTable(); + + //Loop through the Worksheet rows. + bool firstRow = true; + foreach (IXLRow row in workSheet.Rows()) + { + //Use the first row to add columns to DataTable. + if (firstRow) + { + foreach (IXLCell cell in row.Cells()) + { + // Definisco tipo di colonna in tabella dt a seconda delle colonne di partenza del template + switch (cell.Value.ToString()) + { + //case "qta": + // dt.Columns.Add(cell.Value.ToString(),typeof(Int64)); + // break; + + case "qta": + case "prezzo": + case "cambiom": + case "ctv_tit_dr": + case "coma_dep_dr": + case "spese_dr": + case "ctv_tot_dr": + case "imposte_dr": + case "ctv_tit_dn": + case "imposte_dn": + case "ctv_tot_dn": + dt.Columns.Add(cell.Value.ToString(), typeof(double)); + break; + default: + dt.Columns.Add(cell.Value.ToString()); + break; + } + // dt.Columns.Add(cell.Value.ToString()); + } + firstRow = false; + } + else + { + //Add rows to DataTable. + dt.Rows.Add(); + int i = 0; + + foreach (IXLCell cell in row.Cells(row.FirstCellUsed().Address.ColumnNumber, row.LastCellUsed().Address.ColumnNumber)) + { + dt.Rows[dt.Rows.Count - 1][i] = cell.Value.ToString(); + i++; + } + } + } + + return dt; + } + } + + protected void btnOutputGuardian_Click(object sender, EventArgs e) + { + // Metodo 1) - Crea file di output in formato .xlsx per guardian relativo a MS Trades + // Prepare the response + string fileType = string.Empty; + string excelTrades = string.Format("rbccm_margins_{0:yyyyMMdd}.xlsx", DateTime.Today.Date); + HttpResponse httpResponse = Response; + httpResponse.Clear(); + httpResponse.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + httpResponse.AddHeader("content-disposition", string.Format("attachment;filename={0}", excelTrades)); + + // Flush the workbook to the Response.OutputStream + DataTable dt = (DataTable)Session["dtOutputTrades"]; + using (var workbook = new XLWorkbook()) + { + using (MemoryStream memoryStream = new MemoryStream()) + { + workbook.Worksheets.Add(dt, "Foglio1"); + workbook.SaveAs(memoryStream); + memoryStream.WriteTo(httpResponse.OutputStream); + memoryStream.Close(); + } + } + httpResponse.End(); + + + } + + protected void gvInputCsv_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) + { + if (e.RowType != GridViewRowType.Data) return; + + // Colora in modo differente le righe relative ai due fondi C77261 (10CONV) e C77260 (DB6289) + if ((string)e.GetValue("AccountID") == "C77261") e.Row.BackColor = Color.LightGray; + if ((string)e.GetValue("AccountID") == "C77260") e.Row.BackColor = Color.LightSteelBlue; + } + + protected void gvOutput_DataBinding(object sender, EventArgs e) + { + if (Session["dtOutputTrades"] != null) + { + gvOutput.DataSource = (DataTable)Session["dtOutputTrades"]; + } + } + + protected void gvPlurima10_DataBinding(object sender, EventArgs e) + { + if (Session["dtPlurima10"] != null) + { + gvPlurima10.DataSource = (DataTable)Session["dtPlurima10"]; + } + } + + protected void gvPlurimaVB_DataBinding(object sender, EventArgs e) + { + if (Session["dtPlurimaVB"] != null) + { + gvPlurimaVB.DataSource = (DataTable)Session["dtPlurimaVB"]; + } + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/Margini.aspx.designer.cs b/OlympiaIntranet/Margini.aspx.designer.cs new file mode 100644 index 0000000..b7be006 --- /dev/null +++ b/OlympiaIntranet/Margini.aspx.designer.cs @@ -0,0 +1,150 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class Margini { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// uploadControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxUploadControl uploadControl; + + /// + /// btnElaboraInput control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnElaboraInput; + + /// + /// btnOutputGuardian control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnOutputGuardian; + + /// + /// ASPxRoundPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel1; + + /// + /// ASPxRoundPanel4 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel4; + + /// + /// ASPxPageControl1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPageControl ASPxPageControl1; + + /// + /// gvPlurima10 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvPlurima10; + + /// + /// gvPlurimaVB control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvPlurimaVB; + + /// + /// ASPxRoundPanel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel2; + + /// + /// gvInputCsv control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvInputCsv; + + /// + /// ASPxRoundPanel3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel3; + + /// + /// gvOutput control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvOutput; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + } +} diff --git a/OlympiaIntranet/Mifir.aspx b/OlympiaIntranet/Mifir.aspx new file mode 100644 index 0000000..d27b747 --- /dev/null +++ b/OlympiaIntranet/Mifir.aspx @@ -0,0 +1,114 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Mifir.aspx.cs" Inherits="OlympiaIntranet.Mifir" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
Data Banca Sella + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + +
+
+
+
+
+
+ + +
+
+ + diff --git a/OlympiaIntranet/Mifir.aspx.cs b/OlympiaIntranet/Mifir.aspx.cs new file mode 100644 index 0000000..3200c35 --- /dev/null +++ b/OlympiaIntranet/Mifir.aspx.cs @@ -0,0 +1,632 @@ +using DevExpress.Export; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using DevExpress.Web; +using System.Drawing; +using System.Data.SqlClient; +using System.Collections; +using System.Text; +using MySqlConnector; + +namespace OlympiaIntranet +{ + public partial class Mifir : System.Web.UI.Page + { + DataTable dtOutputExcel; + DataTable dtDatiUBS; + //DataTable dtProcessedCSV; + + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + if (Session["DatiUBS"] != null) + { + gvDatiUBS.DataSource = (DataTable)Session["DatiUBS"]; + gvDatiUBS.DataBind(); + } + if (Session["outputTable"] != null) + { + gvOuputExcel.DataSource = (DataTable)Session["outputTable"]; + gvOuputExcel.DataBind(); + } + + if (!IsPostBack) dateeditBancaSella.Date = DateTime.Now.Date; // setta la data odierna solo la prima volta, se è un postback no altrimenti se viene cambiata la data poi la risetta a oggi + } + + // ref link: https://github.com/DevExpress-Examples/bind-a-grid-to-a-datatable-via-code-e168 + private DataTable ProcessaInputDatiUBS() + { + lblError.Text = ""; + + // dtDatiUBS è popolata in evento ASPxUploadControl1_FileUploadComplete in Session["DatiUBS"] + DataTable dtDatiUBS = new DataTable(); + dtDatiUBS = (DataTable)Session["DatiUBS"]; + if (dtDatiUBS.Rows.Count > 0) + { + // Aggiunge colonna a dt + DataTable dt = new DataTable(); + foreach (DataColumn column in dtDatiUBS.Columns) + { + dt.Columns.Add(column.ColumnName); + } + dt.Columns.Add("PROC1"); // Colonna che conterrà elaborazione procedura1 + dt.Columns.Add("KeyID"); // Colonna che conterrà primary key + dt.PrimaryKey = new DataColumn[] { dt.Columns["KeyID"] }; // setta primary key per datatable dt + + // Aggiunge righe a dt e per ogni riga esegue una select + int keyID = 1; // chiave primaria per dt + foreach (DataRow row in dtDatiUBS.Rows) + { + DataRow dr = dt.NewRow(); + using (var con = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + SqlCommand cmd = con.CreateCommand(); + //string query = string.Format("SELECT distinct tra.cod_ope from tra LEFT JOIN tit ON tra.cod_tit=tit.cod_tit WHERE tit.cod_isin ='{0}' AND ABS(tra.qta)={1} AND tra.data_ope > date_sub(CURDATE(), INTERVAL 10 DAY) and tra.cod_ope in ('B','S')", row["TAG_41"], row["TAG_30"]); + cmd.CommandType = CommandType.StoredProcedure; + cmd.CommandText = "mifir_UBS_codope"; + cmd.Parameters.Add("@ISIN", SqlDbType.VarChar).Value = row["TAG_41"]; + cmd.Parameters.Add("@Qta", SqlDbType.Int).Value = row["TAG_30"]; + con.Open(); // Open the SqlConnection. + SqlDataReader dataReader = cmd.ExecuteReader(); + var dtResult = new DataTable(); + dtResult.Load(dataReader); + if (dtResult.Rows.Count == 1) dr["PROC1"] = dtResult.Rows[0][0].ToString(); // 'S' o 'B' + else dr["PROC1"] = ""; + } + int col = 0; + foreach (var item in row.ItemArray) + { + dr[col] = item; + col++; + } + dr["KeyID"] = keyID; + dt.Rows.Add(dr); + keyID++; + } + if (dt != null) + { + Session["DatiUBS"] = dt; + gvDatiUBS.DataSource = dt; + + // Aggiunge colonne a gvInputCSV + gvDatiUBS.Columns.Clear(); + foreach (DataColumn column in dtDatiUBS.Columns) + { + GridViewDataColumn c = new GridViewDataColumn(); + c.FieldName = column.ColumnName; + gvDatiUBS.Columns.Add(c); + } + GridViewDataColumn d = new GridViewDataColumn(); + d.FieldName = "PROC1"; + gvDatiUBS.Columns.Add(d); + GridViewDataColumn e = new GridViewDataColumn(); + e.FieldName = "KeyID"; + gvDatiUBS.Columns.Add(d); + gvDatiUBS.KeyFieldName = "KeyID"; + GridViewCommandColumn cc = new GridViewCommandColumn(); + gvDatiUBS.Columns.Add(cc); + cc.ShowEditButton = true; + cc.ShowNewButton = false; + cc.ShowDeleteButton = false; + cc.ShowCancelButton = true; + cc.ShowUpdateButton = true; + + gvDatiUBS.DataBind(); + } + return (dt); + } + else + { + lblError.Text = "CSV non rilevato!"; + return (null); + } + } + + private DataTable CreateOutputDataTable() + { + // Crea struttura datatable per output file + DataTable dtOutput = new DataTable(); + dtOutput.Columns.Add("Report Status"); + dtOutput.Columns.Add("Transaction Reference Number"); + dtOutput.Columns.Add("Venue Transaction ID"); + dtOutput.Columns.Add("Submitting Entity ID"); + dtOutput.Columns.Add("Executing Entity ID"); + dtOutput.Columns.Add("Investment Firm Indicator"); + dtOutput.Columns.Add("Buyer ID Type"); + dtOutput.Columns.Add("Buyer ID Sub Type"); + dtOutput.Columns.Add("Buyer ID"); + dtOutput.Columns.Add("Buyer Country of Branch"); + dtOutput.Columns.Add("Buyer First Name"); + dtOutput.Columns.Add("Buyer Surname"); + dtOutput.Columns.Add("Buyer DOB"); + dtOutput.Columns.Add("Buyer Decision Maker ID Type"); + dtOutput.Columns.Add("Buyer Decision Maker ID Sub Type"); + dtOutput.Columns.Add("Buyer Decision Maker ID"); + dtOutput.Columns.Add("Buyer Decision Maker First Name"); + dtOutput.Columns.Add("Buyer Decision Maker Surname"); + dtOutput.Columns.Add("Buyer Decision Maker DOB"); + dtOutput.Columns.Add("Seller ID Type"); + dtOutput.Columns.Add("Seller ID Sub Type"); + dtOutput.Columns.Add("Seller ID"); + dtOutput.Columns.Add("Seller Country of Branch"); + dtOutput.Columns.Add("Seller First Name"); + dtOutput.Columns.Add("Seller Surname"); + dtOutput.Columns.Add("Seller DOB"); + dtOutput.Columns.Add("Seller Decision Maker ID Type"); + dtOutput.Columns.Add("Seller Decision Maker ID Sub Type"); + dtOutput.Columns.Add("Seller Decision Maker ID"); + dtOutput.Columns.Add("Seller Decision Maker First Name"); + dtOutput.Columns.Add("Seller Decision Maker Surname"); + dtOutput.Columns.Add("Seller Decision Maker DOB"); + dtOutput.Columns.Add("Order Transmission Indicator"); + dtOutput.Columns.Add("Buyer Transmitter ID"); + dtOutput.Columns.Add("Seller Transmitter ID"); + dtOutput.Columns.Add("Trading Date Time"); + dtOutput.Columns.Add("Trading Capacity"); + dtOutput.Columns.Add("Quantity"); + dtOutput.Columns.Add("Quantity Type"); + dtOutput.Columns.Add("Quantity Currency"); + dtOutput.Columns.Add("Derivative Notional Change"); + dtOutput.Columns.Add("Price"); + dtOutput.Columns.Add("Price Type"); + dtOutput.Columns.Add("Price Currency"); + dtOutput.Columns.Add("Net Amount"); + dtOutput.Columns.Add("Venue"); + dtOutput.Columns.Add("Country of Branch"); + dtOutput.Columns.Add("Up-Front Payment"); + dtOutput.Columns.Add("Up-Front Payment Currency"); + dtOutput.Columns.Add("Complex Trade Component ID"); + dtOutput.Columns.Add("Instrument ID"); + dtOutput.Columns.Add("Instrument ID Type"); + dtOutput.Columns.Add("Instrument Name"); + dtOutput.Columns.Add("Instrument Classification"); + dtOutput.Columns.Add("Notional Currency 1"); + dtOutput.Columns.Add("Notional Currency 2"); + dtOutput.Columns.Add("Notional Currency 2 Type"); + dtOutput.Columns.Add("Price Multiplier"); + dtOutput.Columns.Add("UV Instrument Classification"); + dtOutput.Columns.Add("Underlying Instrument ID"); + dtOutput.Columns.Add("UV Index Classification"); + dtOutput.Columns.Add("Underlying Index ID"); + dtOutput.Columns.Add("Underlying Index Name"); + dtOutput.Columns.Add("Underlying Index Term"); + dtOutput.Columns.Add("Option Type"); + dtOutput.Columns.Add("Strike Price"); + dtOutput.Columns.Add("Strike Price Type"); + dtOutput.Columns.Add("Strike Price Currency"); + dtOutput.Columns.Add("Option Style"); + dtOutput.Columns.Add("Maturity Date"); + dtOutput.Columns.Add("Expiry Date"); + dtOutput.Columns.Add("Delivery Type"); + dtOutput.Columns.Add("Investment Decision ID Type"); + dtOutput.Columns.Add("Investment Decision ID Sub Type"); + dtOutput.Columns.Add("Investment Decision ID"); + dtOutput.Columns.Add("Investment Decision Country of Branch"); + dtOutput.Columns.Add("Firm Execution ID Type"); + dtOutput.Columns.Add("Firm Execution ID Sub Type"); + dtOutput.Columns.Add("Firm Execution ID"); + dtOutput.Columns.Add("Firm Execution Country of Branch"); + dtOutput.Columns.Add("Waiver Indicator"); + dtOutput.Columns.Add("Short Selling Indicator"); + dtOutput.Columns.Add("OTC Post Trade Indicator"); + dtOutput.Columns.Add("Commodity Derivative Indicator"); + dtOutput.Columns.Add("SFT Indicator"); + dtOutput.Columns.Add("Internal Client Identification"); + dtOutput.Columns.Add("Data Category"); + + return (dtOutput); + + } + + protected void btnCreaOutput_Click(object sender, EventArgs e) + { + // Salva csv in db tabella MifirReport + SqlBulkCopyTable((DataTable)Session["outputTable"], "MifirReport"); + + // ref link: https://stackoverflow.com/questions/1746701/export-datatable-to-excel-file + lblError.Text = ""; + try + { + ASPxGridViewExporter1.ExportSelectedRowsOnly = false; + ASPxGridViewExporter1.FileName = "Olympia_Wealth_Management_Ltd_MiFIR_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + CsvExportOptionsEx op = new CsvExportOptionsEx() { ExportType = ExportType.DataAware }; // in DataAware mode l'evento ASPxGridViewExporter_RenderBrick non viene eseguito!! + ASPxGridViewExporter1.WriteCsvToResponse(op); + } + catch (Exception ex) + { + lblError.Text = ex.Message; + } + } + + private void SqlBulkCopyTable(DataTable dt, string sqlTable) + { + //var table = "Events"; + using (var conn = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var bulkCopy = new SqlBulkCopy(conn) { DestinationTableName = sqlTable }; + bulkCopy.BulkCopyTimeout = 6000; + conn.Open(); + var schema = conn.GetSchema("Columns", new[] { null, null, sqlTable, null }); + foreach (DataColumn schemaColumn in dt.Columns) + { + foreach (DataRow row in schema.Rows) + { + if (string.Equals(schemaColumn.ColumnName, (string)row["COLUMN_NAME"], StringComparison.OrdinalIgnoreCase)) + { + bulkCopy.ColumnMappings.Add(schemaColumn.ColumnName, (string)row["COLUMN_NAME"]); + break; + } + } + } + try + { + bulkCopy.WriteToServer(dt); + } + catch (Exception ex) + { + lblError.Text = ex.Message; + } + } + } + private void Flusso_BancaSella() + { + // Definizione datatable Input e Output + DataTable dtInput = new DataTable(); + DataTable dtOutput = new DataTable(); + string dataBancaSella = dateeditBancaSella.Date.Year+"-"+ dateeditBancaSella.Date.Month+"-"+dateeditBancaSella.Date.Day; + dtOutput = (DataTable)Session["outputTable"]; + + // Carica dati banca sella da Guardian in dtInput + string query = string.Empty; + //SqlConnection connSql = new SqlConnection(Properties.Settings.Default.DBSettings); + //SqlCommand cmdSql = connSql.CreateCommand(); + //cmdSql.Parameters.Add("@date", SqlDbType.VarChar).Value = dataBancaSella; + //cmdSql.CommandText = "mifir_SELLA1"; + //connSql.Open(); + //query = cmdSql.ExecuteScalar().ToString(); + //connSql.Close(); + using (var connSql = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var cmdSql = new SqlCommand + { + CommandText = "mifir_SELLA1", + CommandType = CommandType.StoredProcedure, + Connection = connSql + }; + cmdSql.Parameters.Add("@date", SqlDbType.VarChar).Value = dataBancaSella; + connSql.Open(); + query = cmdSql.ExecuteScalar().ToString(); + connSql.Close(); + } + // Scarica dati da Guardian + MySqlConnection conn = new MySqlConnection(Properties.Settings.Default.mySqlConnection); + MySqlCommand cmd = conn.CreateCommand(); + cmd.CommandText = query; + conn.Open(); + + MySqlDataReader dataReader = cmd.ExecuteReader(); + dtInput.Load(dataReader); // id,progr,sending_time,Dayofexec,OrdStatus,ISIN,cod_ope,ExecTime,QtyFilled,Price,CCY,netamount,divisore + conn.Close(); + + if (dtInput.Rows.Count == 0) return; // Esce se non ci sono record da guardian + + lblDatiBancaSella.Text = String.Format("Record Banca Sella processati: {0}", dtInput.Rows.Count); + + foreach (DataRow inputRow in dtInput.Rows) + { + DataRow dr = dtOutput.NewRow(); + + // Mappatura campi dtInput in dtOutput + dr["Report Status"] = "NEWT"; // col 1 + dr["Transaction Reference Number"] = "A"+inputRow["id"].ToString() + inputRow["progr"].ToString(); // col 2 + dr["Submitting Entity ID"] = "213800Y8S6ABNF5NCQ84"; // col 4 + dr["Executing Entity ID"] = "213800Y8S6ABNF5NCQ84"; // col 5 + dr["Investment Firm Indicator"] = "TRUE"; // col 6 + dr["Buyer ID Type"] = "L"; // col 7 + dr["Buyer ID"] = "549300I7OIUB41P86L19"; // col 9 + if (inputRow["cod_ope"].ToString() == "B") + { + dr["Buyer Decision Maker ID Type"] = "L"; // col 14 + dr["Buyer Decision Maker ID"] = "549300I7OIUB41P86L19"; // col 16 + } + dr["Seller ID Type"] = "L"; // col 20 + dr["Seller ID"] = "549300I7OIUB41P86L19"; // col 22 + if (inputRow["cod_ope"].ToString() == "S") + { + dr["Seller Decision Maker ID Type"] = "L"; // col 27 + dr["Seller Decision Maker ID"] = "549300I7OIUB41P86L19"; // col 29 + } + dr["Order Transmission Indicator"] = "FALSE"; // col 33 + dr["Trading Date Time"] = inputRow["ExecTime"]; // col 36 + dr["Trading Capacity"] = "AOTC"; // col 37 + dr["Quantity"] = inputRow["QtyFilled"].ToString().Replace(",", "."); // col 38 + dr["Quantity Type"] = "UNIT"; // col 39 + dr["Quantity Currency"] = inputRow["CCY"]; // col 40 + dr["Price"] = inputRow["Price"].ToString().Replace(",", "."); // col 42 + dr["Price Type"] = "MntryValAmt"; // col 43 + dr["Price Currency"] = inputRow["CCY"]; // col 44 + dr["Net Amount"] = inputRow["netamount"].ToString().Replace(",","."); // col 45 + dr["Venue"] = "XOFF"; // col 46 + dr["Instrument ID Type"] = "FinInstrm.Id"; // col 51 + dr["Instrument ID"] = inputRow["ISIN"]; // col 52 + dr["Price Multiplier"] = inputRow["divisore"].ToString().Replace(",", "."); // col 58 + dr["Firm Execution ID Type"] = "N"; // col 77 + dr["Firm Execution ID Sub Type"] = "NIDN"; // col 78 + dr["Firm Execution ID"] = "CRNFNC90L60C532V"; // col 79 + dr["Firm Execution Country of Branch"] = "IT"; // col 80 + dr["SFT Indicator"] = "FALSE"; // col 85 + + dtOutput.Rows.Add(dr); + } + + if (dtOutput != null) + { + Session["outputTable"] = dtOutput; + gvOuputExcel.DataSource = Session["outputTable"]; + gvOuputExcel.DataBind(); + } + } + + private void SalvaInCSV(DataTable dt) // non più usata + { + //string excelFileName = "Olympia_Wealth_Management_Ltd_MiFIR_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + //string attachment = String.Format("attachment; filename={0}", excelFileName); + //Response.ClearContent(); + //Response.AddHeader("content-disposition", attachment); + //Response.ContentType = "text/csv"; + + //string[] columnNames = dt.Columns.Cast(). + // Select(column => column.ColumnName). + // ToArray(); + //Response.Write(string.Join(",", columnNames)); + //Response.Write("\n"); + //foreach (DataRow row in dt.Rows) + //{ + // string[] fields = row.ItemArray.Select(field => field.ToString()). + // ToArray(); + // for (int i = 0; i < fields.Length; i++) + // { + + // if (fields[i].IndexOf(",") != -1) fields[i] = fields[i].Replace(",","."); // nei decimali sostituisce la , con il . + // } + + // Response.Write(string.Join(",", fields)); + // Response.Write("\n"); + //} + //Response.End(); + + } + + private void SalvaInExcel(DataTable dt) // non usato, sembra che MiFir non accetti il formato excel + { + //string excelFileName = "Olympia_Wealth_Management_Ltd_MiFIR_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; + //string attachment = String.Format("attachment; filename={0}", excelFileName); + //Response.ClearContent(); + //Response.AddHeader("content-disposition", attachment); + //Response.ContentType = "application/vnd.ms-excel"; + //string tab = ""; + //foreach (DataColumn dc in dt.Columns) + //{ + // Response.Write(tab + dc.ColumnName); + // tab = "\t"; + //} + //Response.Write("\n"); + //int i; + //foreach (DataRow dr in dt.Rows) + //{ + // tab = ""; + // for (i = 0; i < dt.Columns.Count; i++) + // { + // Response.Write(tab + dr[i].ToString()); + // tab = "\t"; + // } + // Response.Write("\n"); + //} + //Response.End(); + } + + protected void gvDatiUBS_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridViewTableRowEventArgs e) + { + if (e.RowType != GridViewRowType.Data) return; + + // Evidenzia righe con PROC1 vuoto (sono da editare e assegnare B o S manualmente + if (String.IsNullOrEmpty((string)e.GetValue("PROC1"))) e.Row.BackColor = Color.LightSalmon; + } + + protected void btnProcessaDatiBancaSella_Click(object sender, EventArgs e) + { + // Processa output csv , elaborando i dati di UBS e di Banca Sella + try + { + // Processa dati UBS + + lblError.Text = ""; + pageControl.ActiveTabIndex = 1; + if (Session["DatiUBS"] == null) + { + lblError.Text = "CSV non rilevato!"; + return; + } + // Crea colonne per Datatable di output dtOutputExcel + dtOutputExcel = new DataTable(); + dtOutputExcel = CreateOutputDataTable(); // crea colonne + + // Popola righe Datatable di ouput + dtDatiUBS = (DataTable)Session["DatiUBS"]; + int incrKey = 1; + foreach (DataRow inputRow in dtDatiUBS.Rows) + { + DataRow dr = dtOutputExcel.NewRow(); + + // Mappatura campi dtInputCSV in dtOutputExcel + dr["Report Status"] = inputRow["TAG_01"]; // col 1 + dr["Transaction Reference Number"] = Convert.ToString(incrKey) + inputRow["TAG_02"]; // col 2 + dr["Submitting Entity ID"] = "213800Y8S6ABNF5NCQ84"; // col 4 + dr["Executing Entity ID"] = "213800Y8S6ABNF5NCQ84"; // col 5 + dr["Investment Firm Indicator"] = "TRUE"; // col 6 + dr["Buyer ID Type"] = "L"; // col 7 + dr["Buyer ID"] = inputRow["UBSLEI"]; // col 9 + dr["Seller ID Type"] = "L"; // col 20 + dr["Seller ID"] = inputRow["UBSLEI"]; // col 22 + dr["Order Transmission Indicator"] = "FALSE"; // col 33 + dr["Trading Date Time"] = inputRow["TAG_28"]; // col 36 + dr["Trading Capacity"] = "AOTC"; // col 37 + dr["Quantity"] = inputRow["TAG_30"]; // col 38 + dr["Quantity Type"] = "UNIT"; // col 39 + dr["Quantity Currency"] = inputRow["TAG_31"]; // col 40 + dr["Price"] = inputRow["TAG_33"]; // col 42 + dr["Price Type"] = "MntryValAmt"; // col 43 + dr["Price Currency"] = inputRow["TAG_34"]; // col 44 + dr["Net Amount"] = inputRow["TAG_35"]; // col 45 + dr["Venue"] = "XOFF"; // col 46 + dr["Instrument ID Type"] = "FinInstrm.Id"; // col 51 + dr["Instrument ID"] = inputRow["TAG_41"]; // col 52 + dr["Instrument Name"] = inputRow["TAG_42"]; // col 53 + dr["Instrument Classification"] = inputRow["TAG_43"]; // col 54 + dr["Notional Currency 1"] = inputRow["TAG_44"]; // col 55 + dr["Notional Currency 2"] = inputRow["TAG_45"]; // col 56 + dr["Price Multiplier"] = inputRow["TAG_46"]; // col 58 + dr["Firm Execution ID Type"] = "N"; // col 77 + dr["Firm Execution ID Sub Type"] = "NIDN"; // col 78 + dr["Firm Execution ID"] = "CRNFNC90L60C532V"; // col 79 + dr["Firm Execution Country of Branch"] = "IT"; // col 80 + dr["SFT Indicator"] = "FALSE"; // col 85 + + if (inputRow["PROC1"].ToString()=="B") + { + dr["Buyer Decision Maker ID Type"] = "L"; // col 14 + dr["Buyer Decision Maker ID"] = "213800Y8S6ABNF5NCQ84"; // col 16 + } + if (inputRow["PROC1"].ToString() == "S") + { + dr["Seller Decision Maker ID Type"] = "L"; // col 27 + dr["Seller Decision Maker ID"] = "213800Y8S6ABNF5NCQ84"; // col 29 + } + if (inputRow["TAG_01"].ToString() == "NEWT" && !String.IsNullOrEmpty(inputRow["PFLID"].ToString())) // aggiunge la riga se tag_01 = NEWT e PFLID è valorizzato + { + dtOutputExcel.Rows.Add(dr); + incrKey++; + } + + } + + if (dtOutputExcel != null) Session["outputTable"] = dtOutputExcel; + + lblDatiUBS.Text = String.Format("Record UBS processati: {0}", dtOutputExcel.Rows.Count); + + // Processa Dati Banca Sella + Flusso_BancaSella(); // aggiunge al Session["outputTable"] flusso dati da Banca Sella prima di salvare tutto in formato .csv + gvOuputExcel.DataSource = Session["outputTable"]; + gvOuputExcel.DataBind(); + + } + catch (Exception ex) + { + lblError.Text = ex.Message; + } + } + + protected void ASPxUploadControl1_FileUploadComplete(object sender, FileUploadCompleteEventArgs e) + { + Session["DatiUBS"] = CaricaDatiUBSCsv(e.UploadedFile); + } + + public DataTable CaricaDatiUBSCsv(UploadedFile uploadedFile) + { + // ref link: https://www.c-sharpcorner.com/blogs/read-csv-file-into-data-table1 + + DataTable dtCsv = new DataTable(); + string Fulltext; + if (uploadedFile.IsValid && IsPostBack) //if (FileUpload.HasFile && IsPostBack) + { + using (StreamReader sr = new StreamReader(uploadedFile.FileContent)) + { + while (!sr.EndOfStream) + { + Fulltext = sr.ReadToEnd().ToString(); //read full file text + string[] rows = Fulltext.Split('\n'); //split full file text into rows + for (int i = 0; i < rows.Count() - 1; i++) + { + string[] rowValues = rows[i].Split('|'); //split each row with | to get individual values + { + if (i == 0) + { + for (int j = 0; j < rowValues.Count(); j++) + { + dtCsv.Columns.Add(rowValues[j]); //add headers + } + } + else + { + DataRow dr = dtCsv.NewRow(); + for (int k = 0; k < rowValues.Count(); k++) + { + dr[k] = rowValues[k].ToString().Replace(",","."); + } + dtCsv.Rows.Add(dr); //add other rows + } + } + } + } + } + } + return dtCsv; + } + + protected void gvDatiUBS_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) + { + ASPxGridView gridView = (ASPxGridView)sender; + DataTable dataTable = (DataTable)Session["DatiUBS"]; + DataRow row = dataTable.Rows.Find(e.Keys[0]); + row["PROC1"] = e.NewValues["PROC1"]; + gridView.CancelEdit(); + e.Cancel = true; + Session["DatiUBS"] = dataTable; + } + + protected void btnProcessaDatiUBS_Click(object sender, EventArgs e) + { + // Carica Dati UBS + try + { + lblError.Text = ""; + + // Carica csv UBS in Datatable e lo processa + dtDatiUBS = ProcessaInputDatiUBS(); + pageControl.ActiveTabIndex = 0; + + } + catch (Exception ex) + { + lblError.Text = ex.Message; + } + } + + protected void gvOuputExcel_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) + { + if (e.RowType != GridViewRowType.Data) return; + + // Rileva campo Buyer Decision Maker ID, per colorare le righe di Banca Sella + object objBuyerMakerID = e.GetValue("Buyer ID"); + if (!String.IsNullOrEmpty(objBuyerMakerID.ToString())) + { + if (objBuyerMakerID.ToString() == "549300I7OIUB41P86L19") e.Row.BackColor = Color.LightBlue; // riga di BancaSella + if (objBuyerMakerID.ToString() == "5299007QVIQ7IO64NX37") e.Row.BackColor = Color.LightGreen; // riga di UBS + //else e.Row.BackColor = Color.LightGreen; // riga di UBS + } + //else e.Row.BackColor = Color.LightGreen; // riga di UBS + } + + } +} \ No newline at end of file diff --git a/OlympiaIntranet/Mifir.aspx.designer.cs b/OlympiaIntranet/Mifir.aspx.designer.cs new file mode 100644 index 0000000..e4403d9 --- /dev/null +++ b/OlympiaIntranet/Mifir.aspx.designer.cs @@ -0,0 +1,132 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class Mifir { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxUploadControl1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxUploadControl ASPxUploadControl1; + + /// + /// btnProcessaDatiUBS control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnProcessaDatiUBS; + + /// + /// dateeditBancaSella control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxDateEdit dateeditBancaSella; + + /// + /// btnProcessaDatiBancaSella control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnProcessaDatiBancaSella; + + /// + /// btnCreaOutput control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnCreaOutput; + + /// + /// pageControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxPageControl pageControl; + + /// + /// gvDatiUBS control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvDatiUBS; + + /// + /// lblDatiUBS control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel lblDatiUBS; + + /// + /// lblDatiBancaSella control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel lblDatiBancaSella; + + /// + /// gvOuputExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvOuputExcel; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + + /// + /// lblError control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel lblError; + } +} diff --git a/OlympiaIntranet/MonitorVaR.aspx b/OlympiaIntranet/MonitorVaR.aspx new file mode 100644 index 0000000..a38e685 --- /dev/null +++ b/OlympiaIntranet/MonitorVaR.aspx @@ -0,0 +1,111 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MonitorVaR.aspx.cs" Inherits="OlympiaIntranet.MonitorVaR" %> + +<%@ Register Assembly="DevExpress.Web.Bootstrap.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.Bootstrap" TagPrefix="dx" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + +<%@ Register Assembly="DevExpress.XtraCharts.v23.2.Web, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dx" %> + +<%@ Register Assembly="DevExpress.XtraCharts.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts" TagPrefix="dx" %> + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+
+ + diff --git a/OlympiaIntranet/MonitorVaR.aspx.cs b/OlympiaIntranet/MonitorVaR.aspx.cs new file mode 100644 index 0000000..f01f698 --- /dev/null +++ b/OlympiaIntranet/MonitorVaR.aspx.cs @@ -0,0 +1,251 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using DevExpress.CodeParser; +using DevExpress.Web; +using DevExpress.XtraCharts; +using DevExpress.XtraCharts.Native; +using DevExpress.XtraCharts.Web; +using DevExpress.XtraPrinting; +using DevExpress.XtraPrintingLinks; + +namespace OlympiaIntranet +{ + public partial class MonitorVaR : System.Web.UI.Page + { + + protected void Page_Load(object sender, EventArgs e) + { + // Se è la prima volta che viene caricata la pagina allora carica glGestore e cancella tutto quello che c'è in glLinea + if (IsPostBack == false) + { + BindGestori(); + glLinea.DataSource = null; + glLinea.DataBind(); + } + + } + + private void BindGestori() + { + using (SqlConnection conn = new SqlConnection(OlympiaIntranet.Properties.Settings.Default.SqlConnection)) + using (SqlCommand cmd = new SqlCommand("GDN_GetGestore", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + conn.Open(); + SqlDataReader dr = cmd.ExecuteReader(); + DataTable dt = new DataTable(); + dt.Load(dr); + glGestore.DataSource = dt; + glGestore.DataBind(); + } + } + + private void PlottaGrafico(DataTable dataTable) + { + // Cancella tutte le serie prima di plottare + chartControl.Series.Clear(); + + // Cancella tutti i titoli della serie prima di plottare + chartControl.Titles.Clear(); + + // Setta titolo del grafico + SettaTitoloGrafico(); + + // Setta posizione legenda + Legend legend = chartControl.Legend; + legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; + legend.AlignmentVertical = LegendAlignmentVertical.BottomOutside; + legend.Direction = LegendDirection.LeftToRight; + + // Create a new bar series. + Series series = new Series("# pos. sconfinanti per VaR puntuale", ViewType.Line); + series.ArgumentScaleType = ScaleType.DateTime; + series.ArgumentDataMember = "Data"; + series.ValueScaleType = ScaleType.Numerical; + series.ValueDataMembers.AddRange(new string[] { "NumDeltaPuntuale" }); + chartControl.Series.Add(series); + + Series series1 = new Series("# pos. sconfinanti per VaR medio", ViewType.Line); + series1.ArgumentScaleType = ScaleType.DateTime; + series1.ArgumentDataMember = "Data"; + series1.ValueScaleType = ScaleType.Numerical; + series1.ValueDataMembers.AddRange(new string[] { "NumDeltaMedio" }); + chartControl.Series.Add(series1); + + // Specify the series data source. + series.DataSource = dataTable; + series1.DataSource = dataTable; + + XYDiagramSeriesViewBase view = (XYDiagramSeriesViewBase)series.View; + LineSeriesView ssv = view as LineSeriesView; + ssv.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; + + XYDiagramSeriesViewBase view1 = (XYDiagramSeriesViewBase)series1.View; + LineSeriesView ssv1 = view1 as LineSeriesView; + ssv1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; + } + + private void SettaTitoloGrafico() + { + // Create chart titles. + ChartTitle chartTitle1 = new ChartTitle(); + ChartTitle chartTitle2 = new ChartTitle(); + // Define the text for the titles. + chartTitle1.Text = "Numero posizioni sconfinanti per VaR"; + + chartTitle2.Text = TitoloFiltri(); + + chartTitle2.WordWrap = true; + chartTitle2.MaxLineCount = 2; + + // Define the alignment of the titles. + chartTitle1.Alignment = StringAlignment.Near; + chartTitle2.Alignment = StringAlignment.Near; + + // Place the titles where it's required. + chartTitle1.Dock = ChartTitleDockStyle.Top; + chartTitle2.Dock = ChartTitleDockStyle.Top; + + // Customize a title's appearance. + chartTitle1.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle1.Font = new Font("Tahoma", 14, FontStyle.Bold); + chartTitle1.TextColor = Color.Blue; + chartTitle1.Indent = 10; + + // Customize a title's appearance. + chartTitle2.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle2.Font = new Font("Arial", 10, FontStyle.Italic); + chartTitle2.TextColor = Color.Black; + chartTitle2.Indent = 10; + + // Add the titles to the chart. + chartControl.Titles.AddRange(new ChartTitle[] {chartTitle1,chartTitle2}); + } + + private string TitoloFiltri() + { + string filtro = String.Empty; + if (String.IsNullOrEmpty(glGestore.Text) == true) { filtro += "Gestore: tutti "; } else { filtro += $"Gestore: {glGestore.Text} "; } + if (String.IsNullOrEmpty(glLinea.Text) == true) { filtro += "Linea: tutti "; } else { filtro += $"Linea: {glLinea.Text} "; } + return (filtro); + } + + protected void btnEsportaPdf_Click(object sender, EventArgs e) + { + /* + // Esporta grafico in pdf + var ps = new PrintingSystem(); + ps.PageSettings.Landscape = true; + var link1 = new PrintableComponentLink(); + chartControl.DataBind(); + link1.Component = ((IChartContainer)chartControl).Chart; + link1.Landscape = true; + link1.PrintingSystem = ps; + link1.CreateDocument(); + ps.Document.AutoFitToPagesWidth = 1; // Fit to page + using (var stream = new MemoryStream()) + { + link1.PrintingSystem.ExportToPdf(stream); + Response.Clear(); + Response.Buffer = false; + Response.AppendHeader("Content-Type", "application/pdf"); + Response.AppendHeader("Content-Transfer-Encoding", "binary"); + Response.AppendHeader("Content-Disposition", "attachment; filename=HomePageCharts.pdf"); + Response.BinaryWrite(stream.GetBuffer()); + Response.End(); + } + ps.Dispose(); + */ + + if (!(String.IsNullOrEmpty(glGestore.Text) || String.IsNullOrEmpty(glLinea.Text))) + { + string query = CommonClass.ExecSql("monitorVaR_LoadData1", glGestore.Text, glLinea.Text); + var dataTable = CommonClass.execQuery_Datatable_MySql(query, Properties.Settings.Default.mySqlConnection); + + // Plotta il grafico in server-side, così da assicurarti che sia pronto per l'esportazione + PlottaGrafico(dataTable); + + var ps = new PrintingSystem(); + ps.PageSettings.Landscape = true; + + var link = new PrintableComponentLink(ps) + { + Component = ((IChartContainer)chartControl).Chart, + Landscape = true + }; + + link.CreateDocument(); + ps.Document.AutoFitToPagesWidth = 1; + + using (var stream = new MemoryStream()) + { + ps.ExportToPdf(stream); + Response.Clear(); + Response.Buffer = false; + Response.AppendHeader("Content-Type", "application/pdf"); + Response.AppendHeader("Content-Transfer-Encoding", "binary"); + Response.AppendHeader("Content-Disposition", $"attachment; filename=monitorVar_{DateTime.Now:yyyyMMdd_HHmmss}.pdf"); + Response.BinaryWrite(stream.ToArray()); + Response.End(); + } + + ps.Dispose(); + } + } + + protected void glGestore_ValueChanged(object sender, EventArgs e) + { + // ref: https://supportcenter.devexpress.com/ticket/details/q340370/aspxgridlookup-how-to-refresh-the-control-after-some-data-is-changed + // note: Per refreshare gridlookupLinea e gridlookupAdvisor sulla base del valore di gridLookupGestore, salvo il valore gestore in una variabile di sessione Session["cod_ges"] + // e poi il refresh/rebind di SqlDSLinee e SqlDSAdvisor verrà effettuato nell'evento lato client EndCallBack + + if (glGestore.Value != null && String.IsNullOrEmpty(glGestore.Value.ToString()) == false) + { + BindLineeByGestore(glGestore.Text); + } + else + { + glLinea.DataSource = null; + glLinea.DataBind(); + } + } + private void BindLineeByGestore(string Gestore) + { + using (SqlConnection conn = new SqlConnection(OlympiaIntranet.Properties.Settings.Default.SqlConnection)) + using (SqlCommand cmd = new SqlCommand("GDN_GetLinee1", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@cod_ges", Gestore); + //cmd.Parameters.AddWithValue("@cod_adv", "-- TUTTI --"); + conn.Open(); + SqlDataReader dr = cmd.ExecuteReader(); + DataTable dt = new DataTable(); + dt.Load(dr); + glLinea.DataSource = dt; + glLinea.DataBind(); + } + } + + + + protected void btnShowChart_Click(object sender, EventArgs e) + { + if (!(String.IsNullOrEmpty(glGestore.Text) == true || String.IsNullOrEmpty(glLinea.Text) == true)) + { + string query = CommonClass.ExecSql("monitorVaR_LoadData1", glGestore.Text, glLinea.Text); + + var dataTable = CommonClass.execQuery_Datatable_MySql(query, Properties.Settings.Default.mySqlConnection); // DataIns, NumDeltaPuntuale, NumDeltaMedio + + PlottaGrafico(dataTable); + } + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/MonitorVaR.aspx.designer.cs b/OlympiaIntranet/MonitorVaR.aspx.designer.cs new file mode 100644 index 0000000..84d4518 --- /dev/null +++ b/OlympiaIntranet/MonitorVaR.aspx.designer.cs @@ -0,0 +1,80 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class MonitorVaR + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// glGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup glGestore; + + /// + /// glLinea control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup glLinea; + + /// + /// btnShowChart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnShowChart; + + /// + /// btnEsportaPdf control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnEsportaPdf; + + /// + /// chartControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.XtraCharts.Web.WebChartControl chartControl; + } +} diff --git a/OlympiaIntranet/MonitorVaR_old.aspx b/OlympiaIntranet/MonitorVaR_old.aspx new file mode 100644 index 0000000..03798fd --- /dev/null +++ b/OlympiaIntranet/MonitorVaR_old.aspx @@ -0,0 +1,184 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MonitorVaR_old.aspx.cs" Inherits="OlympiaIntranet.MonitorVaR_old" %> + +<%@ Register Assembly="DevExpress.Web.Bootstrap.v20.1, Version=20.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.Bootstrap" TagPrefix="dx" %> + +<%@ Register Assembly="DevExpress.Web.v20.1, Version=20.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + +<%@ Register Assembly="DevExpress.XtraCharts.v20.1.Web, Version=20.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dx" %> + +<%@ Register assembly="DevExpress.XtraCharts.v20.1, Version=20.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts" tagprefix="dx" %> + + + + + + + + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+ + + + + + +
+ + diff --git a/OlympiaIntranet/MonitorVaR_old.aspx.cs b/OlympiaIntranet/MonitorVaR_old.aspx.cs new file mode 100644 index 0000000..8b464db --- /dev/null +++ b/OlympiaIntranet/MonitorVaR_old.aspx.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using DevExpress.XtraCharts; +using DevExpress.XtraCharts.Native; +using DevExpress.XtraCharts.Web; +using DevExpress.XtraPrinting; +using DevExpress.XtraPrintingLinks; + +namespace OlympiaIntranet +{ + public partial class MonitorVaR_old : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + //if (HttpContext.Current.User.Identity.IsAuthenticated == false) + //{ + // Response.Redirect("~/SignIn.aspx"); + //} + + if (IsPostBack) + { + string query = CommonClass.ExecSql("monitorVaR_LoadData", glGruppo.Text, glLinea.Text, glGestore.Text, glAdvisor.Text, glConsulente.Text); + + var dataTable = CommonClass.execQuery_Datatable_MySql(query, Properties.Settings.Default.mySqlConnection); // DataIns, NumDeltaPuntuale, NumDeltaMedio + + PlottaGrafico(dataTable); + } + + } + + private void PlottaGrafico(DataTable dataTable) + { + // Cancella tutte le serie prima di plottare + chartControl.Series.Clear(); + + // Cancella tutti i titoli della serie prima di plottare + chartControl.Titles.Clear(); + + // Setta titolo del grafico + SettaTitoloGrafico(); + + // Setta posizione legenda + Legend legend = chartControl.Legend; + legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; + legend.AlignmentVertical = LegendAlignmentVertical.BottomOutside; + legend.Direction = LegendDirection.LeftToRight; + + // Create a new bar series. + Series series = new Series("# pos. sconfinanti per VaR puntuale", ViewType.Line); + series.ArgumentScaleType = ScaleType.DateTime; + series.ArgumentDataMember = "Data"; + series.ValueScaleType = ScaleType.Numerical; + series.ValueDataMembers.AddRange(new string[] { "NumDeltaPuntuale" }); + chartControl.Series.Add(series); + + Series series1 = new Series("# pos. sconfinanti per VaR medio", ViewType.Line); + series1.ArgumentScaleType = ScaleType.DateTime; + series1.ArgumentDataMember = "Data"; + series1.ValueScaleType = ScaleType.Numerical; + series1.ValueDataMembers.AddRange(new string[] { "NumDeltaMedio" }); + chartControl.Series.Add(series1); + + // Specify the series data source. + series.DataSource = dataTable; + series1.DataSource = dataTable; + + //XYDiagramSeriesViewBase view = (XYDiagramSeriesViewBase)series.View; + //SplineSeriesView ssv = view as SplineSeriesView; + //ssv.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; + + //XYDiagramSeriesViewBase view1 = (XYDiagramSeriesViewBase)series1.View; + //SplineSeriesView ssv1 = view1 as SplineSeriesView; + //ssv1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; + + XYDiagramSeriesViewBase view = (XYDiagramSeriesViewBase)series.View; + LineSeriesView ssv = view as LineSeriesView; + ssv.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; + + XYDiagramSeriesViewBase view1 = (XYDiagramSeriesViewBase)series1.View; + LineSeriesView ssv1 = view1 as LineSeriesView; + ssv1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False; + } + + private void SettaTitoloGrafico() + { + // Create chart titles. + ChartTitle chartTitle1 = new ChartTitle(); + ChartTitle chartTitle2 = new ChartTitle(); + // Define the text for the titles. + chartTitle1.Text = "Numero posizioni sconfinanti per VaR"; + + chartTitle2.Text = TitoloFiltri(); + + chartTitle2.WordWrap = true; + chartTitle2.MaxLineCount = 2; + + // Define the alignment of the titles. + chartTitle1.Alignment = StringAlignment.Near; + chartTitle2.Alignment = StringAlignment.Near; + + // Place the titles where it's required. + chartTitle1.Dock = ChartTitleDockStyle.Top; + chartTitle2.Dock = ChartTitleDockStyle.Top; + + // Customize a title's appearance. + chartTitle1.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle1.Font = new Font("Tahoma", 14, FontStyle.Bold); + chartTitle1.TextColor = Color.Blue; + chartTitle1.Indent = 10; + + // Customize a title's appearance. + chartTitle2.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True; + chartTitle2.Font = new Font("Arial", 10, FontStyle.Italic); + chartTitle2.TextColor = Color.Black; + chartTitle2.Indent = 10; + + // Add the titles to the chart. + chartControl.Titles.AddRange(new ChartTitle[] {chartTitle1,chartTitle2}); + } + + private string TitoloFiltri() + { + string filtro = String.Empty; + if (String.IsNullOrEmpty(glGestore.Text) == true) { filtro += "Gestore: tutti "; } else { filtro += $"Gestore: {glGestore.Text} "; } + if (String.IsNullOrEmpty(glAdvisor.Text) == true) { filtro += "Advisor: tutti "; } else { filtro += $"Advisor: {glAdvisor.Text} "; } + if (String.IsNullOrEmpty(glConsulente.Text) == true) { filtro += "Consulente: tutti "; } else { filtro += $"Consulente: {glConsulente.Text} "; } + if (String.IsNullOrEmpty(glGruppo.Text) == true) { filtro += "Gruppo: tutti "; } else { filtro += $"Gruppo: {glGruppo.Text} "; } + if (String.IsNullOrEmpty(glLinea.Text) == true) { filtro += "Linea: tutti "; } else { filtro += $"Linea: {glLinea.Text} "; } + return (filtro); + } + + + protected void btnEsportaPdf_Click(object sender, EventArgs e) + { + // Esporta grafico in pdf + var ps = new PrintingSystem(); + ps.PageSettings.Landscape = true; + var link1 = new PrintableComponentLink(); + chartControl.DataBind(); + link1.Component = ((IChartContainer)chartControl).Chart; + link1.Landscape = true; + link1.PrintingSystem = ps; + link1.CreateDocument(); + ps.Document.AutoFitToPagesWidth = 1; // Fit to page + using (var stream = new MemoryStream()) + { + link1.PrintingSystem.ExportToPdf(stream); + Response.Clear(); + Response.Buffer = false; + Response.AppendHeader("Content-Type", "application/pdf"); + Response.AppendHeader("Content-Transfer-Encoding", "binary"); + Response.AppendHeader("Content-Disposition", "attachment; filename=HomePageCharts.pdf"); + Response.BinaryWrite(stream.GetBuffer()); + Response.End(); + } + ps.Dispose(); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/MonitorVaR_old.aspx.designer.cs b/OlympiaIntranet/MonitorVaR_old.aspx.designer.cs new file mode 100644 index 0000000..191db5c --- /dev/null +++ b/OlympiaIntranet/MonitorVaR_old.aspx.designer.cs @@ -0,0 +1,150 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class MonitorVaR_old { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// glGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup glGestore; + + /// + /// glAdvisor control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup glAdvisor; + + /// + /// glConsulente control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup glConsulente; + + /// + /// glGruppo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup glGruppo; + + /// + /// glLinea control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup glLinea; + + /// + /// btnShowChart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnShowChart; + + /// + /// btnEsportaPdf control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnEsportaPdf; + + /// + /// chartControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.XtraCharts.Web.WebChartControl chartControl; + + /// + /// SqlDSLinea control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSLinea; + + /// + /// SqlDSGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGestore; + + /// + /// SqlDSAdvisor control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSAdvisor; + + /// + /// SqlDSConsulente control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSConsulente; + + /// + /// SqlDSGruppo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGruppo; + } +} diff --git a/OlympiaIntranet/MyException.cs b/OlympiaIntranet/MyException.cs new file mode 100644 index 0000000..e0bc02d --- /dev/null +++ b/OlympiaIntranet/MyException.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace OlympiaIntranet +{ + public class MyException : Exception + { + public MyException(string message) : base(message) + { + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/OlympiaIntranet.csproj b/OlympiaIntranet/OlympiaIntranet.csproj new file mode 100644 index 0000000..56d61a3 --- /dev/null +++ b/OlympiaIntranet/OlympiaIntranet.csproj @@ -0,0 +1,810 @@ + + + + + + Debug + AnyCPU + + + 2.0 + {343269B8-30DD-430E-8A63-B55DC1209097} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + OlympiaIntranet + OlympiaIntranet + v4.7.2 + true + + + + + + + + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + true + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\packages\ClosedXML.0.94.2\lib\net46\ClosedXML.dll + + + + + False + ..\..\..\..\..\..\..\..\Program Files\DevExpress 23.2\Components\Bin\Framework\DevExpress.Docs.v23.2.dll + + + False + + + False + + + + + + + False + + + + + + False + + + False + ..\..\..\..\..\..\..\..\Program Files\DevExpress 23.2\Components\Bin\Framework\DevExpress.Spreadsheet.v23.2.Core.dll + + + False + + + False + + + False + + + + + False + + + + + + + + False + + + False + + + False + + + + ..\packages\DocumentFormat.OpenXml.2.7.2\lib\net46\DocumentFormat.OpenXml.dll + + + ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll + + + ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll + + + ..\packages\ExcelNumberFormat.1.0.3\lib\net20\ExcelNumberFormat.dll + + + ..\packages\FastMember.1.3.0\lib\net45\FastMember.dll + + + ..\packages\LumenWorks.Framework.IO.3.8.0\lib\net20\LumenWorks.Framework.IO.dll + + + ..\packages\Microsoft.AspNet.Identity.Core.2.2.4\lib\net45\Microsoft.AspNet.Identity.Core.dll + + + ..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.3\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll + + + ..\packages\Microsoft.AspNet.Identity.Owin.2.2.4\lib\net45\Microsoft.AspNet.Identity.Owin.dll + + + ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + + ..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll + + + ..\packages\Microsoft.Owin.4.2.2\lib\net45\Microsoft.Owin.dll + + + ..\packages\Microsoft.Owin.Host.SystemWeb.4.1.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll + + + ..\packages\Microsoft.Owin.Security.4.2.2\lib\net45\Microsoft.Owin.Security.dll + + + ..\packages\Microsoft.Owin.Security.Cookies.4.2.2\lib\net45\Microsoft.Owin.Security.Cookies.dll + + + ..\packages\Microsoft.Owin.Security.OAuth.4.1.1\lib\net45\Microsoft.Owin.Security.OAuth.dll + + + ..\packages\MySqlConnector.2.5.0\lib\net471\MySqlConnector.dll + + + ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll + + + ..\packages\Owin.1.0\lib\net40\Owin.dll + + + ..\packages\PDFsharp.1.50.5147\lib\net20\PdfSharp.dll + + + ..\packages\PDFsharp.1.50.5147\lib\net20\PdfSharp.Charting.dll + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + + ..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll + + + ..\packages\System.IO.FileSystem.Primitives.4.0.1\lib\net46\System.IO.FileSystem.Primitives.dll + + + ..\packages\System.IO.Packaging.4.0.0\lib\net46\System.IO.Packaging.dll + + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + + + + + + + + + + + + + + + + + + + + ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + AssociazioneLinee.aspx + ASPXCodeBehind + + + AssociazioneLinee.aspx + + + AUM.aspx + ASPXCodeBehind + + + AUM.aspx + + + CapienzaOrdiniSella.aspx + ASPXCodeBehind + + + CapienzaOrdiniSella.aspx + + + + DashboardControlli.aspx + ASPXCodeBehind + + + DashboardControlli.aspx + + + True + True + DataClasses1.dbml + + + Default.aspx + ASPXCodeBehind + + + Default.aspx + + + Default2.aspx + ASPXCodeBehind + + + Default2.aspx + + + EsposizioneCertificati.aspx + ASPXCodeBehind + + + EsposizioneCertificati.aspx + + + EsposizioneTitoli_old.aspx + ASPXCodeBehind + + + EsposizioneTitoli_old.aspx + + + EsposizioneTitoli.aspx + ASPXCodeBehind + + + EsposizioneTitoli.aspx + + + GPMAssetAllocationAPI.aspx + ASPXCodeBehind + + + GPMAssetAllocationAPI.aspx + + + GPMDispRendRiskAPI.aspx + ASPXCodeBehind + + + GPMDispRendRiskAPI.aspx + + + LimitiViolati.aspx + ASPXCodeBehind + + + LimitiViolati.aspx + + + LimitiUcits.aspx + ASPXCodeBehind + + + LimitiUcits.aspx + + + GPMAssetAllocation.aspx + ASPXCodeBehind + + + GPMAssetAllocation.aspx + + + GestioneOrdini.aspx + ASPXCodeBehind + + + GestioneOrdini.aspx + + + Global.asax + + + GPMDispRendRisk.aspx + ASPXCodeBehind + + + GPMDispRendRisk.aspx + + + + + + Margini.aspx + ASPXCodeBehind + + + Margini.aspx + + + Mifir.aspx + ASPXCodeBehind + + + Mifir.aspx + + + Login.aspx + ASPXCodeBehind + + + Login.aspx + + + MonitorVaR.aspx + ASPXCodeBehind + + + MonitorVaR.aspx + + + MSReset.aspx + ASPXCodeBehind + + + MSReset.aspx + + + + OrdiniFondiUBS.aspx + ASPXCodeBehind + + + OrdiniFondiUBS.aspx + + + Performance1Day.aspx + ASPXCodeBehind + + + Performance1Day.aspx + + + PerformanceYTDLinee.aspx + ASPXCodeBehind + + + PerformanceYTDLinee.aspx + + + PerformanceYTDLineeAPI.aspx + ASPXCodeBehind + + + PerformanceYTDLineeAPI.aspx + + + + True + True + Settings.settings + + + ElencoProxy.aspx + ASPXCodeBehind + + + ElencoProxy.aspx + + + ElencoTitoli.aspx + ASPXCodeBehind + + + ElencoTitoli.aspx + + + AndamentoRaccolta.aspx + ASPXCodeBehind + + + AndamentoRaccolta.aspx + + + RankingBreveTermineFondiETF.aspx + ASPXCodeBehind + + + RankingBreveTermineFondiETF.aspx + + + Reconciliator.aspx + ASPXCodeBehind + + + Reconciliator.aspx + + + ReportAllFunds.aspx + ASPXCodeBehind + + + ReportAllFunds.aspx + + + Component + + + ReportPortfoglioApi.aspx + ASPXCodeBehind + + + ReportPortfoglioApi.aspx + + + Fondi.aspx + ASPXCodeBehind + + + Fondi.aspx + + + RetroGruppi.aspx + ASPXCodeBehind + + + RetroGruppi.aspx + + + RicercaSottostanti.aspx + ASPXCodeBehind + + + RicercaSottostanti.aspx + + + ScostamentoPerformance.aspx + ASPXCodeBehind + + + ScostamentoPerformance.aspx + + + SelettoreCertificati.aspx + ASPXCodeBehind + + + SelettoreCertificati.aspx + + + SelettoreFondiETF.aspx + ASPXCodeBehind + + + SelettoreFondiETF.aspx + + + SignIn.aspx + ASPXCodeBehind + + + SignIn.aspx + + + VaR.aspx + ASPXCodeBehind + + + VaR.aspx + + + VerificheAML.aspx + ASPXCodeBehind + + + VerificheAML.aspx + + + Verify2FA.aspx + ASPXCodeBehind + + + Verify2FA.aspx + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MSLinqToSQLGenerator + DataClasses1.designer.cs + Designer + + + DataClasses1.dbml + + + + + + + + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + Web.config + + + Web.config + + + + + + + + + + + + ReportPortafoglio.cs + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 63155 + / + http://localhost:63155/ + False + False + + + False + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + \ No newline at end of file diff --git a/OlympiaIntranet/OrdiniFondiUBS.aspx b/OlympiaIntranet/OrdiniFondiUBS.aspx new file mode 100644 index 0000000..d40d769 --- /dev/null +++ b/OlympiaIntranet/OrdiniFondiUBS.aspx @@ -0,0 +1,65 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OrdiniFondiUBS.aspx.cs" Inherits="OlympiaIntranet.OrdiniFondiUBS" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + +
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + diff --git a/OlympiaIntranet/OrdiniFondiUBS.aspx.cs b/OlympiaIntranet/OrdiniFondiUBS.aspx.cs new file mode 100644 index 0000000..5dc89ae --- /dev/null +++ b/OlympiaIntranet/OrdiniFondiUBS.aspx.cs @@ -0,0 +1,31 @@ +using DevExpress.Export; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class OrdiniFondiUBS : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void btnEsportaExcel_Click(object sender, EventArgs e) + { + gvOrdiniFondiUBS.Settings.GridLines = System.Web.UI.WebControls.GridLines.None; // Toglie i bordi nelle celle, per visualizzare come in Excel + + ASPxGridViewExporter1.ExportSelectedRowsOnly = false; + ASPxGridViewExporter1.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - Ordini_Fondi_UBS"; + XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.DataAware }; + ASPxGridViewExporter1.WriteXlsxToResponse(op); + + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/OrdiniFondiUBS.aspx.designer.cs b/OlympiaIntranet/OrdiniFondiUBS.aspx.designer.cs new file mode 100644 index 0000000..92747db --- /dev/null +++ b/OlympiaIntranet/OrdiniFondiUBS.aspx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class OrdiniFondiUBS { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// btnEsportaExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnEsportaExcel; + + /// + /// gvOrdiniFondiUBS control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvOrdiniFondiUBS; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + + /// + /// SqlDSOrdiniFondiUBS control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSOrdiniFondiUBS; + } +} diff --git a/OlympiaIntranet/Performance1Day.aspx b/OlympiaIntranet/Performance1Day.aspx new file mode 100644 index 0000000..fe0b1b9 --- /dev/null +++ b/OlympiaIntranet/Performance1Day.aspx @@ -0,0 +1,150 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Performance1Day.aspx.cs" Inherits="OlympiaIntranet.Performance1Day" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + +<%-- + + + + + + + + + + + + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%-- --%> + + + + + + + + + + + + + + + + + + + +
+ + + + + + +<%-- + + + + + --%> + + +
+ + diff --git a/OlympiaIntranet/Performance1Day.aspx.cs b/OlympiaIntranet/Performance1Day.aspx.cs new file mode 100644 index 0000000..a80e604 --- /dev/null +++ b/OlympiaIntranet/Performance1Day.aspx.cs @@ -0,0 +1,218 @@ +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class Performance1Day : System.Web.UI.Page + { + List listSuperUser = new List {"fpisoni", "fcostalonga", "glicciardello"}; + protected void Page_Load(object sender, EventArgs e) + { + //if (HttpContext.Current.User.Identity.IsAuthenticated == false) + //{ + // Response.Redirect("~/SignIn.aspx"); + //} + //else + //{ + // //if (!IsPostBack) + // //{ + // string loggedUser = HttpContext.Current.User.Identity.Name; + + // loggedUser = "rcammarino"; // da togliere!! + + // if (listSuperUser.Contains(loggedUser) == true) gridLookupGestore.Enabled = true; + // else + // { + // string Gestore = loggedUser.ToUpper().Substring(1); + // gridLookupGestore.Value = Gestore; + // gridLookupGestore.GridView.Selection.SelectRowByKey(Gestore); + // gridLookupGestore.Enabled = false; + // } + + // Session["cod_ges"] = gridLookupGestore.Value; // serve per popolare gridlookupLinea!! + // Session["cod_adv"] = gridLookupAdvisor.Value; // serve per popolare gridlookupLinea!! + // Session["user"] = loggedUser; // serve per popolare gridlookupGestore!! + // //} + //} + + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + else + { + string loggedUser = HttpContext.Current.User.Identity.Name; + + //if (!IsPostBack) + //{ + //{ + // Carica Gestori in gridLookupGestore + gridLookupGestore.DataSource = CommonClass.GetGestori(); + gridLookupGestore.DataBind(); + + // Se il gestore è uno dei super user allora il gridlookup è sbloccato , altrimenti viene bloccato sul gestore stesso in modo che ogni gestore guarda i propri dati (da implementare questa soluzione anche in GPMDispRendRisk , GPMAssetAllocation perchè non funziona per come è implementata!) + if (listSuperUser.Contains(loggedUser) == true) gridLookupGestore.Enabled = true; + else + { + string Gestore = loggedUser.ToUpper().Substring(1); + gridLookupGestore.Value = Gestore; + gridLookupGestore.Enabled = false; + } + + SetSessionGestore(); + //SetSessionAdvisor(); + + // Carica Performance 1Day in gvPerformance1Day + BindGridView(); + //} + } + } + + //private DataTable GetAdvisor() + //{ + // string query = "GDN_GetAdvisor"; + // ASPxGridView grid = gridLookupGestore.GridView; + // object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + // if (objGestore == null) return null; + + // using (SqlConnection conn = new SqlConnection(OlympiaIntranet.Properties.Settings.Default.SqlConnection)) + // { + // using (SqlCommand cmd = new SqlCommand(query, conn)) + // { + // cmd.CommandType = CommandType.StoredProcedure; + // cmd.Parameters.Add(new SqlParameter("@cod_ges", SqlDbType.VarChar) { Value = (string)objGestore }); + + // using (SqlDataAdapter da = new SqlDataAdapter(cmd)) + // { + // DataTable dt = new DataTable(); + // da.Fill(dt); + // return dt; + // } + // } + // } + //} + + + + protected void gridLookupGestore_ValueChanged(object sender, EventArgs e) + { + // ref: https://supportcenter.devexpress.com/ticket/details/q340370/aspxgridlookup-how-to-refresh-the-control-after-some-data-is-changed + // note: Per refreshare gridlookupLinea e gridlookupAdvisor sulla base del valore di gridLookupGestore, salvo il valore gestore in una variabile di sessione Session["cod_ges"] + // e poi il refresh/rebind di SqlDSLinee e SqlDSAdvisor verrà effettuato nell'evento lato client EndCallBack + + SetSessionGestore(); + } + + private void SetSessionGestore() + { + ASPxGridView grid = gridLookupGestore.GridView; + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + + if (objGestore != null) + { + Session["cod_ges"] = (string)objGestore; + } + } + + //protected void gridLookupAdvisor_ValueChanged(object sender, EventArgs e) + //{ + // SetSessionAdvisor(); + //} + + //private void SetSessionAdvisor() + //{ + // ASPxGridView grid = gridLookupAdvisor.GridView; + // object objAdvisor = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Advisor" }); + + // if (objAdvisor != null) + // { + // Session["cod_adv"] = (string)objAdvisor; + // } + //} + + protected void buttonCaricaDati_Click(object sender, EventArgs e) + { + // Carica Performance 1Day in gvPerformance1Day + //gvPerformance1Day.KeyFieldName = "Portafoglio"; + //gvPerformance1Day.DataSource = GetPerformance1Day(); + //gvPerformance1Day.DataBind(); + + BindGridView(); + } + + private DataTable GetPerformance1Day() + { + string query = "GDN_GetPerformance1Day1"; + ASPxGridView grid = gridLookupGestore.GridView; + + object objGestore = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Gestore" }); + grid = gridLookupLinea.GridView; + object objLinea = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Linea" }); + //grid = gridLookupAdvisor.GridView; + //object objAdvisor = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "Advisor" }); + //if (!(objGestore != null && objLinea != null && objAdvisor != null)) return null; + if (!(objGestore != null && objLinea != null)) return null; + + using (SqlConnection conn = new SqlConnection(OlympiaIntranet.Properties.Settings.Default.SqlConnection)) + { + using (SqlCommand cmd = new SqlCommand(query, conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + + // Aggiungi i parametri + cmd.Parameters.Add(new SqlParameter("@cod_ges", SqlDbType.VarChar) { Value = (string)objGestore }); + //cmd.Parameters.Add(new SqlParameter("@cod_adv", SqlDbType.VarChar) { Value = (string)objAdvisor }); + cmd.Parameters.Add(new SqlParameter("@cod_lin", SqlDbType.VarChar) { Value = (string)objLinea }); + using (SqlDataAdapter da = new SqlDataAdapter(cmd)) + { + DataTable dt = new DataTable(); + da.Fill(dt); + return dt; + } + } + } + } + + private void BindGridView() + { + DataTable dt = GetPerformance1Day(); + if (dt == null) return; + gvPerformance1Day.DataSource = dt; + + gvPerformance1Day.Columns.Clear(); + + foreach (DataColumn column in dt.Columns) + { + GridViewDataTextColumn gridColumn = new GridViewDataTextColumn(); + gridColumn.FieldName = column.ColumnName; + gridColumn.Caption = column.ColumnName; + gvPerformance1Day.Columns.Add(gridColumn); + } + + gvPerformance1Day.DataBind(); + } + + protected void gvPerformance1Day_DataBound(object sender, EventArgs e) + { + + } + + protected void buttonEsportaExcel_Click(object sender, EventArgs e) + { + BindGridView(); // Rieffettua il bind alla griglia altrimenti non visualizza niente nell'excel!! + ASPxGridViewExporter1.ExportSelectedRowsOnly = false; + ASPxGridViewExporter1.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - Performance 1 Day"; + XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.WYSIWYG }; + ASPxGridViewExporter1.WriteXlsxToResponse(op); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/Performance1Day.aspx.designer.cs b/OlympiaIntranet/Performance1Day.aspx.designer.cs new file mode 100644 index 0000000..9f9c483 --- /dev/null +++ b/OlympiaIntranet/Performance1Day.aspx.designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class Performance1Day + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// gridLookupGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupGestore; + + /// + /// gridLookupLinea control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupLinea; + + /// + /// buttonCaricaDati control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonCaricaDati; + + /// + /// buttonEsportaExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonEsportaExcel; + + /// + /// gvPerformance1Day control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvPerformance1Day; + + /// + /// SqlDSLinee control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSLinee; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + } +} diff --git a/OlympiaIntranet/PerformanceYTDLinee.aspx b/OlympiaIntranet/PerformanceYTDLinee.aspx new file mode 100644 index 0000000..949f093 --- /dev/null +++ b/OlympiaIntranet/PerformanceYTDLinee.aspx @@ -0,0 +1,94 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PerformanceYTDLinee.aspx.cs" Inherits="OlympiaIntranet.PerformanceYTDLinee" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.XtraCharts.v23.2.Web, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.XtraCharts.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts" TagPrefix="dx" %> + + + + + + + + +
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+ + diff --git a/OlympiaIntranet/PerformanceYTDLinee.aspx.cs b/OlympiaIntranet/PerformanceYTDLinee.aspx.cs new file mode 100644 index 0000000..cf701df --- /dev/null +++ b/OlympiaIntranet/PerformanceYTDLinee.aspx.cs @@ -0,0 +1,139 @@ +using DevExpress.Export; +using DevExpress.XtraCharts; +using DevExpress.XtraCharts.Native; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.Data; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Threading; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class PerformanceYTDLinee : System.Web.UI.Page + { + + protected void Page_Init(object sender, EventArgs e) + { + CultureInfo ci = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone(); + ci.NumberFormat.NumberDecimalSeparator = ","; + Thread.CurrentThread.CurrentCulture = ci; + } + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + DataTable dtBarsData = CommonClass.execQuery_Datatable_Sql("GDN_PerformanceYTDLinee_Load", Properties.Settings.Default.SqlConnection); + Session["BarsData"] = dtBarsData; + gvPerformanceYTDLinee.DataSource = dtBarsData; + gvPerformanceYTDLinee.DataBind(); + + barChart.DataSource = dtBarsData; + + // Cancella tutte le serie prima di plottare + barChart.Series.Clear(); + + // Cancella tutti i titoli della serie prima di plottare + barChart.Titles.Clear(); + + // Rimuove legenda aggiuntiva dei portafogli + barChart.Legends.Clear(); + + // Aggiunge barre al grafico relative a PerfYTDAvg + Series series1 = new Series("Perf. YTD (Avg)", ViewType.Bar); + foreach (DataRow rowBars in dtBarsData.Rows) + { + series1.Points.Add(new SeriesPoint(rowBars[0].ToString(), rowBars[1])); + } + barChart.Series.Add(series1); + + // Aggiunge barre al grafico relative a PerfYTDStd + Series series2 = new Series("Perf. YTD (Std)", ViewType.Bar); + foreach (DataRow rowBars in dtBarsData.Rows) + { + series2.Points.Add(new SeriesPoint(rowBars[0].ToString(), rowBars[2])); + } + barChart.Series.Add(series2); + + + // Hide the legend (if necessary). + barChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; + + // Ruota etichetta sulle ascisse di 180 + XYDiagram diagram = (XYDiagram)barChart.Diagram; + if (diagram != null) + { + // Ruota etichetta sulle ascisse di 180 + diagram.AxisX.Label.Angle = -90; + diagram.AxisX.QualitativeScaleOptions.AutoGrid = false; // ref link: https://supportcenter.devexpress.com/ticket/details/t567170/how-to-force-displaying-all-axis-labels-when-the-qualitative-scale-type-is-used + diagram.AxisX.QualitativeScaleOptions.GridSpacing = 1; + + // Rimuove margini su asse Y + diagram.AxisY.WholeRange.AutoSideMargins = false; + diagram.AxisY.WholeRange.EndSideMargin = 0; + diagram.AxisY.WholeRange.StartSideMargin = 0; + + // Setta Ordinate (Asse Y) in percentuale + //diagram.AxisY.Label.TextPattern = "{VP:P0}"; + + } + + // Add a title to the chart (if necessary). + ChartTitle chartTitle1 = new ChartTitle(); + chartTitle1.Text = "Performance YTD (Avg) / Performance YTD (Std)"; + barChart.Titles.Add(chartTitle1); + + } + + protected void ASPxExportXls_Click(object sender, EventArgs e) + { + ASPxGridViewExporter1.ExportSelectedRowsOnly = false; + ASPxGridViewExporter1.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - Performance YTD Linee"; + XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.DataAware }; // in DataAware mode l'evento ASPxGridViewExporter_RenderBrick non viene eseguito!! + ASPxGridViewExporter1.WriteXlsxToResponse(op); + } + + protected void ASPxExportPdf_Click(object sender, EventArgs e) + { + ASPxGridViewExporter1.ExportSelectedRowsOnly = false; + ASPxGridViewExporter1.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - Performance YTD Linee"; + PdfExportOptions op = new PdfExportOptions() { }; + ASPxGridViewExporter1.WritePdfToResponse(op); + } + + protected void buttonEsportaPdf_Click(object sender, EventArgs e) + { + // Esporta grafico in pdf + //var ps = new PrintingSystem(); + //ps.PageSettings.Landscape = true; + //var link1 = new PrintableComponentLink(); + //barChart.DataBind(); + //link1.Component = ((IChartContainer)barChart).Chart; + //link1.Landscape = true; + //link1.PrintingSystem = ps; + //link1.CreateDocument(); + //ps.Document.AutoFitToPagesWidth = 1; // Fit to page + + //using (var stream = new MemoryStream()) + //{ + // link1.PrintingSystem.ExportToPdf(stream); + // Response.Clear(); + // Response.Buffer = false; + // Response.AppendHeader("Content-Type", "application/pdf"); + // Response.AppendHeader("Content-Transfer-Encoding", "binary"); + // Response.AppendHeader("Content-Disposition", $"attachment; filename=PerformanceYTD_Histogram_{DateTime.Now.Date.ToString("yyyyMMdd")}.pdf"); // 'PerformanceYTD_Histogram_' + date.toLocaleDateString(); + // Response.BinaryWrite(stream.GetBuffer()); + // Response.End(); + //} + //ps.Dispose(); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/PerformanceYTDLinee.aspx.designer.cs b/OlympiaIntranet/PerformanceYTDLinee.aspx.designer.cs new file mode 100644 index 0000000..c4d5aad --- /dev/null +++ b/OlympiaIntranet/PerformanceYTDLinee.aspx.designer.cs @@ -0,0 +1,87 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class PerformanceYTDLinee { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxExportXls control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxExportXls; + + /// + /// ASPxExportPdf control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxExportPdf; + + /// + /// buttonEsportaPdf control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton buttonEsportaPdf; + + /// + /// gvPerformanceYTDLinee control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvPerformanceYTDLinee; + + /// + /// barChart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.XtraCharts.Web.WebChartControl barChart; + + /// + /// SqlDSPerformanceYTDLinee control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSPerformanceYTDLinee; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + } +} diff --git a/OlympiaIntranet/PerformanceYTDLineeAPI.aspx b/OlympiaIntranet/PerformanceYTDLineeAPI.aspx new file mode 100644 index 0000000..9876e81 --- /dev/null +++ b/OlympiaIntranet/PerformanceYTDLineeAPI.aspx @@ -0,0 +1,57 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PerformanceYTDLineeAPI.aspx.cs" Inherits="OlympiaIntranet.PerformanceYTDLineeAPI" %> +<%@ Register Assembly="DevExpress.XtraCharts.v23.2.Web, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.XtraCharts.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts" TagPrefix="dx" %> + + + + + + + + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + diff --git a/OlympiaIntranet/PerformanceYTDLineeAPI.aspx.cs b/OlympiaIntranet/PerformanceYTDLineeAPI.aspx.cs new file mode 100644 index 0000000..ea9edfd --- /dev/null +++ b/OlympiaIntranet/PerformanceYTDLineeAPI.aspx.cs @@ -0,0 +1,152 @@ +using DevExpress.XtraCharts; +using DevExpress.XtraCharts.Native; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.Data; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Threading; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class PerformanceYTDLineeAPI : System.Web.UI.Page + { + string tipo = String.Empty; + + protected void Page_Init(object sender, EventArgs e) + { + CultureInfo ci = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone(); + ci.NumberFormat.NumberDecimalSeparator = ","; + Thread.CurrentThread.CurrentCulture = ci; + } + protected void Page_Load(object sender, EventArgs e) // Parametro input : tipo = "table" | "chart" + { + tipo = Request.QueryString["tipo"]; + + if (tipo == "chart") + { + PlottaBarChart(); + + EsportaChart_pdf(); + } + + if (tipo == "table") + { + PopulateTable(); + + EsportaTable_pdf(); + } + } + + private void EsportaTable_pdf() + { + ASPxGridViewExporter1.ExportSelectedRowsOnly = false; + ASPxGridViewExporter1.FileName = $"PerformanceYTD_Table_{ DateTime.Now.Date.ToString("yyyyMMdd")}.pdf"; // DateTime.Now.ToString("yyyyMMdd_HHmm") + " - Performance YTD Linee"; + PdfExportOptions op = new PdfExportOptions() { }; + ASPxGridViewExporter1.WritePdfToResponse(op); + } + + private void PopulateTable() + { + DataTable dtBarsData = CommonClass.execQuery_Datatable_Sql("GDN_PerformanceYTDLinee_Load", Properties.Settings.Default.SqlConnection); + Session["BarsData"] = dtBarsData; + gvPerformanceYTDLinee.DataSource = dtBarsData; + gvPerformanceYTDLinee.DataBind(); + } + + private void EsportaChart_pdf() + { + // Esporta grafico in pdf + var ps = new PrintingSystem(); + ps.PageSettings.Landscape = true; + var link1 = new PrintableComponentLink(); + barChart.DataBind(); + link1.Component = ((IChartContainer)barChart).Chart; + link1.Landscape = true; + link1.PrintingSystem = ps; + link1.CreateDocument(); + ps.Document.AutoFitToPagesWidth = 1; // Fit to page + + using (var stream = new MemoryStream()) + { + link1.PrintingSystem.ExportToPdf(stream); + Response.Clear(); + Response.Buffer = false; + Response.AppendHeader("Content-Type", "application/pdf"); + Response.AppendHeader("Content-Transfer-Encoding", "binary"); + Response.AppendHeader("Content-Disposition", $"attachment; filename=PerformanceYTD_Chart_{DateTime.Now.Date.ToString("yyyyMMdd")}.pdf"); + Response.BinaryWrite(stream.GetBuffer()); + Response.End(); + } + ps.Dispose(); + } + + private void PlottaBarChart() + { + DataTable dtBarsData = CommonClass.execQuery_Datatable_Sql("GDN_PerformanceYTDLinee_Load", Properties.Settings.Default.SqlConnection); + Session["BarsData"] = dtBarsData; + gvPerformanceYTDLinee.DataSource = dtBarsData; + gvPerformanceYTDLinee.DataBind(); + + barChart.DataSource = dtBarsData; + + // Cancella tutte le serie prima di plottare + barChart.Series.Clear(); + + // Cancella tutti i titoli della serie prima di plottare + barChart.Titles.Clear(); + + // Rimuove legenda aggiuntiva dei portafogli + barChart.Legends.Clear(); + + // Aggiunge barre al grafico relative a PerfYTDAvg + Series series1 = new Series("Perf. YTD (Avg)", ViewType.Bar); + foreach (DataRow rowBars in dtBarsData.Rows) + { + series1.Points.Add(new SeriesPoint(rowBars[0].ToString(), rowBars[1])); + } + barChart.Series.Add(series1); + + // Aggiunge barre al grafico relative a PerfYTDStd + Series series2 = new Series("Perf. YTD (Std)", ViewType.Bar); + foreach (DataRow rowBars in dtBarsData.Rows) + { + series2.Points.Add(new SeriesPoint(rowBars[0].ToString(), rowBars[2])); + } + barChart.Series.Add(series2); + + + // Hide the legend (if necessary). + barChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; + + // Ruota etichetta sulle ascisse di 180 + XYDiagram diagram = (XYDiagram)barChart.Diagram; + if (diagram != null) + { + // Ruota etichetta sulle ascisse di 180 + diagram.AxisX.Label.Angle = -90; + diagram.AxisX.QualitativeScaleOptions.AutoGrid = false; // ref link: https://supportcenter.devexpress.com/ticket/details/t567170/how-to-force-displaying-all-axis-labels-when-the-qualitative-scale-type-is-used + diagram.AxisX.QualitativeScaleOptions.GridSpacing = 1; + + // Rimuove margini su asse Y + diagram.AxisY.WholeRange.AutoSideMargins = false; + diagram.AxisY.WholeRange.EndSideMargin = 0; + diagram.AxisY.WholeRange.StartSideMargin = 0; + + // Setta Ordinate (Asse Y) in percentuale + //diagram.AxisY.Label.TextPattern = "{VP:P0}"; + + } + + // Add a title to the chart (if necessary). + ChartTitle chartTitle1 = new ChartTitle(); + chartTitle1.Text = "Performance YTD (Avg) / Performance YTD (Std)"; + barChart.Titles.Add(chartTitle1); + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/PerformanceYTDLineeAPI.aspx.designer.cs b/OlympiaIntranet/PerformanceYTDLineeAPI.aspx.designer.cs new file mode 100644 index 0000000..569aba9 --- /dev/null +++ b/OlympiaIntranet/PerformanceYTDLineeAPI.aspx.designer.cs @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class PerformanceYTDLineeAPI { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// gvPerformanceYTDLinee control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvPerformanceYTDLinee; + + /// + /// barChart control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.XtraCharts.Web.WebChartControl barChart; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + } +} diff --git a/OlympiaIntranet/Properties/AssemblyInfo.cs b/OlympiaIntranet/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..727d028 --- /dev/null +++ b/OlympiaIntranet/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OlympiaIntranet")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OlympiaIntranet")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("343269b8-30dd-430e-8a63-b55dc1209097")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OlympiaIntranet/Properties/PublishProfiles/FolderProfile.pubxml b/OlympiaIntranet/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..59dc41b --- /dev/null +++ b/OlympiaIntranet/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,17 @@ + + + + + false + false + true + Release + Any CPU + FileSystem + bin\app.publish\ + FileSystem + <_TargetId>Folder + + \ No newline at end of file diff --git a/OlympiaIntranet/Properties/PublishProfiles/Olympia (PROD NEW).pubxml b/OlympiaIntranet/Properties/PublishProfiles/Olympia (PROD NEW).pubxml new file mode 100644 index 0000000..b9afa3f --- /dev/null +++ b/OlympiaIntranet/Properties/PublishProfiles/Olympia (PROD NEW).pubxml @@ -0,0 +1,63 @@ + + + + + MSDeploy + Release + Any CPU + https://www.olympia-wealth.net/intranet/Default2.aspx + true + false + http://26.69.136.210 + /olympia-wealth.net/intranet + + true + RemoteAgent + true + Administrator + <_SavePWD>true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + \ No newline at end of file diff --git a/OlympiaIntranet/Properties/PublishProfiles/Olympia (PROD OLD).pubxml b/OlympiaIntranet/Properties/PublishProfiles/Olympia (PROD OLD).pubxml new file mode 100644 index 0000000..0ac3be1 --- /dev/null +++ b/OlympiaIntranet/Properties/PublishProfiles/Olympia (PROD OLD).pubxml @@ -0,0 +1,62 @@ + + + + + MSDeploy + Release + Any CPU + https://olympia.smart-roots.net:4006/intranet/signin.aspx + True + False + http://26.69.45.60 + /olympia/intranet + + True + RemoteAgent + True + Administrator + <_SavePWD>True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OlympiaIntranet/Properties/PublishProfiles/Olympia (TEST OLD).pubxml b/OlympiaIntranet/Properties/PublishProfiles/Olympia (TEST OLD).pubxml new file mode 100644 index 0000000..eb47cca --- /dev/null +++ b/OlympiaIntranet/Properties/PublishProfiles/Olympia (TEST OLD).pubxml @@ -0,0 +1,62 @@ + + + + + MSDeploy + Release + Any CPU + https://olympia.smart-roots.net:4006/backoffice-test/signin.aspx + True + False + http://26.69.45.60 + /olympia/backoffice-test + + True + RemoteAgent + True + Administrator + <_SavePWD>True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OlympiaIntranet/Properties/Settings.Designer.cs b/OlympiaIntranet/Properties/Settings.Designer.cs new file mode 100644 index 0000000..ae6539c --- /dev/null +++ b/OlympiaIntranet/Properties/Settings.Designer.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] + [global::System.Configuration.DefaultSettingValueAttribute("Data Source=26.69.45.60;Initial Catalog=FirstSolutionDB;Persist Security Info=Tru" + + "e;User ID=sa;Password=Skyline72;TrustServerCertificate=True;")] + public string SqlConnection { + get { + return ((string)(this["SqlConnection"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] + [global::System.Configuration.DefaultSettingValueAttribute("Server=192.168.125.10;Port=3306;Database=olympia;Uid=pegasus9x;Pwd=Locarno_4139$;" + + "Tls Version=TLS 1.2;Allow User Variables=True")] + public string mySqlConnection { + get { + return ((string)(this["mySqlConnection"])); + } + } + } +} diff --git a/OlympiaIntranet/Properties/Settings.settings b/OlympiaIntranet/Properties/Settings.settings new file mode 100644 index 0000000..631f999 --- /dev/null +++ b/OlympiaIntranet/Properties/Settings.settings @@ -0,0 +1,22 @@ + + + + + + <?xml version="1.0" encoding="utf-16"?> +<SerializableConnectionString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ConnectionString>Data Source=26.69.45.60;Initial Catalog=FirstSolutionDB;Persist Security Info=True;User ID=sa;Password=Skyline72;TrustServerCertificate=True;</ConnectionString> + <ProviderName>System.Data.SqlClient</ProviderName> +</SerializableConnectionString> + Data Source=26.69.45.60;Initial Catalog=FirstSolutionDB;Persist Security Info=True;User ID=sa;Password=Skyline72;TrustServerCertificate=True; + + + <?xml version="1.0" encoding="utf-16"?> +<SerializableConnectionString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ConnectionString>Server=192.168.125.10;Port=3306;Database=olympia;Uid=pegasus9x;Pwd=Locarno_4139$;Tls Version=TLS 1.2;Allow User Variables=True</ConnectionString> + <ProviderName>MySqlConnector</ProviderName> +</SerializableConnectionString> + Server=192.168.125.10;Port=3306;Database=olympia;Uid=pegasus9x;Pwd=Locarno_4139$;Tls Version=TLS 1.2;Allow User Variables=True + + + \ No newline at end of file diff --git a/OlympiaIntranet/Properties/licenses.licx b/OlympiaIntranet/Properties/licenses.licx new file mode 100644 index 0000000..b89019a --- /dev/null +++ b/OlympiaIntranet/Properties/licenses.licx @@ -0,0 +1,13 @@ +DevExpress.Web.ASPxRadioButtonList, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxGridLookup, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxFormLayout, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxPanel, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxTextBox, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxLabel, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxPageControl, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxDateEdit, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxRibbon, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxGlobalEvents, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxGridViewExporter, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxButton, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.Web.ASPxGridView, DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/OlympiaIntranet/RankingBreveTermineFondiETF.aspx b/OlympiaIntranet/RankingBreveTermineFondiETF.aspx new file mode 100644 index 0000000..293aa28 --- /dev/null +++ b/OlympiaIntranet/RankingBreveTermineFondiETF.aspx @@ -0,0 +1,66 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RankingBreveTermineFondiETF.aspx.cs" Inherits="OlympiaIntranet.RankingBreveTermineFondiETF" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data.Linq" TagPrefix="dx" %> + + + + + + + +
+ + + +<%-- --%> + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + diff --git a/OlympiaIntranet/RankingBreveTermineFondiETF.aspx.cs b/OlympiaIntranet/RankingBreveTermineFondiETF.aspx.cs new file mode 100644 index 0000000..8a700f2 --- /dev/null +++ b/OlympiaIntranet/RankingBreveTermineFondiETF.aspx.cs @@ -0,0 +1,30 @@ +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class RankingBreveTermineFondiETF : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + // Setta in tutte le colonne di default ricerca per 'Contains' invece che per 'Begins with' (mettere in Page_Load altrimenti non funziona!) + CommonClass.SetColumnFilterContains(gvRankingBreveFondiETF); + } + + protected void ASPxExportXls_Click(object sender, EventArgs e) + { + ASPxGridViewExporter1.ExportSelectedRowsOnly = false; + ASPxGridViewExporter1.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - Ranking Breve Termine Fondi/ETF"; + XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.DataAware }; // in DataAware mode l'evento ASPxGridViewExporter_RenderBrick non viene eseguito!! + ASPxGridViewExporter1.WriteXlsxToResponse(op); + } + + } +} \ No newline at end of file diff --git a/OlympiaIntranet/RankingBreveTermineFondiETF.aspx.designer.cs b/OlympiaIntranet/RankingBreveTermineFondiETF.aspx.designer.cs new file mode 100644 index 0000000..d4101f1 --- /dev/null +++ b/OlympiaIntranet/RankingBreveTermineFondiETF.aspx.designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class RankingBreveTermineFondiETF + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxExportXls control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton ASPxExportXls; + + /// + /// gvRankingBreveFondiETF control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvRankingBreveFondiETF; + + /// + /// SqlRankingBreveFondiETF control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlRankingBreveFondiETF; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + } +} diff --git a/OlympiaIntranet/Reconciliator.aspx b/OlympiaIntranet/Reconciliator.aspx new file mode 100644 index 0000000..52a61a1 --- /dev/null +++ b/OlympiaIntranet/Reconciliator.aspx @@ -0,0 +1,143 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Reconciliator.aspx.cs" Inherits="OlympiaIntranet.Reconciliator" UICulture="it" Culture="it-IT" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<%-- + + + + + + + + + --%> + + + + + + + + + + + + + + +
+ + + +<%-- + + + + + + + + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/OlympiaIntranet/Reconciliator.aspx.cs b/OlympiaIntranet/Reconciliator.aspx.cs new file mode 100644 index 0000000..a81121e --- /dev/null +++ b/OlympiaIntranet/Reconciliator.aspx.cs @@ -0,0 +1,245 @@ +using ClosedXML.Excel; +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using MySqlConnector; +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using LumenWorks.Framework.IO.Csv; + +namespace OlympiaIntranet +{ + public partial class Reconciliator : System.Web.UI.Page + { + protected override void InitializeCulture() // Aggiunto altrimenti in produzione prendeva settaggi USA per i decimali con il punto invece che con la virgola + { + Culture = "it-IT"; + UICulture = "it"; + + } + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + } + + protected void uploadControl_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) + { + // ref: https://docs.devexpress.com/AspNet/16891/components/file-management/file-upload/concepts/page-life-cycle-during-file-upload + // nota: ho dovuto settare uploadControl.FileUploadMode = OnPageLoad altrimenti non veniva letto il selectedindex di rblBanca + // perchè non ancora creato in quanto il page life cycle è modificato in caso di upload + + if (rblBanca.SelectedIndex == 0) Session["dtInputFile"] = ElaboraCSVBancaSella(e.UploadedFile); + + if (rblBanca.SelectedIndex == 1) Session["dtInputFile"] = ElaboraCSVUBS(e.UploadedFile); // da implementare! + } + + public DataTable ElaboraCSVUBS(UploadedFile uploadedFile) + { + // ref link: https://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader + DataTable dtCsv = new DataTable(); + DataTable dtTransazioniGDN = new DataTable(); + Char quotingCharacter = '\0'; // means none + Char escapeCharacter = '\0'; + Char commentCharacter = '\0'; + Char delimiter = ';'; + bool hasHeader = true; + if (uploadedFile.IsValid) + { + + using (CsvReader csv = new CsvReader(new StreamReader(uploadedFile.FileContent), hasHeader, delimiter, quotingCharacter, escapeCharacter, commentCharacter, ValueTrimmingOptions.UnquotedOnly)) + { + csv.MissingFieldAction = MissingFieldAction.ReplaceByEmpty; // importante per evitare che schianti ! + csv.SkipEmptyLines = true; + int fieldCount = csv.FieldCount; + + string[] headers = csv.GetFieldHeaders(); + foreach (string nomeColonna in headers) + { + dtCsv.Columns.Add(nomeColonna); + } + + while (csv.ReadNextRecord()) + { + DataRow dr = dtCsv.NewRow(); + for (int i = 0; i < fieldCount; i++) + { + //string valore = csv[i].Replace(",", "#").Replace(".", string.Empty).Replace("#", ".").Replace("+", String.Empty); // sostituisco virgola con punto e tolgo + + string valore = csv[i].Replace("'", string.Empty); + Console.Write(string.Format("{0} = {1};", headers[i], valore)); + dr[i] = valore; + } + dtCsv.Rows.Add(dr); + } + } + + // Crea datatable per salvare i dati in tabella TransazioniGDN + + dtTransazioniGDN.Columns.Add("Portafoglio"); + dtTransazioniGDN.Columns.Add("Importo"); + dtTransazioniGDN.Columns.Add("DataValuta"); + dtTransazioniGDN.Columns.Add("DataOperazione"); + dtTransazioniGDN.Columns.Add("Descrizione"); + string portafoglio = string.Empty; + ASPxGridView grid = gridlookupPortafogli.GridView; + object objPortafoglio = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "cod_rap" }); + if (objPortafoglio != null) + { + portafoglio = objPortafoglio.ToString(); + Session["cod_rap"] = portafoglio; + } + double Accredito = 0; + double Addebito = 0; + foreach (DataRow riga in dtCsv.Rows) + { + if ((riga["Data di valutazione"].ToString().IndexOf("Saldo finale") != -1) || // Skippa se la colonna Data di Valutazione = 'Saldo finale' oppure... + (String.IsNullOrEmpty(riga["Prodotto"].ToString()) == true) || // Skippa se la colonna Prodotto non è valorizzata oppure... + (String.IsNullOrEmpty(riga["Importo singolo"].ToString()) == false) || // Skippa se la colonna Importo singolo è valorizzata oppure... + ((String.IsNullOrEmpty(riga["Accredito"].ToString()) == true) && // Skippa se la colonna Addebito e Accredito sono entrambe vuote + (String.IsNullOrEmpty(riga["Addebito"].ToString()) == true) + ) + + ) continue; + DataRow dr = dtTransazioniGDN.NewRow(); + dr["Portafoglio"] = portafoglio; + if (String.IsNullOrEmpty(riga["Accredito"].ToString()) == true) Accredito = 0; + else Accredito = Convert.ToDouble(riga["Accredito"].ToString().Replace(".", ",")); + if (String.IsNullOrEmpty(riga["Addebito"].ToString()) == true) Addebito = 0; + else Addebito = Convert.ToDouble(riga["Addebito"].ToString().Replace(".", ",")); + dr["Importo"] = (Accredito - Addebito).ToString(); + dr["DataValuta"] = riga["Data di valuta"].ToString().Replace(".", "/"); + dr["DataOperazione"] = riga["Data dell'operazione"].ToString().Replace(".", "/"); + dr["Descrizione"] = riga["Descrizione 3"]; + dtTransazioniGDN.Rows.Add(dr); + } + + } + + // Cancella tabella TransazioniGDN prima di salvarci nuovamente i dati + string result = CommonClass.ExecSql("GDN_Reconciliator_Delete"); + + // Salva dati in TransazioniGDN se non ci sono stati errori in cancellazione + if (result != "OK") CommonClass.MessageBox(this, result); + else CommonClass.SqlBulkCopyTable(this, dtTransazioniGDN, "TransazioniGDN"); + + return dtTransazioniGDN; + } + + public DataTable ElaboraCSVBancaSella(UploadedFile uploadedFile) + { + // ref link: https://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader + DataTable dtCsv = new DataTable(); + DataTable dtTransazioniGDN = new DataTable(); + if (uploadedFile.IsValid) + { + + using (CsvReader csv = new CsvReader(new StreamReader(uploadedFile.FileContent), true)) + { + csv.MissingFieldAction = MissingFieldAction.ReplaceByEmpty; // importante per evitare che schianti ! + + int fieldCount = csv.FieldCount; + + string[] headers = csv.GetFieldHeaders(); + foreach (string nomeColonna in headers) + { + dtCsv.Columns.Add(nomeColonna); + } + + while (csv.ReadNextRecord()) + { + DataRow dr = dtCsv.NewRow(); + for (int i = 0; i < fieldCount; i++) + { + string valore = csv[i].Replace(",", "#").Replace(".", string.Empty).Replace("#", ".").Replace("+", String.Empty); // sostituisco virgola con punto e tolgo + + Console.Write(string.Format("{0} = {1};", headers[i], valore)); + dr[i] = valore; + } + dtCsv.Rows.Add(dr); + } + } + + // Crea datatable per salvare i dati in tabella TransazioniGDN + + dtTransazioniGDN.Columns.Add("Portafoglio"); + dtTransazioniGDN.Columns.Add("Importo"); + dtTransazioniGDN.Columns.Add("DataValuta"); + dtTransazioniGDN.Columns.Add("DataOperazione"); + dtTransazioniGDN.Columns.Add("Descrizione"); + string portafoglio = string.Empty; + ASPxGridView grid = gridlookupPortafogli.GridView; + object objPortafoglio = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "cod_rap" }); + if (objPortafoglio != null) + { + portafoglio = objPortafoglio.ToString(); + Session["cod_rap"] = portafoglio; + } + + foreach (DataRow riga in dtCsv.Rows) + { + if (riga["Descrizione"].ToString().IndexOf("Saldo") != -1) continue; // se è ultima riga con saldo allora la skippa + DataRow dr = dtTransazioniGDN.NewRow(); // "Codice identificativo","Data operazione","Data valuta","Descrizione","Divisa","Importo","Categoria","Etichette" + dr["Portafoglio"] = portafoglio; + dr["Importo"] = riga["Importo"].ToString().Replace(".",","); + dr["DataValuta"] = riga["Data valuta"]; + dr["DataOperazione"] = riga["Data operazione"]; + dr["Descrizione"] = riga["Descrizione"]; + dtTransazioniGDN.Rows.Add(dr); + } + + } + + // Cancella tabella TransazioniGDN prima di salvarci nuovamente i dati + string result = CommonClass.ExecSql("GDN_Reconciliator_Delete"); + + // Salva dati in TransazioniGDN se non ci sono stati errori in cancellazione + if (result != "OK") CommonClass.MessageBox(this, result); + else CommonClass.SqlBulkCopyTable(this, dtTransazioniGDN, "TransazioniGDN"); + + return dtTransazioniGDN; + } + + protected void btnImportaFlussoBanca_Click(object sender, EventArgs e) + { + + + } + + protected void btnRilevaMismatch_Click(object sender, EventArgs e) + { + if (rblBanca.SelectedIndex == -1) + { + CommonClass.MessageBox(this, "Errore - Selezionare banca e portafoglio prima di importare flusso dati!"); + return; + } + + gvPtfMerged.DataSource = SqlDSPtfMerged; + gvPtfMerged.DataBind(); + } + + protected void rblBanca_SelectedIndexChanged(object sender, EventArgs e) + { + Session["cod_ctp"] = rblBanca.SelectedItem.Value; + } + + protected void gvPtfMerged_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) + { + if (e.RowType != GridViewRowType.Data) return; + + // Evidenzia le righe con colori differenti + if (e.GetValue("ImportoBanca") == DBNull.Value || e.GetValue("ImportoGDN") == DBNull.Value) e.Row.BackColor = Color.LightSalmon; + // else e.Row.BackColor = Color.LightSeaGreen; + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/Reconciliator.aspx.designer.cs b/OlympiaIntranet/Reconciliator.aspx.designer.cs new file mode 100644 index 0000000..cb1f9f7 --- /dev/null +++ b/OlympiaIntranet/Reconciliator.aspx.designer.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class Reconciliator { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// rblBanca control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRadioButtonList rblBanca; + + /// + /// gridlookupPortafogli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridlookupPortafogli; + + /// + /// uploadControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxUploadControl uploadControl; + + /// + /// btnRilevaMismatch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnRilevaMismatch; + + /// + /// ASPxRoundPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel1; + + /// + /// gvPtfMerged control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvPtfMerged; + + /// + /// ASPxGridViewExporter1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ASPxGridViewExporter1; + + /// + /// SqlDSPortafogli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSPortafogli; + + /// + /// SqlDSPtfMerged control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSPtfMerged; + } +} diff --git a/OlympiaIntranet/ReportAllFunds.aspx b/OlympiaIntranet/ReportAllFunds.aspx new file mode 100644 index 0000000..1b08463 --- /dev/null +++ b/OlympiaIntranet/ReportAllFunds.aspx @@ -0,0 +1,89 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReportAllFunds.aspx.cs" Inherits="OlympiaIntranet.ReportAllFunds" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/OlympiaIntranet/ReportAllFunds.aspx.cs b/OlympiaIntranet/ReportAllFunds.aspx.cs new file mode 100644 index 0000000..4a67fa7 --- /dev/null +++ b/OlympiaIntranet/ReportAllFunds.aspx.cs @@ -0,0 +1,221 @@ +using ClosedXML.Excel; +using DevExpress.Web; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class ReportAllFunds : System.Web.UI.Page + { + //DataTable dtOutput = new DataTable(); + protected override void InitializeCulture() // Aggiunto altrimenti in produzione prendeva settaggi USA per i decimali con il punto invece che con la virgola + { + Culture = "it-IT"; + UICulture = "it"; + + } + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + //Bind the grid only once + if (!IsPostBack) + { + gvInputCsv.DataBind(); + gvOutput.DataBind(); + } + } + + protected void uploadControl_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) + { + Session["dtInputFile"] = ProcessInputFile(e.UploadedFile); + } + + public DataTable ProcessInputFile(UploadedFile uploadedFile) + { + // ref link: https://www.c-sharpcorner.com/blogs/read-csv-file-into-data-table1 + DataTable dtCsv = new DataTable(); + try + { + int idxSuffix = 1; // suffiso per disambiguare colonne con lo stesso nome nel csv di input + string Fulltext; + if (uploadedFile.IsValid) //if (FileUpload.HasFile && IsPostBack) + { + using (StreamReader sr = new StreamReader(uploadedFile.FileContent)) + { + while (!sr.EndOfStream) + { + Fulltext = sr.ReadToEnd().ToString(); //read full file text + string[] rows = Fulltext.Split('\n'); //split full file text into rows + for (int i = 0; i < rows.Count() - 1; i++) + { + string[] rowValues = rows[i].Split(';'); //split each row with comma to get individual values + { + if (i == 0) // legge la prima riga degli header + { + for (int j = 0; j < rowValues.Count(); j++) + { + if (dtCsv.Columns.Contains(rowValues[j].Trim())) // Se il nome colonna già esiste in dtCsv allora aggiunge idxSuffix al nome (ad esempio Perc. Type) + { + dtCsv.Columns.Add(rowValues[j].Trim() + "_" + idxSuffix); + idxSuffix++; + } + else dtCsv.Columns.Add(rowValues[j].Trim()); //add headers + } + } + else + { + if (rowValues[5] == "VMOB" || rowValues[5] == "FUTU" || rowValues[5] == "OPTI") // importa solo le righe che hanno VMOB,FUTU,OPTI nella colonna 'Asset Type' + { + DataRow dr = dtCsv.NewRow(); + for (int k = 0; k < rowValues.Count(); k++) + { + dr[k] = rowValues[k].ToString(); + } + dtCsv.Rows.Add(dr); //add other rows + } + } + } + } + } + } + } + return dtCsv; + } + catch (Exception) + { + dtCsv = null; + throw; + } + + } + + protected void gvInputCsv_DataBinding(object sender, EventArgs e) + { + if (Session["dtInputFile"] != null) + { + gvInputCsv.DataSource = (DataTable)Session["dtInputFile"]; + } + } + + protected void btnElaboraInput_Click(object sender, EventArgs e) + { + // ref link: https://stackoverflow.com/questions/14422655/linq-on-datatable-select-specific-column-into-datatable-not-whole-table + // Generare dal datatable Session["dtInputFile"] un json da usare come parametro alla query reportAllFunds_ProcessData + // il json deve contenere : Nav date, Asset, Asset Type, Bloomberg ID , Perc Type + + DataTable dtInput = (DataTable)Session["dtInputFile"]; + + if (dtInput == null) return; // esce se non è stato caricato alcun csv caricato + + // Seleziono colonne dal csv in input e le metto in un array di anonymous type + var listParams = from r in dtInput.AsEnumerable() + let objectArray = new object[] + { + r.Field("Nav date").Trim(), + r.Field("Asset").Trim(), + r.Field("Asset type").Trim(), + r.Field("Asset status").Trim(), + r.Field("Asset CCY").Trim(), + ConvertToDouble(r.Field("Perc. Type")), + r.Field("Bloomberg ID").Trim() + } + select objectArray; + + // Copio l'array in un datatable dtParams per poi convertirlo in json con newtonsoft + DataTable dtParams = new DataTable(); + dtParams.Columns.Add("NavDate", typeof(string)); + dtParams.Columns.Add("Asset", typeof(string)); + dtParams.Columns.Add("AssetType", typeof(string)); + dtParams.Columns.Add("AssetStatus", typeof(string)); + dtParams.Columns.Add("AssetCCY", typeof(string)); + dtParams.Columns.Add("PercType", typeof(double)); + dtParams.Columns.Add("BloombergID", typeof(string)); + + foreach (var array in listParams) + { + dtParams.Rows.Add(array); + } + + // Converte il datatabel dtParams in json + string json = JsonConvert.SerializeObject(dtParams); + + // Esegue query per su GuardianDB per elaborare i dati + if (String.IsNullOrEmpty(json) == false) + { + DataTable dt = new DataTable(); + SqlDataReader result; + using (var con = new SqlConnection(Properties.Settings.Default.SqlConnection)) + { + var cmd = new SqlCommand + { + CommandText = "reportAllFunds_ProcessData", + CommandType = CommandType.StoredProcedure, + Connection = con + }; + cmd.Parameters.AddWithValue("@json", json); + con.Open(); // Open the OleDBConnection. + result = cmd.ExecuteReader(); + dt.Load(result); + Session["dtOutputTrades"] = (DataTable)dt; + gvOutput.DataSource = Session["dtOutputTrades"]; + gvOutput.DataBind(); + } + } + } + + protected double ConvertToDouble(string val) + { + double tempDouble = 0.0; + Double.TryParse(val.Trim().Replace(".", ","), out tempDouble); + return (tempDouble); + } + + protected void btnOutputGuardian_Click(object sender, EventArgs e) + { + // Metodo 1) - Crea file di output in formato .xlsx per guardian relativo a MS Trades + // Prepare the response + string fileType = string.Empty; + string excelTrades = string.Format("reportAllFunds_{0:yyyyMMdd}.xlsx", DateTime.Today.Date); + HttpResponse httpResponse = Response; + httpResponse.Clear(); + httpResponse.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + httpResponse.AddHeader("content-disposition", string.Format("attachment;filename={0}", excelTrades)); + + // Flush the workbook to the Response.OutputStream + DataTable dt = (DataTable)Session["dtOutputTrades"]; + using (var workbook = new XLWorkbook()) + { + using (MemoryStream memoryStream = new MemoryStream()) + { + workbook.Worksheets.Add(dt, "Foglio1"); + workbook.SaveAs(memoryStream); + memoryStream.WriteTo(httpResponse.OutputStream); + memoryStream.Close(); + } + } + httpResponse.End(); + } + + protected void gvInputCsv_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) + { + + } + + protected void gvOutput_DataBinding(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/ReportAllFunds.aspx.designer.cs b/OlympiaIntranet/ReportAllFunds.aspx.designer.cs new file mode 100644 index 0000000..f40ba3f --- /dev/null +++ b/OlympiaIntranet/ReportAllFunds.aspx.designer.cs @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet { + + + public partial class ReportAllFunds { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// uploadControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxUploadControl uploadControl; + + /// + /// btnElaboraInput control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnElaboraInput; + + /// + /// btnOutputGuardian control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnOutputGuardian; + + /// + /// ASPxRoundPanel1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel1; + + /// + /// ASPxRoundPanel2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel2; + + /// + /// gvInputCsv control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvInputCsv; + + /// + /// ASPxRoundPanel3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxRoundPanel ASPxRoundPanel3; + + /// + /// gvOutput control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvOutput; + } +} diff --git a/OlympiaIntranet/ReportPortafoglio.cs b/OlympiaIntranet/ReportPortafoglio.cs new file mode 100644 index 0000000..cb9c9f9 --- /dev/null +++ b/OlympiaIntranet/ReportPortafoglio.cs @@ -0,0 +1,763 @@ +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using DevExpress.XtraReports.UI; + +/// +/// Summary description for ReportPortafoglio +/// +public class ReportPortafoglio : DevExpress.XtraReports.UI.XtraReport +{ + private TopMarginBand topMarginBand1; + private XRLabel xrLabel3; + private XRLabel xrLabel2; + private XRLabel xrLabel1; + private XRLabel xrLabel4; + private XRLabel xrLabel5; + private XRLabel xrLabel6; + private XRPictureBox xrPictureBox1; + private DetailBand detailBand1; + private XRLabel xrLabel7; + private BottomMarginBand bottomMarginBand1; + private XRPageInfo xrPageInfo1; + private DetailReportBand DetailReport; + private DetailBand Detail; + private XRLabel xrLabel18; + private XRLabel xrLabel17; + private XRLabel xrLabel16; + private XRLabel xrLabel15; + private XRLabel xrLabel14; + private XRLabel xrLabel13; + private XRLabel xrLabel12; + private XRLabel xrLabel11; + private XRLabel xrLabel10; + private XRLabel xrLabel9; + private XRLabel xrLabel8; + private GroupHeaderBand GroupHeader1; + private XRLabel xrLabel29; + private XRLabel xrLabel28; + private XRLabel xrLabel27; + private XRLabel xrLabel26; + private XRLabel xrLabel25; + private XRLabel xrLabel24; + private XRLabel xrLabel23; + private XRLabel xrLabel22; + private XRLabel xrLabel21; + private XRLabel xrLabel20; + private XRLabel xrLabel19; + private GroupFooterBand GroupFooter1; + private XRLabel xrLabel30; + private DevExpress.DataAccess.Sql.SqlDataSource sqlDataSource1; + private XRControlStyle xrControlStyle1; + private DevExpress.XtraReports.Parameters.Parameter cod_rap; + private DevExpress.DataAccess.Sql.SqlDataSource sqlDataSource2; + + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + public ReportPortafoglio() + { + InitializeComponent(); + // + // TODO: Add constructor logic here + // + } + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReportPortafoglio)); + DevExpress.DataAccess.Sql.StoredProcQuery storedProcQuery3 = new DevExpress.DataAccess.Sql.StoredProcQuery(); + DevExpress.DataAccess.Sql.QueryParameter queryParameter3 = new DevExpress.DataAccess.Sql.QueryParameter(); + DevExpress.DataAccess.Sql.StoredProcQuery storedProcQuery4 = new DevExpress.DataAccess.Sql.StoredProcQuery(); + DevExpress.DataAccess.Sql.QueryParameter queryParameter4 = new DevExpress.DataAccess.Sql.QueryParameter(); + DevExpress.DataAccess.Sql.MasterDetailInfo masterDetailInfo2 = new DevExpress.DataAccess.Sql.MasterDetailInfo(); + DevExpress.DataAccess.Sql.RelationColumnInfo relationColumnInfo2 = new DevExpress.DataAccess.Sql.RelationColumnInfo(); + DevExpress.DataAccess.Sql.StoredProcQuery storedProcQuery1 = new DevExpress.DataAccess.Sql.StoredProcQuery(); + DevExpress.DataAccess.Sql.QueryParameter queryParameter1 = new DevExpress.DataAccess.Sql.QueryParameter(); + DevExpress.DataAccess.Sql.StoredProcQuery storedProcQuery2 = new DevExpress.DataAccess.Sql.StoredProcQuery(); + DevExpress.DataAccess.Sql.QueryParameter queryParameter2 = new DevExpress.DataAccess.Sql.QueryParameter(); + DevExpress.DataAccess.Sql.MasterDetailInfo masterDetailInfo1 = new DevExpress.DataAccess.Sql.MasterDetailInfo(); + DevExpress.DataAccess.Sql.RelationColumnInfo relationColumnInfo1 = new DevExpress.DataAccess.Sql.RelationColumnInfo(); + this.topMarginBand1 = new DevExpress.XtraReports.UI.TopMarginBand(); + this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel2 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel4 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel5 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel6 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox(); + this.detailBand1 = new DevExpress.XtraReports.UI.DetailBand(); + this.xrLabel7 = new DevExpress.XtraReports.UI.XRLabel(); + this.bottomMarginBand1 = new DevExpress.XtraReports.UI.BottomMarginBand(); + this.xrPageInfo1 = new DevExpress.XtraReports.UI.XRPageInfo(); + this.DetailReport = new DevExpress.XtraReports.UI.DetailReportBand(); + this.Detail = new DevExpress.XtraReports.UI.DetailBand(); + this.xrLabel18 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel17 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel16 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel15 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel14 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel13 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel12 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel11 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel10 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel9 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel8 = new DevExpress.XtraReports.UI.XRLabel(); + this.GroupHeader1 = new DevExpress.XtraReports.UI.GroupHeaderBand(); + this.xrLabel29 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel28 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel27 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel26 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel25 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel24 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel23 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel22 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel21 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel20 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel19 = new DevExpress.XtraReports.UI.XRLabel(); + this.GroupFooter1 = new DevExpress.XtraReports.UI.GroupFooterBand(); + this.xrLabel30 = new DevExpress.XtraReports.UI.XRLabel(); + this.sqlDataSource1 = new DevExpress.DataAccess.Sql.SqlDataSource(this.components); + this.xrControlStyle1 = new DevExpress.XtraReports.UI.XRControlStyle(); + this.cod_rap = new DevExpress.XtraReports.Parameters.Parameter(); + this.sqlDataSource2 = new DevExpress.DataAccess.Sql.SqlDataSource(this.components); + ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); + // + // topMarginBand1 + // + this.topMarginBand1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrLabel3, + this.xrLabel2, + this.xrLabel1, + this.xrLabel4, + this.xrLabel5, + this.xrLabel6, + this.xrPictureBox1}); + this.topMarginBand1.HeightF = 123F; + this.topMarginBand1.Name = "topMarginBand1"; + // + // xrLabel3 + // + this.xrLabel3.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.Intestazione")}); + this.xrLabel3.Font = new DevExpress.Drawing.DXFont("Arial Narrow", 9F, DevExpress.Drawing.DXFontStyle.Bold, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel3.LocationFloat = new DevExpress.Utils.PointFloat(471.5829F, 53.16666F); + this.xrLabel3.Multiline = true; + this.xrLabel3.Name = "xrLabel3"; + this.xrLabel3.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel3.SizeF = new System.Drawing.SizeF(277.417F, 23F); + this.xrLabel3.StylePriority.UseFont = false; + this.xrLabel3.Text = "xrLabel3"; + // + // xrLabel2 + // + this.xrLabel2.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.Depositaria")}); + this.xrLabel2.Font = new DevExpress.Drawing.DXFont("Arial Narrow", 9F, DevExpress.Drawing.DXFontStyle.Bold, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel2.LocationFloat = new DevExpress.Utils.PointFloat(471.5829F, 76.16666F); + this.xrLabel2.Multiline = true; + this.xrLabel2.Name = "xrLabel2"; + this.xrLabel2.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel2.SizeF = new System.Drawing.SizeF(277.417F, 23F); + this.xrLabel2.StylePriority.UseFont = false; + this.xrLabel2.Text = "xrLabel2"; + // + // xrLabel1 + // + this.xrLabel1.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.Conto")}); + this.xrLabel1.Font = new DevExpress.Drawing.DXFont("Arial Narrow", 9F, DevExpress.Drawing.DXFontStyle.Bold, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel1.LocationFloat = new DevExpress.Utils.PointFloat(471.2916F, 30.16666F); + this.xrLabel1.Multiline = true; + this.xrLabel1.Name = "xrLabel1"; + this.xrLabel1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel1.SizeF = new System.Drawing.SizeF(277.7084F, 23F); + this.xrLabel1.StylePriority.UseFont = false; + this.xrLabel1.Text = "xrLabel1"; + // + // xrLabel4 + // + this.xrLabel4.Font = new DevExpress.Drawing.DXFont("Arial", 9F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel4.LocationFloat = new DevExpress.Utils.PointFloat(347.0417F, 30.16666F); + this.xrLabel4.Multiline = true; + this.xrLabel4.Name = "xrLabel4"; + this.xrLabel4.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel4.SizeF = new System.Drawing.SizeF(123.9584F, 23F); + this.xrLabel4.StylePriority.UseFont = false; + this.xrLabel4.Text = "Portafoglio:"; + // + // xrLabel5 + // + this.xrLabel5.Font = new DevExpress.Drawing.DXFont("Arial", 9F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel5.LocationFloat = new DevExpress.Utils.PointFloat(347.0417F, 53.16666F); + this.xrLabel5.Multiline = true; + this.xrLabel5.Name = "xrLabel5"; + this.xrLabel5.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel5.SizeF = new System.Drawing.SizeF(123.9584F, 23F); + this.xrLabel5.StylePriority.UseFont = false; + this.xrLabel5.Text = "Intestazione:"; + // + // xrLabel6 + // + this.xrLabel6.Font = new DevExpress.Drawing.DXFont("Arial", 9F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel6.LocationFloat = new DevExpress.Utils.PointFloat(347.0417F, 76.16666F); + this.xrLabel6.Multiline = true; + this.xrLabel6.Name = "xrLabel6"; + this.xrLabel6.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel6.SizeF = new System.Drawing.SizeF(123.9584F, 23F); + this.xrLabel6.StylePriority.UseFont = false; + this.xrLabel6.Text = "Banca Depositaria:\r\n"; + // + // xrPictureBox1 + // + this.xrPictureBox1.ImageSource = new DevExpress.XtraPrinting.Drawing.ImageSource("img", resources.GetString("xrPictureBox1.ImageSource")); + this.xrPictureBox1.LocationFloat = new DevExpress.Utils.PointFloat(10.00001F, 10.00001F); + this.xrPictureBox1.Name = "xrPictureBox1"; + this.xrPictureBox1.SizeF = new System.Drawing.SizeF(208F, 88F); + // + // detailBand1 + // + this.detailBand1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrLabel7}); + this.detailBand1.HeightF = 78.125F; + this.detailBand1.Name = "detailBand1"; + // + // xrLabel7 + // + this.xrLabel7.Font = new DevExpress.Drawing.DXFont("Arial Narrow", 9F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel7.LocationFloat = new DevExpress.Utils.PointFloat(0F, 4.75F); + this.xrLabel7.Multiline = true; + this.xrLabel7.Name = "xrLabel7"; + this.xrLabel7.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel7.SizeF = new System.Drawing.SizeF(748.9999F, 64F); + this.xrLabel7.StylePriority.UseFont = false; + this.xrLabel7.Text = resources.GetString("xrLabel7.Text"); + // + // bottomMarginBand1 + // + this.bottomMarginBand1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrPageInfo1}); + this.bottomMarginBand1.Name = "bottomMarginBand1"; + // + // xrPageInfo1 + // + this.xrPageInfo1.Font = new DevExpress.Drawing.DXFont("Arial", 9.75F); + this.xrPageInfo1.LocationFloat = new DevExpress.Utils.PointFloat(724.9999F, 9.999974F); + this.xrPageInfo1.Name = "xrPageInfo1"; + this.xrPageInfo1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrPageInfo1.SizeF = new System.Drawing.SizeF(100F, 23F); + this.xrPageInfo1.StylePriority.UseFont = false; + this.xrPageInfo1.TextFormatString = "Pagina {0} di {1}"; + // + // DetailReport + // + this.DetailReport.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { + this.Detail, + this.GroupHeader1, + this.GroupFooter1}); + this.DetailReport.DataMember = "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details"; + this.DetailReport.DataSource = this.sqlDataSource2; + this.DetailReport.Level = 0; + this.DetailReport.Name = "DetailReport"; + // + // Detail + // + this.Detail.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrLabel18, + this.xrLabel17, + this.xrLabel16, + this.xrLabel15, + this.xrLabel14, + this.xrLabel13, + this.xrLabel12, + this.xrLabel11, + this.xrLabel10, + this.xrLabel9, + this.xrLabel8}); + this.Detail.EvenStyleName = "xrControlStyle1"; + this.Detail.HeightF = 23F; + this.Detail.Name = "Detail"; + // + // xrLabel18 + // + this.xrLabel18.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.Rendimento com" + + "posto %")}); + this.xrLabel18.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel18.LocationFloat = new DevExpress.Utils.PointFloat(740.9583F, 0F); + this.xrLabel18.Multiline = true; + this.xrLabel18.Name = "xrLabel18"; + this.xrLabel18.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel18.SizeF = new System.Drawing.SizeF(84.04163F, 23F); + this.xrLabel18.StylePriority.UseFont = false; + this.xrLabel18.StylePriority.UseTextAlignment = false; + this.xrLabel18.Text = "xrLabel18"; + this.xrLabel18.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + // + // xrLabel17 + // + this.xrLabel17.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.Incassi")}); + this.xrLabel17.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel17.LocationFloat = new DevExpress.Utils.PointFloat(684.9584F, 0F); + this.xrLabel17.Multiline = true; + this.xrLabel17.Name = "xrLabel17"; + this.xrLabel17.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel17.SizeF = new System.Drawing.SizeF(55.99994F, 23F); + this.xrLabel17.StylePriority.UseFont = false; + this.xrLabel17.StylePriority.UseTextAlignment = false; + this.xrLabel17.Text = "xrLabel17"; + this.xrLabel17.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + // + // xrLabel16 + // + this.xrLabel16.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.Rendimento fis" + + "cale %")}); + this.xrLabel16.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel16.LocationFloat = new DevExpress.Utils.PointFloat(615.1666F, 0F); + this.xrLabel16.Multiline = true; + this.xrLabel16.Name = "xrLabel16"; + this.xrLabel16.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel16.SizeF = new System.Drawing.SizeF(69.79181F, 23F); + this.xrLabel16.StylePriority.UseFont = false; + this.xrLabel16.StylePriority.UseTextAlignment = false; + this.xrLabel16.Text = "xrLabel16"; + this.xrLabel16.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + // + // xrLabel15 + // + this.xrLabel15.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.Prezzo di merc" + + "ato")}); + this.xrLabel15.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel15.LocationFloat = new DevExpress.Utils.PointFloat(560.9999F, 0F); + this.xrLabel15.Multiline = true; + this.xrLabel15.Name = "xrLabel15"; + this.xrLabel15.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel15.SizeF = new System.Drawing.SizeF(54.16669F, 23F); + this.xrLabel15.StylePriority.UseFont = false; + this.xrLabel15.StylePriority.UseTextAlignment = false; + this.xrLabel15.Text = "xrLabel15"; + this.xrLabel15.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + // + // xrLabel14 + // + this.xrLabel14.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.Costo acquisto" + + "")}); + this.xrLabel14.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel14.LocationFloat = new DevExpress.Utils.PointFloat(502.6665F, 0F); + this.xrLabel14.Multiline = true; + this.xrLabel14.Name = "xrLabel14"; + this.xrLabel14.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel14.SizeF = new System.Drawing.SizeF(58.33331F, 23F); + this.xrLabel14.StylePriority.UseFont = false; + this.xrLabel14.StylePriority.UseTextAlignment = false; + this.xrLabel14.Text = "xrLabel14"; + this.xrLabel14.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + // + // xrLabel13 + // + this.xrLabel13.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.Prezzo fiscale" + + "")}); + this.xrLabel13.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel13.LocationFloat = new DevExpress.Utils.PointFloat(446.4167F, 0F); + this.xrLabel13.Multiline = true; + this.xrLabel13.Name = "xrLabel13"; + this.xrLabel13.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel13.SizeF = new System.Drawing.SizeF(56.24994F, 23F); + this.xrLabel13.StylePriority.UseFont = false; + this.xrLabel13.StylePriority.UseTextAlignment = false; + this.xrLabel13.Text = "xrLabel13"; + this.xrLabel13.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + // + // xrLabel12 + // + this.xrLabel12.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.Quantita")}); + this.xrLabel12.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel12.LocationFloat = new DevExpress.Utils.PointFloat(396.4166F, 0F); + this.xrLabel12.Multiline = true; + this.xrLabel12.Name = "xrLabel12"; + this.xrLabel12.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel12.SizeF = new System.Drawing.SizeF(50.00006F, 23F); + this.xrLabel12.StylePriority.UseFont = false; + this.xrLabel12.StylePriority.UseTextAlignment = false; + this.xrLabel12.Text = "xrLabel12"; + this.xrLabel12.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + // + // xrLabel11 + // + this.xrLabel11.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.Descrizione")}); + this.xrLabel11.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel11.LocationFloat = new DevExpress.Utils.PointFloat(187.7916F, 0F); + this.xrLabel11.Multiline = true; + this.xrLabel11.Name = "xrLabel11"; + this.xrLabel11.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel11.SizeF = new System.Drawing.SizeF(208.625F, 23F); + this.xrLabel11.StylePriority.UseFont = false; + this.xrLabel11.Text = "xrLabel11"; + // + // xrLabel10 + // + this.xrLabel10.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.ISIN")}); + this.xrLabel10.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel10.LocationFloat = new DevExpress.Utils.PointFloat(102.0833F, 0F); + this.xrLabel10.Multiline = true; + this.xrLabel10.Name = "xrLabel10"; + this.xrLabel10.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel10.SizeF = new System.Drawing.SizeF(85.70829F, 23F); + this.xrLabel10.StylePriority.UseFont = false; + this.xrLabel10.Text = "xrLabel10"; + // + // xrLabel9 + // + this.xrLabel9.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.Divisa Portafo" + + "glio")}); + this.xrLabel9.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel9.LocationFloat = new DevExpress.Utils.PointFloat(66.66666F, 0F); + this.xrLabel9.Multiline = true; + this.xrLabel9.Name = "xrLabel9"; + this.xrLabel9.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel9.SizeF = new System.Drawing.SizeF(35.41666F, 23F); + this.xrLabel9.StylePriority.UseFont = false; + this.xrLabel9.Text = "xrLabel9"; + // + // xrLabel8 + // + this.xrLabel8.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "rpt_Portafoglio_anagr.rpt_Portafoglio_anagrrpt_Portafoglio_details.SottoConto")}); + this.xrLabel8.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel8.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F); + this.xrLabel8.Multiline = true; + this.xrLabel8.Name = "xrLabel8"; + this.xrLabel8.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel8.SizeF = new System.Drawing.SizeF(66.66666F, 23F); + this.xrLabel8.StylePriority.UseFont = false; + this.xrLabel8.Text = "xrLabel8"; + // + // GroupHeader1 + // + this.GroupHeader1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrLabel29, + this.xrLabel28, + this.xrLabel27, + this.xrLabel26, + this.xrLabel25, + this.xrLabel24, + this.xrLabel23, + this.xrLabel22, + this.xrLabel21, + this.xrLabel20, + this.xrLabel19}); + this.GroupHeader1.HeightF = 36.95828F; + this.GroupHeader1.Name = "GroupHeader1"; + this.GroupHeader1.RepeatEveryPage = true; + // + // xrLabel29 + // + this.xrLabel29.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel29.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel29.ForeColor = System.Drawing.Color.White; + this.xrLabel29.LocationFloat = new DevExpress.Utils.PointFloat(740.9583F, 0F); + this.xrLabel29.Multiline = true; + this.xrLabel29.Name = "xrLabel29"; + this.xrLabel29.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel29.SizeF = new System.Drawing.SizeF(84.04169F, 36.95828F); + this.xrLabel29.StylePriority.UseBackColor = false; + this.xrLabel29.StylePriority.UseFont = false; + this.xrLabel29.StylePriority.UseForeColor = false; + this.xrLabel29.Text = "Rendimento composto %"; + // + // xrLabel28 + // + this.xrLabel28.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel28.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel28.ForeColor = System.Drawing.Color.White; + this.xrLabel28.LocationFloat = new DevExpress.Utils.PointFloat(684.9584F, 0F); + this.xrLabel28.Multiline = true; + this.xrLabel28.Name = "xrLabel28"; + this.xrLabel28.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel28.SizeF = new System.Drawing.SizeF(55.99994F, 36.95828F); + this.xrLabel28.StylePriority.UseBackColor = false; + this.xrLabel28.StylePriority.UseFont = false; + this.xrLabel28.StylePriority.UseForeColor = false; + this.xrLabel28.Text = "Incassi"; + // + // xrLabel27 + // + this.xrLabel27.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel27.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel27.ForeColor = System.Drawing.Color.White; + this.xrLabel27.LocationFloat = new DevExpress.Utils.PointFloat(615.1667F, 0F); + this.xrLabel27.Multiline = true; + this.xrLabel27.Name = "xrLabel27"; + this.xrLabel27.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel27.SizeF = new System.Drawing.SizeF(69.79175F, 36.95828F); + this.xrLabel27.StylePriority.UseBackColor = false; + this.xrLabel27.StylePriority.UseFont = false; + this.xrLabel27.StylePriority.UseForeColor = false; + this.xrLabel27.Text = "Rendimento fiscale %"; + // + // xrLabel26 + // + this.xrLabel26.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel26.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel26.ForeColor = System.Drawing.Color.White; + this.xrLabel26.LocationFloat = new DevExpress.Utils.PointFloat(560.9999F, 0F); + this.xrLabel26.Multiline = true; + this.xrLabel26.Name = "xrLabel26"; + this.xrLabel26.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel26.SizeF = new System.Drawing.SizeF(54.16669F, 36.95828F); + this.xrLabel26.StylePriority.UseBackColor = false; + this.xrLabel26.StylePriority.UseFont = false; + this.xrLabel26.StylePriority.UseForeColor = false; + this.xrLabel26.Text = "Prezzo di mercato"; + // + // xrLabel25 + // + this.xrLabel25.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel25.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel25.ForeColor = System.Drawing.Color.White; + this.xrLabel25.LocationFloat = new DevExpress.Utils.PointFloat(502.6665F, 0F); + this.xrLabel25.Multiline = true; + this.xrLabel25.Name = "xrLabel25"; + this.xrLabel25.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel25.SizeF = new System.Drawing.SizeF(58.33334F, 36.95828F); + this.xrLabel25.StylePriority.UseBackColor = false; + this.xrLabel25.StylePriority.UseFont = false; + this.xrLabel25.StylePriority.UseForeColor = false; + this.xrLabel25.Text = "Costo Acquisto"; + // + // xrLabel24 + // + this.xrLabel24.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel24.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel24.ForeColor = System.Drawing.Color.White; + this.xrLabel24.LocationFloat = new DevExpress.Utils.PointFloat(446.4167F, 0F); + this.xrLabel24.Multiline = true; + this.xrLabel24.Name = "xrLabel24"; + this.xrLabel24.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel24.SizeF = new System.Drawing.SizeF(56.24988F, 36.95828F); + this.xrLabel24.StylePriority.UseBackColor = false; + this.xrLabel24.StylePriority.UseFont = false; + this.xrLabel24.StylePriority.UseForeColor = false; + this.xrLabel24.Text = "Prezzo Fiscale"; + // + // xrLabel23 + // + this.xrLabel23.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel23.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel23.ForeColor = System.Drawing.Color.White; + this.xrLabel23.LocationFloat = new DevExpress.Utils.PointFloat(396.4166F, 0F); + this.xrLabel23.Multiline = true; + this.xrLabel23.Name = "xrLabel23"; + this.xrLabel23.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel23.SizeF = new System.Drawing.SizeF(50.00006F, 36.95828F); + this.xrLabel23.StylePriority.UseBackColor = false; + this.xrLabel23.StylePriority.UseFont = false; + this.xrLabel23.StylePriority.UseForeColor = false; + this.xrLabel23.Text = "Quantità"; + // + // xrLabel22 + // + this.xrLabel22.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel22.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel22.ForeColor = System.Drawing.Color.White; + this.xrLabel22.LocationFloat = new DevExpress.Utils.PointFloat(187.7916F, 0F); + this.xrLabel22.Multiline = true; + this.xrLabel22.Name = "xrLabel22"; + this.xrLabel22.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel22.SizeF = new System.Drawing.SizeF(208.625F, 36.95828F); + this.xrLabel22.StylePriority.UseBackColor = false; + this.xrLabel22.StylePriority.UseFont = false; + this.xrLabel22.StylePriority.UseForeColor = false; + this.xrLabel22.Text = "Descrizione"; + // + // xrLabel21 + // + this.xrLabel21.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel21.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel21.ForeColor = System.Drawing.Color.White; + this.xrLabel21.LocationFloat = new DevExpress.Utils.PointFloat(102.0833F, 0F); + this.xrLabel21.Multiline = true; + this.xrLabel21.Name = "xrLabel21"; + this.xrLabel21.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel21.SizeF = new System.Drawing.SizeF(85.70829F, 36.95828F); + this.xrLabel21.StylePriority.UseBackColor = false; + this.xrLabel21.StylePriority.UseFont = false; + this.xrLabel21.StylePriority.UseForeColor = false; + this.xrLabel21.Text = "ISIN"; + // + // xrLabel20 + // + this.xrLabel20.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel20.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel20.ForeColor = System.Drawing.Color.White; + this.xrLabel20.LocationFloat = new DevExpress.Utils.PointFloat(66.66666F, 0F); + this.xrLabel20.Multiline = true; + this.xrLabel20.Name = "xrLabel20"; + this.xrLabel20.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel20.SizeF = new System.Drawing.SizeF(35.41667F, 36.95828F); + this.xrLabel20.StylePriority.UseBackColor = false; + this.xrLabel20.StylePriority.UseFont = false; + this.xrLabel20.StylePriority.UseForeColor = false; + this.xrLabel20.Text = "Divisa"; + // + // xrLabel19 + // + this.xrLabel19.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(128))))); + this.xrLabel19.Font = new DevExpress.Drawing.DXFont("Trebuchet MS", 8.25F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel19.ForeColor = System.Drawing.Color.White; + this.xrLabel19.LocationFloat = new DevExpress.Utils.PointFloat(2.083333F, 0F); + this.xrLabel19.Multiline = true; + this.xrLabel19.Name = "xrLabel19"; + this.xrLabel19.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel19.SizeF = new System.Drawing.SizeF(64.58333F, 36.95828F); + this.xrLabel19.StylePriority.UseBackColor = false; + this.xrLabel19.StylePriority.UseFont = false; + this.xrLabel19.StylePriority.UseForeColor = false; + this.xrLabel19.Text = "Portafoglio"; + // + // GroupFooter1 + // + this.GroupFooter1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrLabel30}); + this.GroupFooter1.HeightF = 90.66668F; + this.GroupFooter1.Name = "GroupFooter1"; + // + // xrLabel30 + // + this.xrLabel30.Font = new DevExpress.Drawing.DXFont("Arial Narrow", 9F, DevExpress.Drawing.DXFontStyle.Regular, DevExpress.Drawing.DXGraphicsUnit.Point, new DevExpress.Drawing.DXFontAdditionalProperty[] {new DevExpress.Drawing.DXFontAdditionalProperty("GdiCharSet", ((byte)(0)))}); + this.xrLabel30.LocationFloat = new DevExpress.Utils.PointFloat(2.083333F, 10.00001F); + this.xrLabel30.Multiline = true; + this.xrLabel30.Name = "xrLabel30"; + this.xrLabel30.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); + this.xrLabel30.SizeF = new System.Drawing.SizeF(748.9999F, 80.66667F); + this.xrLabel30.StylePriority.UseFont = false; + this.xrLabel30.Text = resources.GetString("xrLabel30.Text"); + // + // sqlDataSource1 + // + this.sqlDataSource1.ConnectionName = "OlympiaIntranet.Properties.Settings.SqlConnection"; + this.sqlDataSource1.Name = "sqlDataSource1"; + storedProcQuery3.MetaSerializable = ""; + storedProcQuery3.Name = "rpt_Portafoglio_anagr"; + queryParameter3.Name = "@cod_rap"; + queryParameter3.Type = typeof(DevExpress.DataAccess.Expression); + queryParameter3.Value = new DevExpress.DataAccess.Expression("[Parameters.cod_rap]", typeof(string)); + storedProcQuery3.Parameters.Add(queryParameter3); + storedProcQuery3.StoredProcName = "rpt_Portafoglio_anagr"; + storedProcQuery4.MetaSerializable = ""; + storedProcQuery4.Name = "rpt_Portafoglio_details"; + queryParameter4.Name = "@cod_rap"; + queryParameter4.Type = typeof(DevExpress.DataAccess.Expression); + queryParameter4.Value = new DevExpress.DataAccess.Expression("[Parameters.cod_rap]", typeof(string)); + storedProcQuery4.Parameters.Add(queryParameter4); + storedProcQuery4.StoredProcName = "rpt_Portafoglio_details"; + this.sqlDataSource1.Queries.AddRange(new DevExpress.DataAccess.Sql.SqlQuery[] { + storedProcQuery3, + storedProcQuery4}); + masterDetailInfo2.DetailQueryName = "rpt_Portafoglio_details"; + relationColumnInfo2.NestedKeyColumn = "Conto"; + relationColumnInfo2.ParentKeyColumn = "Conto"; + masterDetailInfo2.KeyColumns.Add(relationColumnInfo2); + masterDetailInfo2.MasterQueryName = "rpt_Portafoglio_anagr"; + this.sqlDataSource1.Relations.AddRange(new DevExpress.DataAccess.Sql.MasterDetailInfo[] { + masterDetailInfo2}); + this.sqlDataSource1.ResultSchemaSerializable = resources.GetString("sqlDataSource1.ResultSchemaSerializable"); + // + // xrControlStyle1 + // + this.xrControlStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.xrControlStyle1.Name = "xrControlStyle1"; + this.xrControlStyle1.Padding = new DevExpress.XtraPrinting.PaddingInfo(0, 0, 0, 0, 100F); + // + // cod_rap + // + this.cod_rap.Description = "cod_rap"; + this.cod_rap.Name = "cod_rap"; + this.cod_rap.ValueInfo = "746134"; + // + // sqlDataSource2 + // + this.sqlDataSource2.ConnectionName = "OlympiaIntranet.Properties.Settings.SqlConnection"; + this.sqlDataSource2.Name = "sqlDataSource2"; + storedProcQuery1.MetaSerializable = ""; + storedProcQuery1.Name = "rpt_Portafoglio_anagr"; + queryParameter1.Name = "@cod_rap"; + queryParameter1.Type = typeof(DevExpress.DataAccess.Expression); + queryParameter1.Value = new DevExpress.DataAccess.Expression("?cod_rap", typeof(string)); + storedProcQuery1.Parameters.Add(queryParameter1); + storedProcQuery1.StoredProcName = "rpt_Portafoglio_anagr"; + storedProcQuery2.MetaSerializable = ""; + storedProcQuery2.Name = "rpt_Portafoglio_details"; + queryParameter2.Name = "@cod_rap"; + queryParameter2.Type = typeof(DevExpress.DataAccess.Expression); + queryParameter2.Value = new DevExpress.DataAccess.Expression("?cod_rap", typeof(string)); + storedProcQuery2.Parameters.Add(queryParameter2); + storedProcQuery2.StoredProcName = "rpt_Portafoglio_details"; + this.sqlDataSource2.Queries.AddRange(new DevExpress.DataAccess.Sql.SqlQuery[] { + storedProcQuery1, + storedProcQuery2}); + masterDetailInfo1.DetailQueryName = "rpt_Portafoglio_details"; + relationColumnInfo1.NestedKeyColumn = "Conto"; + relationColumnInfo1.ParentKeyColumn = "Conto"; + masterDetailInfo1.KeyColumns.Add(relationColumnInfo1); + masterDetailInfo1.MasterQueryName = "rpt_Portafoglio_anagr"; + this.sqlDataSource2.Relations.AddRange(new DevExpress.DataAccess.Sql.MasterDetailInfo[] { + masterDetailInfo1}); + this.sqlDataSource2.ResultSchemaSerializable = resources.GetString("sqlDataSource2.ResultSchemaSerializable"); + // + // ReportPortafoglio + // + this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { + this.topMarginBand1, + this.detailBand1, + this.bottomMarginBand1, + this.DetailReport}); + this.ComponentStorage.AddRange(new System.ComponentModel.IComponent[] { + this.sqlDataSource1, + this.sqlDataSource2}); + this.DataMember = "rpt_Portafoglio_anagr"; + this.DataSource = this.sqlDataSource2; + this.Margins = new DevExpress.Drawing.DXMargins(8, 17, 123, 100); + this.Parameters.AddRange(new DevExpress.XtraReports.Parameters.Parameter[] { + this.cod_rap}); + this.StyleSheet.AddRange(new DevExpress.XtraReports.UI.XRControlStyle[] { + this.xrControlStyle1}); + this.Version = "20.1"; + ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); + + } + + #endregion +} diff --git a/OlympiaIntranet/ReportPortafoglio.resx b/OlympiaIntranet/ReportPortafoglio.resx new file mode 100644 index 0000000..6170fa0 --- /dev/null +++ b/OlympiaIntranet/ReportPortafoglio.resx @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCABGAM4DASIAAhEBAxEB/8QAHAABAAIDAQEBAAAAAAAAAAAAAAUGAQQHAgMI/8QAQRAAAQMDAgMFBAcFBgcAAAAAAQIDBAAFEQYhBxIxEyJBUWEUUnGhIzJCgYKRsQgVJGLhFhcnU1RykqKys8HR8f/EABgBAQEBAQEAAAAAAAAAAAAAAAABAgME/8QAHREBAQACAgMBAAAAAAAAAAAAAAECEQMhEjFRQf/aAAwDAQACEQMRAD8A7RrDUEiBNU2+pUZA2TlWyh5jH9T5Yrf0frm33lSYb74bnDYc/dDvqPX0q03CDFuMVceawh5lYwUrGf8A5XAdfaZXpm8crHaGE732XD4eac+Yr08cw5J43queVuPb9D0rkHDbXjjTyLZfZBW0vCWH3Dug+6o+Xr4V1/Ixnwrjycdwuq1jlMpuFKqOotZxYFyh26CpEmY6+htaU7hKSoA7jxq3VLjZN1ZdlKUrKlKUoFKUoFKUoFKUoFKUoFKUoFKUoFKUoFKUoFRepbRDvVpei3AJDeCoOHGWzj6wz0xWvqjVNr00yybk8oyJCuSPFZQXHn1e6hA3P6VB3XUF5etL65WmUxYLqCgiZcW2nSCMY5UhQB9M1cdy9JXF73bV2qe5GW608kHKHWlhSVp8DsflU3F1Vf5tlTYIynH+chKVIBLvL7mR4VrWe22xvUMeBq5c6w+0K/h0y2wESPIJdBKc/HBru1g03arEhX7sipbUsd5wkqUR8T4V7c+fDX2uOOFUrSmkbpDhsOR4sK2zBuuRJHtLxPoNggffmuhQUTm0gTn47xx9Zpot/IqNQN31zaLPqCHZbima1cJpIitiOpYex7pTkfnirOFgtBwhQGObBBz+XnXkzzuft2mOnqlQNp1dYrvd37Vb56XbkwCp2MW1oW2B7wUBjqKmJkpiFFdky3UMx2klTjizhKQOpJ8BWFfalalsucG6xvaLZLYlsE47RlYWn8xWwy82+2HGXEONnOFIOQfDrQe6UoCCAQcg0ClKUClKUClKUClKUClKUClKUClKUHCuEE0604uaw1HP+kNuIhQUK3DKOZQJA8CQjr/Ma7e9FjvvNuvMtuON/UUpOeX4eVfnvSrn91PG672+7/QWPUKu0iyl7NhZUVJBPQYKlJPxBr9FAggEHINBV+JmmYurNF3O2y20qWWVLYWRu26ASlQ+/wCVVT9m7UkvUPDltFxcU5KtshUErUclSUpSU5PjsoD7quevb9F03pK5XGWsDkZUlpH2nHCMJQkeJJxVX4A6Vk6V4fMt3FstT57yprzZ6oKwAEn1CUjPrQQ3Esf458NPjJ/6a7DXHeJqgnjnw0ycbyB+acV2B1xDSCt1aUIGBzKOBucCg5fxXtMix3aBxAsTJVMtg5Liygbyoh2VnzKeo/pUtqO5NaxYt1hskjni3VhMua+g/UhHqM+Clnuj05j4VenW0OtLbdSFtrBSpJGQQeorkH7NERljTmoi2nKkXl+OlROSG0BPKkeg5jt6mg6u0zGtdtDUZpDEWM1hDaBhKEpHQCuRfs9X2YhiXp29K/iVIF2hEn68d45OP9qifzrpWvJfsGib9KzjsoLys/gNcz1ba5GndIaJ1hbG1GXp+MwiWhPV2IpCQ4Pu6/nQXPi9dpdu0ZMj2je7TW1tR98coCCpxf4UJUfjipTh1L9v0Fp6STzFyAzk+Z5AD+lQloUzrObdb20oO2xMZdvtyh0WFJy84PirlT+A+deOAskyuE9hJOS02tk/hWpP/ightP2aLdOJ2vIMlyWiMwmIWEsSnGuxK0KKijlUOUkgGrBwrmXG4abuUK8yXJbkCfIgIlk4W82g7KJH2hnGR4ionS0cyuLXEJoSH2Mog5UyQFEdmvbJBx929dEtlvi2qAiJAZSzHbzhIydyckknckkkknc0FM4KSpU7RipNwlyZchUyQ32j7pWeVLhSkb+gr6a81VKsepdOsRwPYFSEi5L/AMttw9m1/wA5z+GtbgQc6C2/18r/ALyqirrZbrrS3avlQZUJuJOUYkZLsda3MR8hKkqCwB9KFkd00HWKVXeHl7/tDou03Fez7jCUvp911PdWP+IGrFQKUpQKUpQKUpQKUpQUbiWq13WM3YZlobvMqQcoYXsGj4K5huk/CtLTGgLvZYSGY2rrtFYA7sQFD7bQ91KnEk4FWeyQE/vibOdTl5RwCfAZ/oKn61lqdRI59M02LNcmb3dlSNRCOeYOy15XF/nQ2AEfeAD61fYz7cmO28woLacSFJUPEGsvoS4y4hYylSSCPSo7TbJjW8s/ZQs8vwp7g5zxM0ci+6/07JXMntyE57B1p0I9mwckpwn9SasUrRU1bkNx7U16nNx5Dbyoz7jYbc5VA97lQCemevhVlnxku3iA8Rktc2D8RUnS3qDw+gusrQlxbSlDAWjHMn1GQR8q55wa06ixQLr7O/KDbk91SmXFhSVKwnK+mcn0ONq6I6sNtqUfAVoWaMYbbjakgdqou7eZ6ipPQjeIlrF40bdYSnHUocYUFJbIHOPFJOM4PpXqYWIOiFNyQqYyYnZcjuCXOZOAk4A88VPSGw6w42RkKSRUd7KJPsbTgy0wkLIPioDarNDS0Kw1B0pCgNRUw/YmwwphPRBH/vOfvqI4R2JFk01hhx9DDzzriY6l8yEZV1GRnfGeuN6tzrXZvOOIGA6nlV8QNjWbayI8FlpIwEjpS6FP0xp9MLiJqa5Jfk9pIDPacywUud04BGNseGMVdnkFxlaAtSCpJHMnqPUVrMscs2U4klJXy7j0FbLSlKSecd4HBxUpFL4bafTa9JPQmJEplLj7pBCwSglRyUkg7nrUtoW3osmlo9vCl8sQrbVzqydlHfPXfrv51MW9kMR+QDHeJ/M18pMNCy93d3cb/I1brYr/AA6sabVAnSGlOtt3CW9LEcqyhvnUTkA9M9fL0qDVrK6RnWmZBQowJC03NfIB9EXAlBHlsflXSG0BttKEjCUgACq0IzClTm3ozLjlxUpJUpsHn5VFOFbb4AB3rWNne4llRUXWsltpAeguy3XGzM+jBTyMqWQgDCTk4GcnA9aml6nQm4MsJiqUy4+iP2oUcpWoAgEYwOvTOfStV5mE5b4q5MGLJVGjpI7RoEgeAHTA28M/Ct5UaIZ6pKoMTIkpTz9n3+YAYVnzG1W+Pw7R0C/XF+GHFIYIMR97nBwQpCiBtjHlU3abi9JdDEphLbvs7b4UlfMFBWRvsMHI6b1H88VLaR7FGLaWXFtgJCQASMjr0OfIVstyVNrDiGmipZSwhxKOXCACehOeuRjNS6v4RN0qL9vkFB5UNJKWluHJznlOMDB8flWHLi82CFNoKiGykjoAvPXJ8MenWsaq7StKjW5shxbbaUNpWorBUdx3cb4B9emaxElvvyEkrbQhTCVhJTnBJIO+fSml23kNBt1Sk/a619aUqDCxlJHnWGkBtHKmlKApAUtKj1FeqUoMKSFYz0FCAcelKUGawlIT0FKUGSARg9KDalKBjenSlKBSlKBWOVO3dG3pSlB5LTZxltBwMDujavXKn3R1z08aUoPk7FZcbUhTaQFdeUYPyryzCYaKyEcxWAFc2+cdP1pSmx9+RIGOUYxjp4eVYKEkEFKSCMHbqKUoCUJSAEpSAOmB0rCmWlgBbaFAdMpBxSlB/9k= + + + Gentile cliente, +come da sua richiesta, di seguito le riportiamo il rendimento dei singoli titoli presenti nel portafoglio con l’evidenza del rendimento fiscale e rendimento composto, +comprensivo di tutti gli incassi di proventi registrati sui singoli strumenti finanziari. +Questo le permetterà di avere un’evidenza più completa del rendimento dei singoli strumenti. + + + Infine, si specifica che il presente documento non costituisce rendicontazione ufficiale e potrebbe presentare difformità rispetto a quando presente sulla Banca +Depositaria. Ci potrebbero essere anche minimi scostamenti di prezzi dovuti all’utilizzo di provider diversi tra la Banca e Olympia. +Nella speranza di aver fatto cosa gradita, cogliamo l’occasione per porgerle cordiali saluti. +Olympia Wealth Management + + + 17, 56 + + + PERhdGFTZXQgTmFtZT0ic3FsRGF0YVNvdXJjZTIiPjxWaWV3IE5hbWU9InJwdF9Qb3J0YWZvZ2xpb19hbmFnciI+PEZpZWxkIE5hbWU9IkNvbnRvIiBUeXBlPSJTdHJpbmciIC8+PEZpZWxkIE5hbWU9IkludGVzdGF6aW9uZSIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJEZXBvc2l0YXJpYSIgVHlwZT0iU3RyaW5nIiAvPjwvVmlldz48VmlldyBOYW1lPSJycHRfUG9ydGFmb2dsaW9fZGV0YWlscyI+PEZpZWxkIE5hbWU9IkNvbnRvIiBUeXBlPSJTdHJpbmciIC8+PEZpZWxkIE5hbWU9IlNvdHRvY29udG8iIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iRGl2aXNhIFBvcnRhZm9nbGlvIiBUeXBlPSJTdHJpbmciIC8+PEZpZWxkIE5hbWU9IklTSU4iIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iRGVzY3JpemlvbmUiIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iUXVhbnRpdGEiIFR5cGU9IkRvdWJsZSIgLz48RmllbGQgTmFtZT0iUHJlenpvIGZpc2NhbGUiIFR5cGU9IkRvdWJsZSIgLz48RmllbGQgTmFtZT0iQ29zdG8gYWNxdWlzdG8iIFR5cGU9IkRvdWJsZSIgLz48RmllbGQgTmFtZT0iUHJlenpvIGRpIG1lcmNhdG8iIFR5cGU9IkRvdWJsZSIgLz48RmllbGQgTmFtZT0iUmVuZGltZW50byBmaXNjYWxlICUiIFR5cGU9IkRvdWJsZSIgLz48RmllbGQgTmFtZT0iSW5jYXNzaSIgVHlwZT0iRG91YmxlIiAvPjxGaWVsZCBOYW1lPSJSZW5kaW1lbnRvIGNvbXBvc3RvICUiIFR5cGU9IkRvdWJsZSIgLz48L1ZpZXc+PFJlbGF0aW9uIE1hc3Rlcj0icnB0X1BvcnRhZm9nbGlvX2FuYWdyIiBEZXRhaWw9InJwdF9Qb3J0YWZvZ2xpb19kZXRhaWxzIj48S2V5Q29sdW1uIE1hc3Rlcj0iQ29udG8iIERldGFpbD0iQ29udG8iIC8+PC9SZWxhdGlvbj48L0RhdGFTZXQ+ + + + 17, 17 + + + PERhdGFTZXQgTmFtZT0ic3FsRGF0YVNvdXJjZTEiPjxWaWV3IE5hbWU9InJwdF9Qb3J0YWZvZ2xpb19hbmFnciI+PEZpZWxkIE5hbWU9IkNvbnRvIiBUeXBlPSJTdHJpbmciIC8+PEZpZWxkIE5hbWU9IkludGVzdGF6aW9uZSIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJEZXBvc2l0YXJpYSIgVHlwZT0iU3RyaW5nIiAvPjwvVmlldz48VmlldyBOYW1lPSJycHRfUG9ydGFmb2dsaW9fZGV0YWlscyI+PEZpZWxkIE5hbWU9IkNvbnRvIiBUeXBlPSJTdHJpbmciIC8+PEZpZWxkIE5hbWU9IlNvdHRvY29udG8iIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iRGl2aXNhIFBvcnRhZm9nbGlvIiBUeXBlPSJTdHJpbmciIC8+PEZpZWxkIE5hbWU9IklTSU4iIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iRGVzY3JpemlvbmUiIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iUXVhbnRpdGEiIFR5cGU9IkRvdWJsZSIgLz48RmllbGQgTmFtZT0iUHJlenpvIGZpc2NhbGUiIFR5cGU9IkRvdWJsZSIgLz48RmllbGQgTmFtZT0iQ29zdG8gYWNxdWlzdG8iIFR5cGU9IkRvdWJsZSIgLz48RmllbGQgTmFtZT0iUHJlenpvIGRpIG1lcmNhdG8iIFR5cGU9IkRvdWJsZSIgLz48RmllbGQgTmFtZT0iUmVuZGltZW50byBmaXNjYWxlICUiIFR5cGU9IkRvdWJsZSIgLz48RmllbGQgTmFtZT0iSW5jYXNzaSIgVHlwZT0iRG91YmxlIiAvPjxGaWVsZCBOYW1lPSJSZW5kaW1lbnRvIGNvbXBvc3RvICUiIFR5cGU9IkRvdWJsZSIgLz48L1ZpZXc+PFJlbGF0aW9uIE1hc3Rlcj0icnB0X1BvcnRhZm9nbGlvX2FuYWdyIiBEZXRhaWw9InJwdF9Qb3J0YWZvZ2xpb19kZXRhaWxzIj48S2V5Q29sdW1uIE1hc3Rlcj0iQ29udG8iIERldGFpbD0iQ29udG8iIC8+PC9SZWxhdGlvbj48L0RhdGFTZXQ+ + + \ No newline at end of file diff --git a/OlympiaIntranet/ReportPortfoglioApi.aspx b/OlympiaIntranet/ReportPortfoglioApi.aspx new file mode 100644 index 0000000..46993e3 --- /dev/null +++ b/OlympiaIntranet/ReportPortfoglioApi.aspx @@ -0,0 +1,15 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReportPortfoglioApi.aspx.cs" Inherits="OlympiaIntranet.ReportPortfoglioApi" %> + + + + + + + + +
+
+
+
+ + diff --git a/OlympiaIntranet/ReportPortfoglioApi.aspx.cs b/OlympiaIntranet/ReportPortfoglioApi.aspx.cs new file mode 100644 index 0000000..da3efc8 --- /dev/null +++ b/OlympiaIntranet/ReportPortfoglioApi.aspx.cs @@ -0,0 +1,51 @@ +using DevExpress.XtraReports.UI; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +/// +/// [02/02/2021] : Ho dovuto aggiungere sqlDataSource2 a ReportPortafoglio.repx perchè riferiva vecchia string connection altrimenti non funzionava sul server in produzione +/// non c'è modo di cancellare il vecchio sqlDataSource1 +/// +namespace OlympiaIntranet +{ + public partial class ReportPortfoglioApi : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + } + + string cod_rap = Request.QueryString["cod_rap"]; + + if (!String.IsNullOrEmpty(cod_rap)) + { + // Esegue report + string PdfFileName = string.Format("{0}_{1}.pdf", DateTime.Today.ToString("yyyyMMdd"),cod_rap); + string serverPdfFileName = Server.MapPath("~/Reports/pdf/olympia/" + PdfFileName); + + XtraReport report = new XtraReport(); + report.LoadLayout(Server.MapPath("~/Reports/template/olympia/ReportPortafoglio.repx")); + report.Parameters["cod_rap"].Value = cod_rap; + report.CreateDocument(true); + report.ExportToPdf(serverPdfFileName); + + // Legge report in byte[] array + byte[] bytePDF = System.IO.File.ReadAllBytes(serverPdfFileName); + + // Restituisce pdf + Response.Clear(); + Response.ContentType = "application/pdf"; + Response.AddHeader("Content-Disposition", "attachment;filename=" + PdfFileName); + Response.BinaryWrite(bytePDF); + Response.Flush(); + Response.End(); + } + } + } +} \ No newline at end of file diff --git a/OlympiaIntranet/ReportPortfoglioApi.aspx.designer.cs b/OlympiaIntranet/ReportPortfoglioApi.aspx.designer.cs new file mode 100644 index 0000000..0f5d351 --- /dev/null +++ b/OlympiaIntranet/ReportPortfoglioApi.aspx.designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class ReportPortfoglioApi + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + } +} diff --git a/OlympiaIntranet/Reports/template/olympia/ReportPortafoglio.repx b/OlympiaIntranet/Reports/template/olympia/ReportPortafoglio.repx new file mode 100644 index 0000000..7c25508 --- /dev/null +++ b/OlympiaIntranet/Reports/template/olympia/ReportPortafoglio.repx @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OlympiaIntranet/RetroGruppi.aspx b/OlympiaIntranet/RetroGruppi.aspx new file mode 100644 index 0000000..4ad9f20 --- /dev/null +++ b/OlympiaIntranet/RetroGruppi.aspx @@ -0,0 +1,153 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RetroGruppi.aspx.cs" Inherits="OlympiaIntranet.Retrocessioni" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + diff --git a/OlympiaIntranet/RetroGruppi.aspx.cs b/OlympiaIntranet/RetroGruppi.aspx.cs new file mode 100644 index 0000000..45a56e6 --- /dev/null +++ b/OlympiaIntranet/RetroGruppi.aspx.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + public partial class Retrocessioni : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (HttpContext.Current.User.Identity.IsAuthenticated == false) + { + Response.Redirect("~/SignIn.aspx"); + + //CommonClass.MessageBox(this, $"Utente {HttpContext.Current.User.Identity} non autorizzato all'accesso della sezione RETRO GRUPPI!"); + //return; + } + } + + /* IMPORTANTE DA REPLICARE SU SmartDB.UnderlyingsPage invece che usare eventi Inserting/Updating... + protected void gvRetrocessioni_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e) + { + // Ottieni i valori delle ComboBox per Advisor, Consulente e Gestore + var advisor = (e.NewValues["Advisor"] ?? "").ToString(); + var consulente = (e.NewValues["Consulente"] ?? "").ToString(); + var gestore = (e.NewValues["Gestore"] ?? "").ToString(); + + // Controlla se solo uno dei valori è selezionato + int selectedCount = 0; + + if (!string.IsNullOrEmpty(advisor)) selectedCount++; + if (!string.IsNullOrEmpty(consulente)) selectedCount++; + if (!string.IsNullOrEmpty(gestore)) selectedCount++; + + // Se più di uno è selezionato, imposta un errore di validazione + if (selectedCount > 1) + { + e.RowError = "Devi selezionare solo uno fra Advisor, Consulente o Gestore."; + } + else if (selectedCount == 0) + { + e.RowError = "Devi selezionare almeno uno fra Advisor, Consulente o Gestore."; + } + } + */ + } +} \ No newline at end of file diff --git a/OlympiaIntranet/RetroGruppi.aspx.designer.cs b/OlympiaIntranet/RetroGruppi.aspx.designer.cs new file mode 100644 index 0000000..c0f68fc --- /dev/null +++ b/OlympiaIntranet/RetroGruppi.aspx.designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class Retrocessioni + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// gvRetrocessioni control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvRetrocessioni; + + /// + /// SqlDSGDNRetrocessioni control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGDNRetrocessioni; + + /// + /// SqlDSAdvisors control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSAdvisors; + + /// + /// SqlDSConsulenti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSConsulenti; + + /// + /// SqlDSGestori control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGestori; + } +} diff --git a/OlympiaIntranet/RicercaSottostanti.aspx b/OlympiaIntranet/RicercaSottostanti.aspx new file mode 100644 index 0000000..3ec01cc --- /dev/null +++ b/OlympiaIntranet/RicercaSottostanti.aspx @@ -0,0 +1,95 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RicercaSottostanti.aspx.cs" Inherits="OlympiaIntranet.RicercaSottostanti" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data.Linq" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + diff --git a/OlympiaIntranet/RicercaSottostanti.aspx.cs b/OlympiaIntranet/RicercaSottostanti.aspx.cs new file mode 100644 index 0000000..73b9a9e --- /dev/null +++ b/OlympiaIntranet/RicercaSottostanti.aspx.cs @@ -0,0 +1,183 @@ +using DevExpress.Export; +using DevExpress.Web; +using DevExpress.XtraPrinting; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace OlympiaIntranet +{ + //public partial class RicercaSottostanti : System.Web.UI.Page + //{ + // protected void Page_Init(object sender, EventArgs e) + // { + // // Session["Titolo"] = null; non mettere altrimenti l'esportazione in excel risulta sempre vuota!! + // } + + // protected void Page_Load(object sender, EventArgs e) + // { + // if (!IsPostBack) BindGrid(); + // } + + // protected void btnCercaTitolo_Click(object sender, EventArgs e) + // { + // // Rileva titolo selezionato in gvTitoli + // ASPxGridView grid = gridlookupTitoli.GridView; + // object objTitolo = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "cod_tit" }); + // if (objTitolo != null) Session["Titolo"] = objTitolo.ToString(); + // else Session["Titolo"] = null; + + // BindGrid(); + // } + + // protected void btnEsportaExcel_Click(object sender, EventArgs e) + // { + // BindGrid(); + + // ExporterRicercaSottostanti.ExportSelectedRowsOnly = false; + // ExporterRicercaSottostanti.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - SottostantiRilevati"; + // XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.DataAware }; // in DataAware mode l'evento ASPxGridViewExporter_RenderBrick non viene eseguito!! + // ExporterRicercaSottostanti.WriteXlsxToResponse(op); + // } + + // private void BindGrid() + // { + // if (Session["Titolo"] != null) + // { + // DataTable dati = CommonClass.execQuery_Datatable_Sql("oi_RicercaSottostanti", + // Properties.Settings.Default.SqlConnection, + // "", + // "", + // "", + // -1, + // -1, + // null, + // "", + // "", + // null, + // "", + // Session["Titolo"].ToString()); + // gvSottostantiTrovati.DataSource = dati; + // gvSottostantiTrovati.DataBind(); + // } + // else + // { + // gvSottostantiTrovati.DataSource = null; + // gvSottostantiTrovati.DataBind(); + // } + // } + + //} + + public partial class RicercaSottostanti : System.Web.UI.Page + { + private const string CacheKey = "CacheDatiSottostanti"; + + protected void Page_Init(object sender, EventArgs e) + { + gvSottostantiTrovati.DataBinding += gvSottostantiTrovati_DataBinding; + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + BindGrid(); + } + + protected void btnCercaTitolo_Click(object sender, EventArgs e) + { + // Rileva titolo selezionato in gvTitoli + ASPxGridView grid = gridlookupTitoli.GridView; + object objTitolo = grid.GetRowValues(grid.FocusedRowIndex, new string[] { "cod_tit" }); + + if (objTitolo != null) + Session["Titolo"] = objTitolo.ToString(); + else + Session["Titolo"] = null; + + // Quando cerchi un nuovo titolo azzeri la cache + Session[CacheKey] = null; + + BindGrid(); + } + + protected void btnEsportaExcel_Click(object sender, EventArgs e) + { + BindGrid(); + + ExporterRicercaSottostanti.ExportSelectedRowsOnly = false; + ExporterRicercaSottostanti.FileName = DateTime.Now.ToString("yyyyMMdd_HHmm") + " - SottostantiRilevati"; + XlsxExportOptionsEx op = new XlsxExportOptionsEx() { ExportType = ExportType.DataAware }; + ExporterRicercaSottostanti.WriteXlsxToResponse(op); + } + + private void BindGrid() + { + if (Session["Titolo"] != null) + { + // Usa la cache se disponibile + DataTable dati = Session[CacheKey] as DataTable; + + if (dati == null) + { + dati = CommonClass.execQuery_Datatable_Sql("oi_RicercaSottostanti", + Properties.Settings.Default.SqlConnection, + "", + "", + "", + -1, + -1, + null, + "", + "", + null, + "", + Session["Titolo"].ToString()); + + Session[CacheKey] = dati; // salva in cache + } + + gvSottostantiTrovati.DataSource = dati; + gvSottostantiTrovati.DataBind(); + } + else + { + gvSottostantiTrovati.DataSource = null; + gvSottostantiTrovati.DataBind(); + } + } + + private void gvSottostantiTrovati_DataBinding(object sender, EventArgs e) + { + if (Session["Titolo"] != null) + { + DataTable dati = Session[CacheKey] as DataTable; + if (dati == null) + { + // safety: se la cache è scaduta ricarico da DB + dati = CommonClass.execQuery_Datatable_Sql("oi_RicercaSottostanti", + Properties.Settings.Default.SqlConnection, + "", + "", + "", + -1, + -1, + null, + "", + "", + null, + "", + Session["Titolo"].ToString()); + Session[CacheKey] = dati; + } + + gvSottostantiTrovati.DataSource = dati; + } + } + } + +} \ No newline at end of file diff --git a/OlympiaIntranet/RicercaSottostanti.aspx.designer.cs b/OlympiaIntranet/RicercaSottostanti.aspx.designer.cs new file mode 100644 index 0000000..d917968 --- /dev/null +++ b/OlympiaIntranet/RicercaSottostanti.aspx.designer.cs @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class RicercaSottostanti + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// formLayout control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout formLayout; + + /// + /// gridlookupTitoli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridlookupTitoli; + + /// + /// btnCercaTitolo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnCercaTitolo; + + /// + /// btnEsportaExcel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxButton btnEsportaExcel; + + /// + /// gvSottostantiTrovati control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvSottostantiTrovati; + + /// + /// ExporterRicercaSottostanti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridViewExporter ExporterRicercaSottostanti; + + /// + /// SqlDSTitoli control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSTitoli; + + /// + /// SqlDSRicercaSottostanti control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSRicercaSottostanti; + } +} diff --git a/OlympiaIntranet/ScostamentoPerformance.aspx b/OlympiaIntranet/ScostamentoPerformance.aspx new file mode 100644 index 0000000..e14a42c --- /dev/null +++ b/OlympiaIntranet/ScostamentoPerformance.aspx @@ -0,0 +1,157 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ScostamentoPerformance.aspx.cs" Inherits="OlympiaIntranet.ScostamentoPerformance" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> + + + + + + Scostamento Performance + + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + +
+ + diff --git a/OlympiaIntranet/ScostamentoPerformance.aspx.cs b/OlympiaIntranet/ScostamentoPerformance.aspx.cs new file mode 100644 index 0000000..a5ddee5 --- /dev/null +++ b/OlympiaIntranet/ScostamentoPerformance.aspx.cs @@ -0,0 +1,242 @@ +using DevExpress.Web; +using System; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Web; + +namespace OlympiaIntranet +{ + public partial class ScostamentoPerformance : System.Web.UI.Page + { + private static readonly string[] AdminUsers = { "fcostalonga", "fpisoni", "glicciardello", "erigo", "malfonsi" }; + + protected bool IsRiskManager + { + get { return Session["is_risk_sp"] != null && (bool)Session["is_risk_sp"]; } + } + + private string ConnectionString + { + get { return System.Configuration.ConfigurationManager.ConnectionStrings["OlympiaIntranet.Properties.Settings.SqlConnection"].ConnectionString; } + } + + // http://localhost:63155/ScostamentoPerformance.aspx → usa l'utente loggato + // http://localhost:63155/ScostamentoPerformance.aspx?user=fcostalonga → simula Risk Manager + // http://localhost:63155/ScostamentoPerformance.aspx?user=BELTRAMO → simula gestore specifico + + + protected void Page_Load(object sender, EventArgs e) + { + if (!HttpContext.Current.User.Identity.IsAuthenticated) + { + Response.Redirect("~/SignIn.aspx"); + return; + } + + // Usa il parametro URL se presente (solo per debug), altrimenti l'utente loggato + string loggedUser = Request.QueryString["user"]; + if (string.IsNullOrEmpty(loggedUser)) + { + loggedUser = HttpContext.Current.User.Identity.Name; + } + + // SEMPRE determinare e impostare il ruolo ad ogni request + // per evitare problemi con sessioni "sporche" + bool isRisk = AdminUsers.Contains(loggedUser); + Session["is_risk_sp"] = isRisk; + Session["user_display_sp"] = loggedUser; + Session["user"] = loggedUser; + + if (!IsPostBack) + { + gridLookupGestore.DataBind(); + + if (isRisk) + { + gridLookupGestore.Enabled = true; + Session["cod_ges_sp"] = string.Empty; + gridLookupGestore.Value = "-- TUTTI --"; + } + else + { + string gestoreCode = loggedUser.Length > 1 + ? loggedUser.Substring(1).ToUpper() + : loggedUser.ToUpper(); + + Session["cod_ges_sp"] = gestoreCode; + gridLookupGestore.Enabled = false; + gridLookupGestore.Value = gestoreCode; + } + + BindGrid(); + } + } + + protected void gridLookupGestore_ValueChanged(object sender, EventArgs e) + { + var gridLookup = sender as ASPxGridLookup; + + if (gridLookup?.Value != null) + { + string selectedValue = gridLookup.Value.ToString(); + Session["cod_ges_sp"] = (selectedValue == "-- TUTTI --") ? string.Empty : selectedValue; + } + else + { + Session["cod_ges_sp"] = string.Empty; + } + + BindGrid(); + } + + protected void gvScostamentoPerformance_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) + { + try + { + int id = Convert.ToInt32(e.Keys["Id"]); + string commento = e.NewValues["Commento"]?.ToString() ?? string.Empty; + string note = e.NewValues["Note"]?.ToString() ?? string.Empty; + bool bloccoCommento = e.NewValues["BloccoCommento"] != null && Convert.ToBoolean(e.NewValues["BloccoCommento"]); + string utente = Session["user_display_sp"]?.ToString() ?? "unknown"; + bool isRiskManager = IsRiskManager; + + using (var conn = new SqlConnection(ConnectionString)) + { + using (var cmd = new SqlCommand("GDN_AggiornaCommentoScostamento", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@Id", id); + cmd.Parameters.AddWithValue("@Commento", commento); + cmd.Parameters.AddWithValue("@Note", note); + cmd.Parameters.AddWithValue("@BloccoCommento", bloccoCommento); + cmd.Parameters.AddWithValue("@Utente", utente); + cmd.Parameters.AddWithValue("@IsRiskManager", isRiskManager); + + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + + e.Cancel = true; + gvScostamentoPerformance.CancelEdit(); + BindGrid(); + } + catch (SqlException ex) + { + e.Cancel = true; + gvScostamentoPerformance.CancelEdit(); + lblMeseRiferimento.Text = "Errore: " + ex.Message; + } + } + + protected void gvScostamentoPerformance_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e) + { + var grid = sender as ASPxGridView; + + // Commento: bloccato se BloccoCommento=true e non è Risk Manager + if (e.Column.FieldName == "Commento") + { + bool bloccato = false; + object valBlocco = grid.GetRowValues(e.VisibleIndex, "BloccoCommento"); + if (valBlocco != null && valBlocco != DBNull.Value) + { + bloccato = Convert.ToBoolean(valBlocco); + } + + if (bloccato && !IsRiskManager) + { + e.Editor.ReadOnly = true; + e.Editor.BackColor = Color.LightGray; + } + } + + // Note: sempre editabile, non segue la logica di blocco + // (nessuna restrizione per il campo Note) + + // BloccoCommento: solo Risk Manager può modificare + if (e.Column.FieldName == "BloccoCommento") + { + if (!IsRiskManager) + { + e.Editor.ReadOnly = true; + e.Editor.Enabled = false; + } + } + } + + protected void gvScostamentoPerformance_DataBound(object sender, EventArgs e) + { + // Lasciato vuoto - la label viene aggiornata in BindGrid() + } + + protected void gvScostamentoPerformance_CancelRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e) + { + // Gestione annullamento edit + } + + protected void gvScostamentoPerformance_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) + { + // Colora solo Commento in rosa se bloccato (Note è sempre libero) + if (e.DataColumn.FieldName != "Commento") + return; + + object valBlocco = e.GetValue("BloccoCommento"); + bool bloccato = valBlocco != null && valBlocco != DBNull.Value && Convert.ToBoolean(valBlocco); + + if (bloccato) + { + e.Cell.BackColor = Color.FromArgb(255, 230, 230); // Rosso chiaro/rosa + e.Cell.ToolTip = "Commento bloccato"; + } + } + + private DataTable GetScostamentoPerformanceData() + { + string gestore = Session["cod_ges_sp"]?.ToString() ?? string.Empty; + + using (var conn = new SqlConnection(ConnectionString)) + { + using (var cmd = new SqlCommand("GDN_GetScostamentoPerformanceMensili", conn)) + { + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@Gestore", gestore); + + var adapter = new SqlDataAdapter(cmd); + var dt = new DataTable(); + adapter.Fill(dt); + return dt; + } + } + } + + private void BindGrid() + { + var dt = GetScostamentoPerformanceData(); + + gvScostamentoPerformance.DataSource = dt; + gvScostamentoPerformance.DataBind(); + + // Aggiorna label mese riferimento + if (dt.Rows.Count > 0 && dt.Columns.Contains("DataRiferimento")) + { + object dataRif = dt.Rows[0]["DataRiferimento"]; + if (dataRif != null && dataRif != DBNull.Value) + { + DateTime data = Convert.ToDateTime(dataRif); + lblMeseRiferimento.Text = "Mese di riferimento: " + data.ToString("dd-MM-yyyy"); + } + } + else + { + lblMeseRiferimento.Text = "Nessuno scostamento performance trovato"; + } + } + + protected void gvScostamentoPerformance_DataBinding(object sender, EventArgs e) + { + gvScostamentoPerformance.DataSource = GetScostamentoPerformanceData(); + } + } +} diff --git a/OlympiaIntranet/ScostamentoPerformance.aspx.designer.cs b/OlympiaIntranet/ScostamentoPerformance.aspx.designer.cs new file mode 100644 index 0000000..dbd6c98 --- /dev/null +++ b/OlympiaIntranet/ScostamentoPerformance.aspx.designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OlympiaIntranet +{ + + + public partial class ScostamentoPerformance + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ASPxFormLayout1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxFormLayout ASPxFormLayout1; + + /// + /// gridLookupGestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridLookup gridLookupGestore; + + /// + /// lblMeseRiferimento control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxLabel lblMeseRiferimento; + + /// + /// gvScostamentoPerformance control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::DevExpress.Web.ASPxGridView gvScostamentoPerformance; + + /// + /// SqlDSGestori control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.SqlDataSource SqlDSGestori; + } +} diff --git a/OlympiaIntranet/SelettoreCertificati.aspx b/OlympiaIntranet/SelettoreCertificati.aspx new file mode 100644 index 0000000..054bda6 --- /dev/null +++ b/OlympiaIntranet/SelettoreCertificati.aspx @@ -0,0 +1,373 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SelettoreCertificati.aspx.cs" Inherits="OlympiaIntranet.SelettoreCertificati" %> + +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %> +<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data.Linq" TagPrefix="dx" %> + + +<%--ref link : https://supportcenter.devexpress.com/ticket/details/e1081/grid-view-for-asp-net-web-forms-how-to-display-the-grid-view-in-the-full-screen-mode-100--%> + + + + + + + + +
+ + + + +
+ + + + + +
+ <%--