Exemple #1
0
        private void BindGridView(int customerId, DateTime from, DateTime to)
        {
            string      type, mode;
            RadComboBox radComboBoxTradeDate = new RadComboBox();

            DataSet   dsExange             = new DataSet();;
            DataTable dtEquityTransactions = new DataTable();
            DataTable dtTradeDate          = new DataTable();

            Dictionary <string, string> genDictTranType  = new Dictionary <string, string>();
            Dictionary <string, string> genDictExchange  = new Dictionary <string, string>();
            Dictionary <string, string> genDictTradeDate = new Dictionary <string, string>();
            int Visible = 0;

            try
            {
                if (Request.QueryString["From"] != null && Request.QueryString["To"] != null)
                {
                    equityTransactionList = customerTransactionBo.GetEquityTransactions(customerId, int.Parse(Request.QueryString["PortfolioId"].ToString()), int.Parse(Request.QueryString["ScripCode"].ToString()), from, to, Request.QueryString["Currency"].ToString());
                    Visible = 1;
                }
                else
                {
                    equityTransactionList = customerTransactionBo.GetEquityTransactions(customerId, portfolioId, 0, from, to, (ddl_type.SelectedValue));
                }

                if (equityTransactionList != null)
                {
                    ErrorMessage.Visible         = false;
                    gvEquityTransactions.Visible = true;
                    dtEquityTransactions.Columns.Add("TransactionId");
                    dtEquityTransactions.Columns.Add("InvestorName");
                    dtEquityTransactions.Columns.Add("PanNo");
                    dtEquityTransactions.Columns.Add("ManagerName");
                    dtEquityTransactions.Columns.Add("BrokerName");
                    dtEquityTransactions.Columns.Add("TradeAccountNum");
                    dtEquityTransactions.Columns.Add("DematAccountNo");
                    dtEquityTransactions.Columns.Add("SettlementNo");
                    dtEquityTransactions.Columns.Add("BillNo");
                    dtEquityTransactions.Columns.Add("Scheme Name");
                    dtEquityTransactions.Columns.Add("Scripcode");

                    dtEquityTransactions.Columns.Add("Transaction Type");
                    dtEquityTransactions.Columns.Add("Transaction Code");
                    dtEquityTransactions.Columns.Add("Dividend Status");
                    dtEquityTransactions.Columns.Add("Exchange");
                    dtEquityTransactions.Columns.Add("TradeDate", typeof(DateTime));
                    dtEquityTransactions.Columns.Add("Quantity", typeof(double));
                    dtEquityTransactions.Columns.Add("Rate", typeof(double));

                    dtEquityTransactions.Columns.Add("FORExRate");
                    dtEquityTransactions.Columns.Add("FORExDate", typeof(DateTime));

                    dtEquityTransactions.Columns.Add("Gross Trade Consideration", typeof(double));
                    dtEquityTransactions.Columns.Add("Brokerage", typeof(double));
                    dtEquityTransactions.Columns.Add("Net Rate With Brokerage", typeof(double));
                    dtEquityTransactions.Columns.Add("Net Trade Consideration With Brokerage", typeof(double));
                    dtEquityTransactions.Columns.Add("SebiTurnOverFee", typeof(double));
                    dtEquityTransactions.Columns.Add("TransactionCharges", typeof(double));
                    dtEquityTransactions.Columns.Add("StampCharges", typeof(double));
                    dtEquityTransactions.Columns.Add("STT", typeof(double));
                    dtEquityTransactions.Columns.Add("ServiceTax", typeof(double));
                    dtEquityTransactions.Columns.Add("OtherCharges", typeof(double));
                    dtEquityTransactions.Columns.Add("Difference In Amount", typeof(double));
                    dtEquityTransactions.Columns.Add("Net Rate With All Charges", typeof(double));
                    dtEquityTransactions.Columns.Add("TradeTotal", typeof(double));
                    dtEquityTransactions.Columns.Add("TransactionStatus");
                    dtEquityTransactions.Columns.Add("Purpose");
                    dtEquityTransactions.Columns.Add("Demat Charge", typeof(double));
                    dtEquityTransactions.Columns.Add("FXCurencyRate");
                    dtEquityTransactions.Columns.Add("MktClosingForexRate");
                    dtEquityTransactions.Columns.Add("CET_CreatedOn", typeof(DateTime));

                    DataRow drEquityTransaction;
                    DataRow drTradedate;

                    for (int i = 0; i < equityTransactionList.Count; i++)
                    {
                        drEquityTransaction = dtEquityTransactions.NewRow();
                        drTradedate         = dtTradeDate.NewRow();

                        equityTransactionVo = new EQTransactionVo();
                        equityTransactionVo = equityTransactionList[i];
                        drEquityTransaction["TransactionId"]   = equityTransactionVo.TransactionId.ToString();
                        drEquityTransaction["TradeAccountNum"] = equityTransactionVo.TradeAccountNum.ToString();
                        drEquityTransaction["Scheme Name"]     = equityTransactionVo.ScripName.ToString();


                        if (equityTransactionVo.TradeType.ToString() == "D")
                        {
                            mode = "Delivery";
                        }
                        else
                        {
                            mode = "Speculation";
                        }
                        if (equityTransactionVo.TransactionCode == 1 || equityTransactionVo.TransactionCode == 2)
                        {
                            drEquityTransaction["Transaction Type"] = equityTransactionVo.TransactionType + "/" + mode;
                        }
                        else
                        {
                            drEquityTransaction["Transaction Type"] = equityTransactionVo.TransactionType;
                        }
                        drEquityTransaction["Transaction Code"] = equityTransactionVo.TransactionCode.ToString();
                        drEquityTransaction["Exchange"]         = equityTransactionVo.Exchange.ToString();
                        drEquityTransaction["TradeDate"]        = DateTime.Parse(equityTransactionVo.TradeDate.ToString());
                        drEquityTransaction["Rate"]             = decimal.Parse(equityTransactionVo.Rate.ToString()).ToString();
                        drEquityTransaction["Quantity"]         = equityTransactionVo.Quantity.ToString("f0");

                        drEquityTransaction["Brokerage"]  = decimal.Parse(equityTransactionVo.Brokerage.ToString());
                        drEquityTransaction["TradeTotal"] = decimal.Parse(equityTransactionVo.TradeTotal.ToString()).ToString();

                        drEquityTransaction["TransactionStatus"]  = equityTransactionVo.TransactionStatus.ToString();
                        drEquityTransaction["ManagerName"]        = equityTransactionVo.ManagerName.ToString();
                        drEquityTransaction["BrokerName"]         = equityTransactionVo.BrokerName.ToString();
                        drEquityTransaction["DematAccountNo"]     = equityTransactionVo.DpclientId.ToString();
                        drEquityTransaction["Purpose"]            = equityTransactionVo.Purpose.ToString();
                        drEquityTransaction["InvestorName"]       = equityTransactionVo.InvestorName.ToString();
                        drEquityTransaction["PanNo"]              = equityTransactionVo.PanNo.ToString();
                        drEquityTransaction["Scripcode"]          = equityTransactionVo.Scripcode.ToString();
                        drEquityTransaction["SettlementNo"]       = equityTransactionVo.SettlementNo.ToString();
                        drEquityTransaction["BillNo"]             = equityTransactionVo.BillNo.ToString();
                        drEquityTransaction["SebiTurnOverFee"]    = equityTransactionVo.SebiTurnOverFee.ToString();
                        drEquityTransaction["TransactionCharges"] = equityTransactionVo.TransactionCharges.ToString();
                        drEquityTransaction["StampCharges"]       = equityTransactionVo.StampCharges.ToString();
                        drEquityTransaction["STT"]                       = equityTransactionVo.STT.ToString();
                        drEquityTransaction["ServiceTax"]                = equityTransactionVo.ServiceTax.ToString();
                        drEquityTransaction["Difference In Amount"]      = equityTransactionVo.DifferenceInBrokerage.ToString();
                        drEquityTransaction["OtherCharges"]              = equityTransactionVo.OtherCharges.ToString();
                        drEquityTransaction["Gross Trade Consideration"] = equityTransactionVo.GrossConsideration.ToString();
                        drEquityTransaction["Net Rate With Brokerage"]   = equityTransactionVo.RateInclBrokerage.ToString();
                        drEquityTransaction["Net Trade Consideration With Brokerage"] = equityTransactionVo.TradeTotalIncBrokerage.ToString();
                        drEquityTransaction["Net Rate With All Charges"] = equityTransactionVo.RateIncBrokerageAllCharges.ToString();
                        if (equityTransactionVo.DividendRecieved == true)
                        {
                            drEquityTransaction["Dividend Status"] = "Received";
                        }
                        else if (equityTransactionVo.DividendRecieved == false)
                        {
                            drEquityTransaction["Dividend Status"] = "Receivable";
                        }
                        drEquityTransaction["Demat Charge"] = equityTransactionVo.DematCharge;
                        drEquityTransaction["FORExRate"]    = equityTransactionVo.ForExRate;

                        drEquityTransaction["FORExRate"] = equityTransactionVo.ForExRate;
                        if (equityTransactionVo.ForExRateDate != DateTime.MinValue)
                        {
                            drEquityTransaction["FORExDate"] = equityTransactionVo.ForExRateDate;
                        }

                        drEquityTransaction["FXCurencyRate"]       = equityTransactionVo.FXCurencyRate;
                        drEquityTransaction["MktClosingForexRate"] = equityTransactionVo.MktClosingForexRate;
                        drEquityTransaction["CET_CreatedOn"]       = DateTime.Parse(equityTransactionVo.CreatedOn.ToString());

                        dtEquityTransactions.Rows.Add(drEquityTransaction);
                    }
                    gvEquityTransactions.DataSource = dtEquityTransactions;

                    ViewState["asd"] = dtEquityTransactions;
                    gvEquityTransactions.DataBind();
                    gvEquityTransactions.Visible = true;
                    if (Visible == 1)
                    {
                        gvEquityTransactions.MasterTableView.GetColumn("action").Visible = false;
                    }
                    Panel1.Visible          = true;
                    trSelectAction.Visible  = true;
                    ddlAction.SelectedIndex = 0;


                    if (!advisorVo.A_IsFamilyOffice)
                    {
                        gvEquityTransactions.MasterTableView.GetColumn("ManagerName").Visible = false;
                        ddlAction.Items[2].Enabled = false;
                        ddlAction.Items[3].Enabled = false;
                        ddlAction.Items[4].Enabled = false;
                    }
                    if (Cache["EquityTransactionsDetails" + customerPortfolioVo.CustomerId.ToString()] == null)
                    {
                        Cache.Insert("EquityTransactionsDetails" + customerPortfolioVo.CustomerId.ToString(), dtEquityTransactions);
                    }
                    else
                    {
                        Cache.Remove("EquityTransactionsDetails" + customerPortfolioVo.CustomerId.ToString());
                        Cache.Insert("EquityTransactionsDetails" + customerPortfolioVo.CustomerId.ToString(), dtEquityTransactions);
                    }
                    imgBtnExport.Visible = true;
                }
                else
                {
                    imgBtnExport.Visible            = false;
                    ErrorMessage.Visible            = true;
                    gvEquityTransactions.DataSource = null;
                    Panel1.Visible = false;
                    gvEquityTransactions.Visible = false;
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "EquityTransactionsView.ascx:BindGridView()");
                object[] objects = new object[2];
                objects[0]   = customerId;
                objects[1]   = equityTransactionList;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }