Ejemplo n.º 1
0
        private void BindEQLedgerMIS(int CustomerId, int TradeAccountId, int BankAccountId)
        {
            DataSet   dsGetEqLedgerMIS;
            DataTable dtGetEqLedgerMIS;

            dsGetEqLedgerMIS = customerTransactionBo.GetEquityLedgerMIS(CustomerId, TradeAccountId, BankAccountId);
            dtGetEqLedgerMIS = dsGetEqLedgerMIS.Tables[0];

            DataTable dtEqLedgerMISDetails = new DataTable();

            dtEqLedgerMISDetails.Columns.Add("MarginDetails");
            dtEqLedgerMISDetails.Columns.Add("Amount");
            dtEqLedgerMISDetails.Columns.Add("CurrentValuation");
            dtEqLedgerMISDetails.Columns.Add("ProfitLoss");

            DataRow drEqLedgerMISDetails;

            foreach (DataRow dr in dtGetEqLedgerMIS.Rows)
            {
                drEqLedgerMISDetails = dtEqLedgerMISDetails.NewRow();
                if (dr["TYPE"].ToString() == "A")
                {
                    drEqLedgerMISDetails["MarginDetails"] = "Cheques received (deposit)";
                }
                else if (dr["TYPE"].ToString() == "B")
                {
                    drEqLedgerMISDetails["MarginDetails"] = "Withdrawl to Date";
                }
                else if (dr["TYPE"].ToString() == "C")
                {
                    drEqLedgerMISDetails["MarginDetails"] = "Amount Invested";
                }
                else if (dr["TYPE"].ToString() == "D")
                {
                    drEqLedgerMISDetails["MarginDetails"] = "Balance Margin";
                }

                if (Math.Round(decimal.Parse(dr["Amount"].ToString()), 0) != 0)
                {
                    drEqLedgerMISDetails["Amount"] = Math.Round(decimal.Parse(dr["Amount"].ToString()), 0);
                }
                else
                {
                    drEqLedgerMISDetails["Amount"] = "";
                }

                if (Math.Round(decimal.Parse(dr["CurrentValue"].ToString()), 0) != 0)
                {
                    drEqLedgerMISDetails["CurrentValuation"] = Math.Round(decimal.Parse(dr["CurrentValue"].ToString()), 0);
                }
                else
                {
                    drEqLedgerMISDetails["CurrentValuation"] = "";
                }
                if (Math.Round(decimal.Parse(dr["ProfitLoss"].ToString()), 0) != 0)
                {
                    drEqLedgerMISDetails["ProfitLoss"] = Math.Round(decimal.Parse(dr["ProfitLoss"].ToString()), 0);
                }
                else
                {
                    drEqLedgerMISDetails["ProfitLoss"] = "";
                }

                dtEqLedgerMISDetails.Rows.Add(drEqLedgerMISDetails);
            }
            if (dtEqLedgerMISDetails != null)
            {
                gvEqMIS.Visible     = true;
                imgbtnEqMIS.Visible = true;
                gvEqMIS.DataSource  = dtEqLedgerMISDetails;
                gvEqMIS.DataBind();
            }
            else
            {
                gvEqMIS.Visible    = false;
                gvEqMIS.DataSource = null;
                gvEqMIS.DataBind();
                imgbtnEqMIS.Visible = false;
            }

            if (Cache["gvEqMIS" + userVo.UserId] == null)
            {
                Cache.Insert("gvEqMIS" + userVo.UserId, dtEqLedgerMISDetails);
            }
            else
            {
                Cache.Remove("gvEqMIS" + userVo.UserId);
                Cache.Insert("gvEqMIS" + userVo.UserId, dtEqLedgerMISDetails);
            }
        }