private void LoadBrokerCode() { ProductEquityBo productEquityBo = new ProductEquityBo(); try { DataTable dt = productEquityBo.GetBrokerCode(portfolioId, ddlTradeAcc.SelectedItem.Text.ToString()); txtBroker.Text = XMLBo.GetBrokerName(path, dt.Rows[0]["XB_BrokerCode"].ToString()); } catch (BaseApplicationException ex) { throw ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "ViewEquityTransaction.ascx:LoadBrokerCode()"); object[] objects = new object[2]; objects[0] = portfolioId; objects[1] = path; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void btnSubmit_Click(object sender, EventArgs e) { decimal temp; DataTable dt; CultureInfo ci = new CultureInfo("en-GB"); try { dt = productEquityBo.GetBrokerCode(portfolioId, ddlTradeAcc.SelectedItem.Text.ToString()); eqTransactionVo.IsSourceManual = 1; if (txtBrokerage.Text != "") { eqTransactionVo.Brokerage = float.Parse(txtBrokerage.Text); } eqTransactionVo.BrokerCode = dt.Rows[0]["XB_BrokerCode"].ToString(); if (ddlTransactionType.SelectedItem.Text.ToString() == "Purchase") { eqTransactionVo.BuySell = "B"; eqTransactionVo.TransactionCode = 1; } if (ddlTransactionType.SelectedItem.Text.ToString() == "Sell") { eqTransactionVo.BuySell = "S"; eqTransactionVo.TransactionCode = 2; } if (ddlTransactionType.SelectedItem.Text.ToString() == "Holdings") { eqTransactionVo.BuySell = "B"; eqTransactionVo.TransactionCode = 13; } eqTransactionVo.CustomerId = customerVo.CustomerId; eqTransactionVo.IsCorpAction = 0; if (rbtnDelivery.Checked) { eqTransactionVo.IsSpeculative = 0; } if (rbtnSpeculation.Checked) { eqTransactionVo.IsSpeculative = 1; } eqTransactionVo.EducationCess = (float)tempEducation; eqTransactionVo.ScripCode = scripCode; if (ddlExchange.SelectedItem.Value.ToString() != "Select an Exchange") { eqTransactionVo.Exchange = ddlExchange.SelectedItem.Value.ToString(); } else { eqTransactionVo.Exchange = "NSE"; } if (txtOtherCharge.Text != "") { eqTransactionVo.OtherCharges = float.Parse(txtOtherCharge.Text); } eqTransactionVo.Quantity = float.Parse(txtNumShares.Text); eqTransactionVo.IsSpeculative = 0; eqTransactionVo.TradeType = "D"; eqTransactionVo.AccountId = int.Parse(ddlTradeAcc.SelectedItem.Value.ToString()); eqTransactionVo.Rate = float.Parse(txtRate.Text); eqTransactionVo.RateInclBrokerage = float.Parse(txtRateIncBrokerage.Text); temp = decimal.Round(Convert.ToDecimal(tempService), 3); if (txtTax.Text != "") { eqTransactionVo.ServiceTax = float.Parse(txtTax.Text); } if (txtSTT.Text != "") { eqTransactionVo.STT = float.Parse(txtSTT.Text); } eqTransactionVo.TradeDate = Convert.ToDateTime(txtTradeDate.Text.Trim(), ci);// DateTime.Parse(txtTradeDate.Text);//ddlDay.SelectedItem.Text.ToString() + "/" + ddlMonth.SelectedItem.Value.ToString() + "/" + ddlYear.SelectedItem.Value.ToString() eqTransactionVo.TradeTotal = float.Parse(txtTotal.Text); eqTransactionVo.TradeNum = 0; if (customerTransactionBo.AddEquityTransaction(eqTransactionVo, customerVo.UserId)) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "EQ", eqTransactionVo.TradeDate); } List <EQPortfolioVo> eqPortfolioVoList = new List <EQPortfolioVo>(); Dictionary <string, DateTime> genDict = new Dictionary <string, DateTime>(); DateTime tradeDate = new DateTime(); if (Session["ValuationDate"] != null) { genDict = (Dictionary <string, DateTime>)Session["ValuationDate"]; tradeDate = DateTime.Parse(genDict["EQDate"].ToString()); } if (tradeDate == DateTime.MinValue) { tradeDate = DateTime.Today; } eqPortfolioVoList = customerPortfolioBo.GetCustomerEquityPortfolio(customerVo.CustomerId, portfolioId, tradeDate, txtScrip.Text, ddlTradeAcc.SelectedItem.Value.ToString()); if (eqPortfolioVoList != null && eqPortfolioVoList.Count > 0) { customerPortfolioBo.DeleteEquityNetPosition(eqPortfolioVoList[0].EQCode, eqPortfolioVoList[0].AccountId, tradeDate); customerPortfolioBo.AddEquityNetPosition(eqPortfolioVoList[0], userVo.UserId); } btnSubmit.Enabled = false; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('EquityTransactionsView','none');", true); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "EquityManualSingleTransaction.ascx:btnSubmit_Click()"); object[] objects = new object[3]; objects[0] = portfolioId;; objects[1] = eqTransactionVo; objects[2] = customerVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void btnSubmit_Click(object sender, EventArgs e) { EQTransactionVo newEqTransactionVo = new EQTransactionVo(); decimal temp = 0; try { newEqTransactionVo.TransactionId = eqTransactionVo.TransactionId; newEqTransactionVo.IsSourceManual = eqTransactionVo.IsSourceManual; DataTable dt = productEqutiyBo.GetBrokerCode(portfolioId, ddlTradeAcc.SelectedItem.Text.ToString()); if (txtBrokerage.Text != "") { newEqTransactionVo.Brokerage = float.Parse(txtBrokerage.Text); } newEqTransactionVo.BrokerCode = dt.Rows[0]["XB_BrokerCode"].ToString(); if (ddlTranType.SelectedItem.Text.ToString() == "Purchase") { newEqTransactionVo.BuySell = "B"; newEqTransactionVo.TransactionCode = 1; } if (ddlTranType.SelectedItem.Text.ToString() == "Sell") { newEqTransactionVo.BuySell = "S"; newEqTransactionVo.TransactionCode = 2; } if (ddlTranType.SelectedItem.Text.ToString() == "Holdings") { newEqTransactionVo.BuySell = "B"; newEqTransactionVo.TransactionCode = 13; } newEqTransactionVo.CustomerId = customerVo.CustomerId; newEqTransactionVo.IsCorpAction = 0; newEqTransactionVo.EducationCess = (float)tempEducation; DataSet ds = productEqutiyBo.GetScripCode(txtScrip.Text.ToString()); txtTicker.Text = ds.Tables[0].Rows[0]["PEM_Ticker"].ToString(); scripCode = int.Parse(ds.Tables[0].Rows[0]["PEM_ScripCode"].ToString()); newEqTransactionVo.TradeAccountNum = ""; //long.Parse(ddlTradeAcc.SelectedItem.Text.ToString()); newEqTransactionVo.AccountId = int.Parse(ddlTradeAcc.SelectedValue.ToString()); newEqTransactionVo.ScripCode = scripCode; if (ddlExchange.SelectedItem.Value != "Select an Exchange") { newEqTransactionVo.Exchange = ddlExchange.SelectedItem.Value.ToString(); } else { newEqTransactionVo.Exchange = "NSE"; } if (txtOtherCharge.Text != "") { newEqTransactionVo.OtherCharges = float.Parse(txtOtherCharge.Text); } newEqTransactionVo.Quantity = float.Parse(txtNumShares.Text); newEqTransactionVo.IsSpeculative = 0; newEqTransactionVo.TradeType = "D"; newEqTransactionVo.AccountId = int.Parse(ddlTradeAcc.SelectedItem.Value.ToString()); newEqTransactionVo.Rate = float.Parse(txtRate.Text); newEqTransactionVo.RateInclBrokerage = float.Parse(txtRateIncBrokerage.Text); temp = decimal.Round(Convert.ToDecimal(tempService), 3); if (txtTax.Text != "") { newEqTransactionVo.ServiceTax = float.Parse(txtTax.Text); } if (txtSTT.Text != "") { newEqTransactionVo.STT = float.Parse(txtSTT.Text); } newEqTransactionVo.TradeDate = DateTime.Parse(txtTradeDate.Text); newEqTransactionVo.TradeTotal = float.Parse(txtTotal.Text); customerTransactionBo.UpdateEquityTransaction(newEqTransactionVo, userVo.UserId); btnSubmit.Enabled = false; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "leftpane", "loadcontrol('EquityTransactionsView','none');", true); //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('EquityTransactionsView','none');", true); } catch (BaseApplicationException ex) { throw ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "ViewEquityTransaction.ascx:btnSubmit_Click()"); object[] objects = new object[2]; objects[0] = newEqTransactionVo; objects[1] = userVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }