Ejemplo n.º 1
0
        public DataSet GetComprehensiveNetworthSummary(PortfolioReportVo report, int adviserId)
        {
            PortfolioReportsDao portfolioReport = new PortfolioReportsDao();
            DataSet             dsComprehensiveNetworthSummary = null;

            try {
                dsComprehensiveNetworthSummary = portfolioReport.GetComprehensiveNetworthSummary(report, adviserId);
            }
            catch (Exception ex)
            {
            }
            return(dsComprehensiveNetworthSummary);
        }
        public DataSet GetCustomerAssetAllocationDetails(PortfolioReportVo report, int adviserId, string reportType)
        {
            PortfolioReportsDao portfolioReport   = new PortfolioReportsDao();
            DataSet             dsAssetAllocation = null;

            try
            {
                dsAssetAllocation = portfolioReport.GetCustomerAssetAllocationDetails(report, adviserId, reportType);
            }
            catch (Exception ex)
            {
            }
            return(dsAssetAllocation);
        }
        public DataSet GetPortfolioSummary(PortfolioReportVo report, int adviserId)
        {
            PortfolioReportsDao portfolioReports = new PortfolioReportsDao();
            DataSet             dsPortfolio      = new DataSet();
            DataTable           dtAssetPrevious  = new DataTable();
            DataTable           dtAssetCurrent   = new DataTable();
            DataTable           dtAssets         = new DataTable();

            //DataTable dtLiabilities = new DataTable();
            dtAssets.Columns.Add("PortfolioId");
            dtAssets.Columns.Add("AssetType");

            dtAssets.Columns.Add("PreviousValue", Type.GetType("System.Double"));
            dtAssets.Columns.Add("CurrentValue", Type.GetType("System.Double"));
            dtAssets.Columns.Add("CustomerId", Type.GetType("System.Int64"));
            dtAssets.Columns.Add("CustomerName");
            dtAssets.Columns.Add("PortfolioName");



            DataSet dsPortfolioSummary = portfolioReports.GetPortfolioSummary(report, adviserId);

            dtAssetCurrent  = dsPortfolioSummary.Tables[0];
            dtAssetPrevious = dsPortfolioSummary.Tables[1];

            //dtAssetCurrent.Merge(dtAssetPrevious);
            try
            {
                foreach (DataRow drCurrent in dtAssetCurrent.Rows)
                {
                    foreach (DataRow drPrevious in dtAssetPrevious.Rows)
                    {
                        if (drCurrent["PortfolioId"].ToString() == drPrevious["PortfolioId"].ToString() && drCurrent["AssetType"].ToString() == drPrevious["AssetType"].ToString())
                        {
                            drCurrent["PreviousValue"] = Convert.ToInt64(drPrevious["PreviousValue"]);
                            break;
                        }
                    }
                    dtAssets.ImportRow(drCurrent);
                }


                foreach (DataRow drPrevious in dtAssetPrevious.Rows)
                {
                    string expression = string.Empty;
                    expression = "PortfolioId = " + drPrevious["PortfolioId"] + " and AssetType = '" + drPrevious["AssetType"] + "'";
                    if (dtAssets.Select(expression) == null)
                    {
                        dtAssets.ImportRow(drPrevious);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            dsPortfolio.Tables.Add(dtAssets);
            dsPortfolioSummary.Tables[2].TableName = "dtLiabilities";
            dsPortfolio.Tables.Add(dsPortfolioSummary.Tables[2].Copy());

            DataTable dtNetWorth = CalculateCustomersNetWorth(dsPortfolio);

            //DataTable dtNetWorth =  CalculateNetWorth(dsPortfolio);
            dsPortfolio.Tables.Add(dtNetWorth);


            return(dsPortfolio);
        }