private void SetSystematicTransactions() { CustomerTransactionBo customerTransactionBo = new CustomerTransactionBo(); mfSystematicTransactionReportVoList = new List <MFSystematicTransactionReportVo>(); List <string> transactionTypeList = new List <string>(); DateTime fromDate = new DateTime(); DateTime toDate = new DateTime(); DateBo dateBo = new DateBo(); string customerNameSearch = ""; string schemeNameSearch = ""; string transType = ""; string portfolioType = ""; string viewType = ""; systematicTotalAmount = 0; originalAmountTotal = 0; portfolioType = ddlGroupPortfolioGroup.SelectedValue.ToString(); viewType = ddlViewType.SelectedValue.ToString(); if (gvSystematicTransactions.HeaderRow != null) { customerNameSearch = ((TextBox)gvSystematicTransactions.HeaderRow.FindControl("txtCustomerSearch")).Text; schemeNameSearch = ((TextBox)gvSystematicTransactions.HeaderRow.FindControl("txtSchemeSearch")).Text; transType = ((DropDownList)gvSystematicTransactions.HeaderRow.FindControl("ddlTranType")).SelectedValue.ToString(); if (transType == "Select") { transType = ""; } } //if ((TextBox)gvSystematicTransactions.HeaderRow.FindControl("txtSchemeSearch") != null) //{ //} //if ((DropDownList)gvSystematicTransactions.HeaderRow.FindControl("ddlTranType") != null) //{ //} if (rbtnPickDate.Checked) { fromDate = DateTime.Parse(txtFromDate.Text.Trim()); toDate = DateTime.Parse(txtToDate.Text.Trim()); } else { dateBo.CalculateFromToDatesUsingPeriod(ddlPeriod.SelectedValue, out fromDate, out toDate); } int adviserId = ((AdvisorVo)Session["advisorVo"]).advisorId; mfSystematicTransactionReportVoList = customerTransactionBo.GetMFSystematicTransactionsReport(adviserId, fromDate, toDate, customerNameSearch, schemeNameSearch, transType, portfolioType, out transactionTypeList); ViewState["SystematicTransactionVoList"] = mfSystematicTransactionReportVoList; DataTable dtSystematicTransactionReport = new DataTable(); DataRow drSystematicTransactionReport; dtSystematicTransactionReport.Columns.Add("CustomerName"); dtSystematicTransactionReport.Columns.Add("Folio"); dtSystematicTransactionReport.Columns.Add("Scheme"); dtSystematicTransactionReport.Columns.Add("SystematicType"); dtSystematicTransactionReport.Columns.Add("SystematicAmount"); dtSystematicTransactionReport.Columns.Add("SystematicDate"); dtSystematicTransactionReport.Columns.Add("ActualAmount"); dtSystematicTransactionReport.Columns.Add("ActualDate"); dtSystematicTransactionReport.Columns.Add("RowId"); if (mfSystematicTransactionReportVoList != null && mfSystematicTransactionReportVoList.Count != 0) { for (int i = 0; i < mfSystematicTransactionReportVoList.Count; i++) { if (viewType == "ALL") { drSystematicTransactionReport = dtSystematicTransactionReport.NewRow(); drSystematicTransactionReport[0] = mfSystematicTransactionReportVoList[i].CustomerName; drSystematicTransactionReport[1] = mfSystematicTransactionReportVoList[i].FolioNum; drSystematicTransactionReport[2] = mfSystematicTransactionReportVoList[i].SchemePlanName; if (mfSystematicTransactionReportVoList[i].SystematicTransacionType != null && mfSystematicTransactionReportVoList[i].SystematicTransacionType != "") { drSystematicTransactionReport[3] = mfSystematicTransactionReportVoList[i].SystematicTransacionType; } else { drSystematicTransactionReport[3] = mfSystematicTransactionReportVoList[i].OriginalTransactionType; } if (mfSystematicTransactionReportVoList[i].SystematicAmount != 0) { drSystematicTransactionReport[4] = mfSystematicTransactionReportVoList[i].SystematicAmount.ToString("f2"); } else { drSystematicTransactionReport[4] = "-"; } if (mfSystematicTransactionReportVoList[i].SystematicTransactionDate != null && mfSystematicTransactionReportVoList[i].SystematicTransactionDate != DateTime.MinValue) { drSystematicTransactionReport[5] = mfSystematicTransactionReportVoList[i].SystematicTransactionDate.ToShortDateString(); } else { drSystematicTransactionReport[5] = "-"; } if (mfSystematicTransactionReportVoList[i].OriginalTransactionAmount != 0) { drSystematicTransactionReport[6] = mfSystematicTransactionReportVoList[i].OriginalTransactionAmount.ToString("f2"); } else { drSystematicTransactionReport[6] = "-"; } if (mfSystematicTransactionReportVoList[i].OriginalTransactionDate != null && mfSystematicTransactionReportVoList[i].OriginalTransactionDate != DateTime.MinValue) { drSystematicTransactionReport[7] = mfSystematicTransactionReportVoList[i].OriginalTransactionDate.ToShortDateString(); } else { drSystematicTransactionReport[7] = "-"; } drSystematicTransactionReport[8] = i; dtSystematicTransactionReport.Rows.Add(drSystematicTransactionReport); systematicTotalAmount = systematicTotalAmount + mfSystematicTransactionReportVoList[i].SystematicAmount; originalAmountTotal = originalAmountTotal + mfSystematicTransactionReportVoList[i].OriginalTransactionAmount; } else if (viewType == "NAT" && (mfSystematicTransactionReportVoList[i].OriginalTransactionDate == DateTime.MinValue || mfSystematicTransactionReportVoList[i].OriginalTransactionDate == null) && (mfSystematicTransactionReportVoList[i].OriginalTransactionType == "" || mfSystematicTransactionReportVoList[i].OriginalTransactionType == null)) { drSystematicTransactionReport = dtSystematicTransactionReport.NewRow(); drSystematicTransactionReport[0] = mfSystematicTransactionReportVoList[i].CustomerName; drSystematicTransactionReport[1] = mfSystematicTransactionReportVoList[i].FolioNum; drSystematicTransactionReport[2] = mfSystematicTransactionReportVoList[i].SchemePlanName; if (mfSystematicTransactionReportVoList[i].SystematicTransacionType != null && mfSystematicTransactionReportVoList[i].SystematicTransacionType != "") { drSystematicTransactionReport[3] = mfSystematicTransactionReportVoList[i].SystematicTransacionType; } else { drSystematicTransactionReport[3] = mfSystematicTransactionReportVoList[i].OriginalTransactionType; } if (mfSystematicTransactionReportVoList[i].SystematicAmount != 0) { drSystematicTransactionReport[4] = mfSystematicTransactionReportVoList[i].SystematicAmount.ToString("f2"); } else { drSystematicTransactionReport[4] = "-"; } if (mfSystematicTransactionReportVoList[i].SystematicTransactionDate != null && mfSystematicTransactionReportVoList[i].SystematicTransactionDate != DateTime.MinValue) { drSystematicTransactionReport[5] = mfSystematicTransactionReportVoList[i].SystematicTransactionDate.ToShortDateString(); } else { drSystematicTransactionReport[5] = "-"; } if (mfSystematicTransactionReportVoList[i].OriginalTransactionAmount != 0) { drSystematicTransactionReport[6] = mfSystematicTransactionReportVoList[i].OriginalTransactionAmount.ToString("f2"); } else { drSystematicTransactionReport[6] = "-"; } if (mfSystematicTransactionReportVoList[i].OriginalTransactionDate != null && mfSystematicTransactionReportVoList[i].OriginalTransactionDate != DateTime.MinValue) { drSystematicTransactionReport[7] = mfSystematicTransactionReportVoList[i].OriginalTransactionDate.ToShortDateString(); } else { drSystematicTransactionReport[7] = "-"; } drSystematicTransactionReport[8] = i; dtSystematicTransactionReport.Rows.Add(drSystematicTransactionReport); systematicTotalAmount = systematicTotalAmount + mfSystematicTransactionReportVoList[i].SystematicAmount; originalAmountTotal = originalAmountTotal + mfSystematicTransactionReportVoList[i].OriginalTransactionAmount; } else if (viewType == "NST" && (mfSystematicTransactionReportVoList[i].SystematicTransacionType == "" || mfSystematicTransactionReportVoList[i].SystematicTransacionType == null) && mfSystematicTransactionReportVoList[i].SystematicAmount == 0) { drSystematicTransactionReport = dtSystematicTransactionReport.NewRow(); drSystematicTransactionReport[0] = mfSystematicTransactionReportVoList[i].CustomerName; drSystematicTransactionReport[1] = mfSystematicTransactionReportVoList[i].FolioNum; drSystematicTransactionReport[2] = mfSystematicTransactionReportVoList[i].SchemePlanName; if (mfSystematicTransactionReportVoList[i].SystematicTransacionType != null && mfSystematicTransactionReportVoList[i].SystematicTransacionType != "") { drSystematicTransactionReport[3] = mfSystematicTransactionReportVoList[i].SystematicTransacionType; } else { drSystematicTransactionReport[3] = mfSystematicTransactionReportVoList[i].OriginalTransactionType; } if (mfSystematicTransactionReportVoList[i].SystematicAmount != 0) { drSystematicTransactionReport[4] = mfSystematicTransactionReportVoList[i].SystematicAmount.ToString("f2"); } else { drSystematicTransactionReport[4] = "-"; } if (mfSystematicTransactionReportVoList[i].SystematicTransactionDate != null && mfSystematicTransactionReportVoList[i].SystematicTransactionDate != DateTime.MinValue) { drSystematicTransactionReport[5] = mfSystematicTransactionReportVoList[i].SystematicTransactionDate.ToShortDateString(); } else { drSystematicTransactionReport[5] = "-"; } if (mfSystematicTransactionReportVoList[i].OriginalTransactionAmount != 0) { drSystematicTransactionReport[6] = mfSystematicTransactionReportVoList[i].OriginalTransactionAmount.ToString("f2"); } else { drSystematicTransactionReport[6] = "-"; } if (mfSystematicTransactionReportVoList[i].OriginalTransactionDate != null && mfSystematicTransactionReportVoList[i].OriginalTransactionDate != DateTime.MinValue) { drSystematicTransactionReport[7] = mfSystematicTransactionReportVoList[i].OriginalTransactionDate.ToShortDateString(); } else { drSystematicTransactionReport[7] = "-"; } drSystematicTransactionReport[8] = i; dtSystematicTransactionReport.Rows.Add(drSystematicTransactionReport); systematicTotalAmount = systematicTotalAmount + mfSystematicTransactionReportVoList[i].SystematicAmount; originalAmountTotal = originalAmountTotal + mfSystematicTransactionReportVoList[i].OriginalTransactionAmount; } } if (dtSystematicTransactionReport.Rows.Count != 0) { gvSystematicTransactions.DataSource = dtSystematicTransactionReport; gvSystematicTransactions.DataBind(); gvSystematicTransactions.Visible = true; pnlSystematicTransactions.Visible = true; BindGridSearchBoxes(transactionTypeList, transType, customerNameSearch, schemeNameSearch); } else { drSystematicTransactionReport = dtSystematicTransactionReport.NewRow(); drSystematicTransactionReport[0] = ""; drSystematicTransactionReport[1] = ""; drSystematicTransactionReport[2] = ""; drSystematicTransactionReport[3] = ""; drSystematicTransactionReport[4] = ""; drSystematicTransactionReport[5] = ""; drSystematicTransactionReport[6] = ""; drSystematicTransactionReport[7] = ""; drSystematicTransactionReport[8] = ""; dtSystematicTransactionReport.Rows.Add(drSystematicTransactionReport); gvSystematicTransactions.DataSource = dtSystematicTransactionReport; gvSystematicTransactions.DataBind(); gvSystematicTransactions.Visible = true; pnlSystematicTransactions.Visible = true; BindGridSearchBoxes(transactionTypeList, transType, customerNameSearch, schemeNameSearch); trErrorMessage.Visible = true; } } else { drSystematicTransactionReport = dtSystematicTransactionReport.NewRow(); drSystematicTransactionReport[0] = ""; drSystematicTransactionReport[1] = ""; drSystematicTransactionReport[2] = ""; drSystematicTransactionReport[3] = ""; drSystematicTransactionReport[4] = ""; drSystematicTransactionReport[5] = ""; drSystematicTransactionReport[6] = ""; drSystematicTransactionReport[7] = ""; dtSystematicTransactionReport.Rows.Add(drSystematicTransactionReport); gvSystematicTransactions.DataSource = dtSystematicTransactionReport; gvSystematicTransactions.DataBind(); gvSystematicTransactions.Visible = true; pnlSystematicTransactions.Visible = true; BindGridSearchBoxes(transactionTypeList, transType, customerNameSearch, schemeNameSearch); trErrorMessage.Visible = true; } }