Exemplo n.º 1
0
        //function to populate the Asset Class wise Investments in the grid
        public void BindAssetInvestments()
        {
            DataTable dtAssetAggrCurrentValues = new DataTable();
            double    liabilityValue           = 0;
            double    networth = 0;

            try
            {
                dsAssetAggrCurrentValues = assetBo.GetPortfolioAssetAggregateCurrentValues(portfolioId);
                liabilityValue           = assetBo.GetCustomerPortfolioLiability(portfolioId);
                if (dsAssetAggrCurrentValues.Tables[0].Rows.Count == 0 && liabilityValue == 0)
                {
                    lblAssetDetailsMsg.Visible = true;
                }
                else
                {
                    lblAssetDetailsMsg.Visible = false;

                    dtAssetAggrCurrentValues.Columns.Add("Asset Class");
                    dtAssetAggrCurrentValues.Columns.Add("Current Value");


                    foreach (DataRow dr in dsAssetAggrCurrentValues.Tables[0].Rows)
                    {
                        if (double.Parse(dr["AggrCurrentValue"].ToString()) != 0)
                        {
                            drCurrentValues = dtAssetAggrCurrentValues.NewRow();

                            drCurrentValues[0] = dr["AssetType"].ToString();
                            drCurrentValues[1] = double.Parse(dr["AggrCurrentValue"].ToString()).ToString("n0", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"));

                            dtAssetAggrCurrentValues.Rows.Add(drCurrentValues);

                            sum = sum + double.Parse(dr["AggrCurrentValue"].ToString());
                        }
                    }
                    //Adding Assets total to the data table to display in the gridview
                    drCurrentValues    = dtAssetAggrCurrentValues.NewRow();
                    drCurrentValues[0] = "Assets Total";
                    drCurrentValues[1] = double.Parse(sum.ToString()).ToString("n0", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"));;
                    dtAssetAggrCurrentValues.Rows.Add(drCurrentValues);

                    //Adding Liabilities to the data table to display in the gridview
                    drCurrentValues    = dtAssetAggrCurrentValues.NewRow();
                    drCurrentValues[0] = "Liabilities";
                    drCurrentValues[1] = double.Parse(liabilityValue.ToString()).ToString("n0", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"));;
                    dtAssetAggrCurrentValues.Rows.Add(drCurrentValues);

                    //Adding Net Worth to the data table to display in the gridview
                    drCurrentValues    = dtAssetAggrCurrentValues.NewRow();
                    drCurrentValues[0] = "Net Worth";
                    networth           = sum - liabilityValue;
                    drCurrentValues[1] = double.Parse(networth.ToString()).ToString("n0", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"));;
                    dtAssetAggrCurrentValues.Rows.Add(drCurrentValues);

                    gvAssetAggrCurrentValue.DataSource = dtAssetAggrCurrentValues;
                    gvAssetAggrCurrentValue.DataBind();
                    gvAssetAggrCurrentValue.Visible = true;

                    //networth = sum - liabilityValue;
                    //lblAssets.Text = String.Format("{0:n2}", double.Parse(sum.ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                    //lblLiabilityValue.Text = String.Format("{0:n2}", double.Parse(liabilityValue.ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                    //lblNetWorth.Text = String.Format("{0:n2}", double.Parse(networth.ToString()).ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")));
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }

            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "AdvisorRMCustIndiDashboard.ascx:BindAssetInvestments()");
                object[] objects = new object[2];
                objects[0] = portfolioId;
                objects[1] = dsAssetAggrCurrentValues;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }