Exemplo n.º 1
0
        private void LoadChartsAndGrids()
        {
            DataSet dsAssetChart       = new DataSet();
            DataSet dsMFInv            = new DataSet();
            DataSet dsEquity           = new DataSet();
            DataSet dsFI               = new DataSet();
            DataSet dsOtherAssets      = new DataSet();
            DataSet dsMFInvestments    = new DataSet();
            DataSet dsEquityDirect     = new DataSet();
            DataSet dsNetIncomeSummary = new DataSet();
            AssetBo assetsBo           = new AssetBo();
            double  TotalAssetValue    = 0.0F;
            double  mfRealizedPL       = 0;
            double  mfDivIncome        = 0;
            double  mfSubTotal         = 0;
            double  eqSpecPL           = 0;
            double  eqDelivPL          = 0;
            double  eqDivIncome        = 0;
            double  eqSubTotal         = 0;
            double  assetTotal         = 0;
            double  divIncomeTotal     = 0;

            // Bind Total Asset DataSet
            //dsAssetChart = assetsBo.GetPortfolioAssetAggregateCurrentValues(customerPortfolioVo.PortfolioId);
            dsAssetChart = assetsBo.GetPortfolioAssetAggregateCurrentValues(portfolioId);

            // Bind MF Investments DataSet
            dsMFInv = assetsBo.GetMFInvAggrCurrentValues(portfolioId, adviserId);

            // Bind Equity DataSet
            dsEquity = assetsBo.GetEQAggrCurrentValues(portfolioId, adviserId);

            // Bind FI Dashboard DataSet
            dsFI = assetsBo.GetFIGovtInsDashboardCurrentValues(portfolioId);

            // Bind Other Asset Dashboard DataSet
            dsOtherAssets = assetsBo.GetOtherAssetsDashboardCurrentValues(portfolioId);

            // Bind Net Income Summary
            dsNetIncomeSummary = assetsBo.GetNetIncomeSummary(portfolioId);

            BindMFChart(dsMFInv.Tables[1]);
            BindMFGrid(dsMFInv.Tables[0]);
            BindEQGrid(dsEquity.Tables[0]);
            //BindEQChart();
            BindFIDashGrid(dsFI.Tables[0]);
            BindOtherAssetGrid(dsOtherAssets.Tables[0]);

            BindAssetChart(dsAssetChart);

            // Bind Total Asset Labels
            if (dsAssetChart.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < dsAssetChart.Tables[0].Rows.Count; i++)
                {
                    TotalAssetValue += double.Parse(dsAssetChart.Tables[0].Rows[i]["AggrCurrentValue"].ToString());
                }
                lblTotalAssetsValue.Text = String.Format("{0:n2}", decimal.Parse(TotalAssetValue.ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
            }
            else
            {
                lblTotalAssetsValue.Text = String.Format("{0:n2}", decimal.Parse(TotalAssetValue.ToString()));
            }

            lblNetWorthValue.Text = String.Format("{0:n2}", decimal.Parse((TotalAssetValue - 0).ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));

            if (dsNetIncomeSummary.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in dsNetIncomeSummary.Tables[0].Rows)
                {
                    if (dr["NetIncome"].ToString() == "MFRealizedPL")
                    {
                        mfRealizedPL = double.Parse(dr["AggrValue"].ToString());
                    }
                    else if (dr["NetIncome"].ToString() == "Realised G/L - Deliv")
                    {
                        eqDelivPL = double.Parse(dr["AggrValue"].ToString());
                    }
                    else if (dr["NetIncome"].ToString() == "Realised G/L - Spec")
                    {
                        eqSpecPL = double.Parse(dr["AggrValue"].ToString());
                    }
                    else if (dr["NetIncome"].ToString() == "Dividend Income")
                    {
                        mfDivIncome = double.Parse(dr["AggrValue"].ToString());
                    }
                }
                mfSubTotal = mfRealizedPL;
                eqSubTotal = eqSpecPL + eqDelivPL;
                assetTotal = mfSubTotal + eqSubTotal;

                eqDivIncome    = 0;
                divIncomeTotal = mfDivIncome + eqDivIncome;

                lblDividend.Text = String.Format("{0:n2}", mfDivIncome.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));

                lblMFRPLValue.Text      = String.Format("{0:n2}", mfRealizedPL.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                lblMFSubTotalValue.Text = String.Format("{0:n2}", mfSubTotal.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                lblRealisedDeliv.Text   = String.Format("{0:n2}", eqDelivPL.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                lblRealisedSpec.Text    = String.Format("{0:n2}", eqSpecPL.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                lblEQSubTotalValue.Text = String.Format("{0:n2}", eqSubTotal.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                lblTotalValue.Text      = String.Format("{0:n2}", assetTotal.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                lblEQDidvidend.Text     = String.Format("{0:n2}", eqDivIncome.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                lblDivIncomeTotal.Text  = String.Format("{0:n2}", divIncomeTotal.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
            }
        }