protected void btnSubmit_Click(object sender, EventArgs e) { try { if (txtSearchScheme.Text != "" && lblScheme.Text == txtSearchScheme.Text) { mfTransactionVo.CustomerId = customerVo.CustomerId; //mfTransactionVo.AccountId = "acc1"; mfTransactionVo.AccountId = int.Parse(ddlFolioNum.SelectedItem.Value.ToString()); mfTransactionVo.MFCode = int.Parse(txtSchemeCode.Value); mfTransactionVo.FinancialFlag = 1; mfTransactionVo.TransactionDate = DateTime.Parse(txtTransactionDate.Text);//ddlTransactionDateDay.SelectedItem.Value + "/" + ddlTransactionDateMonth.SelectedItem.Value + "/" + ddlTransactionDateYear.SelectedItem.Value mfTransactionVo.Source = "WP"; mfTransactionVo.IsSourceManual = 1; if (ddlTransactionType.SelectedItem.Value == "Buy") { mfTransactionVo.NAV = float.Parse(txtNAV.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPrice.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmount.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "BUY"; mfTransactionVo.BuySell = "B"; if (customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } } if (ddlTransactionType.SelectedItem.Value == "Holdings") { mfTransactionVo.NAV = float.Parse(txtNAV.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPrice.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmount.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "HLD"; mfTransactionVo.BuySell = "B"; if (customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } } if (ddlTransactionType.SelectedItem.Value == "Sell") { mfTransactionVo.NAV = float.Parse(txtNAV.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPrice.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmount.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.STT = float.Parse(txtSTT.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "SEL"; mfTransactionVo.BuySell = "S"; if (customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } } if (ddlTransactionType.SelectedItem.Value == "Dividend Reinvestment") { if (txtDividentRate.Text != string.Empty || txtDividentRate.Text != "") { mfTransactionVo.DividendRate = float.Parse(txtDividentRate.Text.ToString()); } mfTransactionVo.NAV = float.Parse(txtNAV.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPrice.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmount.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "DVR"; mfTransactionVo.BuySell = "B"; if (customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } } if (ddlTransactionType.SelectedItem.Value == "SIP") { //mfTransactionVo.DividendRate = float.Parse(txtDividentRate.Text.ToString()); mfTransactionVo.NAV = float.Parse(txtNAV.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPrice.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmount.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "SIP"; mfTransactionVo.BuySell = "B"; if (customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } } if (ddlTransactionType.SelectedItem.Value == "SWP") { //mfTransactionVo.DividendRate = float.Parse(txtDividentRate.Text.ToString()); mfTransactionVo.NAV = float.Parse(txtNAV.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPrice.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmount.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.STT = float.Parse(txtSTT.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "SWP"; mfTransactionVo.BuySell = "S"; if (customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } } if (ddlTransactionType.SelectedItem.Value == "STP") { mfTransactionVo.NAV = float.Parse(txtNAV.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPrice.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmount.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.STT = float.Parse(txtSTT.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "STS"; mfTransactionVo.BuySell = "S"; if ((transactionId = customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId)) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } mfTransactionVo.MFCode = int.Parse(txtSwitchSchemeCode.Value); mfTransactionVo.NAV = float.Parse(txtNAVPurchased.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPricePurchased.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmtPurchased.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnitsAlloted.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "STB"; mfTransactionVo.SwitchSourceTrxId = transactionId; //mfTransactionVo.TransactionId = customerBo.GenerateId(); mfTransactionVo.BuySell = "B"; if (customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } } if (ddlTransactionType.SelectedItem.Value == "Dividend Payout") { if (txtDividentRate.Text != string.Empty || txtDividentRate.Text != "") { mfTransactionVo.DividendRate = float.Parse(txtDividentRate.Text.ToString()); } mfTransactionVo.NAV = float.Parse(txtNAV.Text.ToString()); //mfTransactionVo.Price = float.Parse(txtPrice.Text.ToString()); mfTransactionVo.Price = 0; mfTransactionVo.Amount = float.Parse(txtAmount.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "DVP"; mfTransactionVo.BuySell = "S"; if (customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } } if (ddlTransactionType.SelectedItem.Value == "Switch") { mfTransactionVo.NAV = float.Parse(txtNAV.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPrice.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmount.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.STT = float.Parse(txtSTT.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "SWS"; mfTransactionVo.BuySell = "S"; if ((transactionId = customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId)) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } // transactionId = customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId); mfTransactionVo.MFCode = int.Parse(txtSwitchSchemeCode.Value); mfTransactionVo.NAV = float.Parse(txtNAVPurchased.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPricePurchased.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmtPurchased.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnitsAlloted.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "SWB"; mfTransactionVo.SwitchSourceTrxId = transactionId; //mfTransactionVo.TransactionId = customerBo.GenerateId(); mfTransactionVo.BuySell = "B"; if (customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId) != 0) { customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "MF", mfTransactionVo.TransactionDate); } } List <MFPortfolioVo> mfPortfolioVoList = new List <MFPortfolioVo>(); 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["MFDate"].ToString()); } if (tradeDate == DateTime.MinValue) { tradeDate = DateTime.Today; } mfPortfolioVoList = customerPortfolioBo.GetCustomerMFPortfolio(customerVo.CustomerId, portfolioId, tradeDate, lblScheme.Text, ddlFolioNum.SelectedItem.Text, ""); if (mfPortfolioVoList != null && mfPortfolioVoList.Count > 0) { customerPortfolioBo.DeleteMutualFundNetPosition(mfPortfolioVoList[0].MFCode, mfPortfolioVoList[0].AccountId, tradeDate); customerPortfolioBo.AddMutualFundNetPosition(mfPortfolioVoList[0], userVo.UserId); } //ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "leftpane", "loadcontrol('TransactionsView','none');", true); //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('TransactionsView','none');", true); msgRecordStatus.Visible = true; cleanAllFields(); //Response.Redirect("ControlHost.aspx?pageid=TransactionsView", false); } else { //msgRecordStatus.InnerText = "Adding records is not successfull"; //msgRecordStatus.Style.Add("background", "Red"); RequiredFieldValidator3.ErrorMessage = "Please Select Proper Scheme Name"; RequiredFieldValidator3.IsValid = false; } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "MFManualSingleTran.ascx:btnSubmit_Click()"); object[] objects = new object[2]; objects[0] = mfTransactionVo; objects[1] = customerVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void btnAdd_Click(object sender, EventArgs e) { customerVo = (CustomerVo)Session["CustomerVo"]; //mfTransactionVo.TransactionId = customerBo.GenerateId(); mfTransactionVo.CustomerId = customerVo.CustomerId; //mfTransactionVo.AccountId = "acc1"; mfTransactionVo.MFCode = int.Parse(txtSearchName.Text.ToString()); //mfTransactionVo.FinancialFlag = "F"; mfTransactionVo.TransactionDate = DateTime.Parse(ddlTransactionDateDay.SelectedItem.Value + "/" + ddlTransactionDateMonth.SelectedItem.Value + "/" + ddlTransactionDateYear.SelectedItem.Value); mfTransactionVo.Source = "MP"; mfTransactionVo.IsSourceManual = 1; mfTransactionVo.NAV = float.Parse(txtNAV.Text.ToString()); mfTransactionVo.Price = float.Parse(txtPrice.Text.ToString()); mfTransactionVo.Amount = float.Parse(txtAmount.Text.ToString()); if (ddlTransactionType.SelectedItem.Value == "Buy") { mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "BUY"; //mfTransactionVo.SwitchSourceTrxId = ""; mfTransactionVo.BuySell = "B"; } if (ddlTransactionType.SelectedItem.Value == "Sell") { mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.STT = float.Parse(txtSTT.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "SEL"; //mfTransactionVo.SwitchSourceTrxId = ""; mfTransactionVo.BuySell = "S"; } if (ddlTransactionType.SelectedItem.Value == "Divident Reinvestment") { mfTransactionVo.DividendRate = float.Parse(txtDividentRate.Text.ToString()); mfTransactionVo.Units = float.Parse(txtUnits.Text.ToString()); mfTransactionVo.TransactionClassificationCode = "DVR"; //mfTransactionVo.SwitchSourceTrxId = ""; mfTransactionVo.BuySell = "B"; } if (ddlTransactionType.SelectedItem.Value == "Divident Payout") { mfTransactionVo.DividendRate = float.Parse(txtDividentRate.Text.ToString()); mfTransactionVo.TransactionType = "Divident Payout"; mfTransactionVo.TransactionClassificationCode = "DVP"; //mfTransactionVo.SwitchSourceTrxId = ""; mfTransactionVo.BuySell = "S"; } customerTransactionBo.AddMFTransaction(mfTransactionVo, customerVo.UserId); DataTable tempDt = (DataTable)Session["MFTable"]; dr = tempDt.NewRow(); dr["Scheme Name"] = txtSearchName.Text.ToString(); dr["Transaction Type"] = ddlTransactionType.SelectedItem.Value.ToString(); dr["Divident Rate"] = txtDividentRate.Text.ToString(); dr["Transaction Date"] = ddlTransactionDateDay.SelectedItem.Value + "/" + ddlTransactionDateMonth.SelectedItem.Value + "/" + ddlTransactionDateYear.SelectedItem.Value; dr["NAV"] = txtNAV.Text.ToString(); dr["Price"] = txtPrice.Text.ToString(); dr["Amount"] = txtAmount.Text.ToString(); dr["Units"] = txtUnits.Text.ToString(); dr["STT"] = txtSTT.Text.ToString(); tempDt.Rows.Add(dr); gvMFTransactions.DataSource = tempDt; gvMFTransactions.DataBind(); gvMFTransactions.Visible = true; divTransaction.Visible = false; }