protected void ddlPeriod_SelectedIndexChanged(object sender, EventArgs e) { DateTime dtFrom = new DateTime(); DateTime dtTo = new DateTime(); DateBo dtBo = new DateBo(); if (ddlPeriod.SelectedIndex != 0) { dtBo.CalculateFromToDatesUsingPeriod(ddlPeriod.SelectedValue, out dtFrom, out dtTo); this.BindGrid(dtFrom, dtTo); } else { } }
private void CalculateDateRange() { if (rbtnPickDate.Checked) { convertedFromDate = Convert.ToDateTime(txtFromDate.Text.Trim()); convertedToDate = Convert.ToDateTime(txtToDate.Text.Trim()); } else { if (ddlPeriod.SelectedIndex != 0) { dtBo.CalculateFromToDatesUsingPeriod(ddlPeriod.SelectedValue, out dtFrom, out dtTo); convertedFromDate = dtFrom; convertedToDate = dtTo; } } }
private void CalculateDateRange(out DateTime fromDate, out DateTime toDate) { if (rbtnPickDate.Checked == true) { fromDate = DateTime.Parse(txtFromDate.Text); toDate = DateTime.Parse(txtToDate.Text); } else if (rbtnPickPeriod.Checked == true) { dtBo.CalculateFromToDatesUsingPeriod(ddlPeriod.SelectedValue.ToString(), out dtFrom, out dtTo); fromDate = dtFrom; toDate = dtTo; } else { fromDate = DateTime.MinValue; toDate = DateTime.MinValue; } }
/// <summary> /// Get the From and To Date of reports /// </summary> private void CalculateDateRange(out DateTime fromDate, out DateTime toDate) { if (hidDateType.Value.ToString() == "DATE_RANGE") { fromDate = DateTime.Parse(txtFromDate.Text); toDate = DateTime.Parse(txtToDate.Text); } else if (hidDateType.Value.ToString() == "PERIOD") { dtBo.CalculateFromToDatesUsingPeriod(ddlPeriod.SelectedValue.ToString(), out dtFrom, out dtTo); fromDate = dtFrom; toDate = dtTo; } else { fromDate = DateTime.MinValue; toDate = DateTime.MinValue; } }
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; } }
private void SetParameters() { if (userType == "advisor") { if (ddlBranchForEQ.SelectedIndex == 0 && ddlRMEQ.SelectedIndex == 0) { hdnadviserId.Value = advisorVo.advisorId.ToString(); hdnAll.Value = "0"; hdnbranchId.Value = "0"; hdnrmId.Value = "0"; } else if ((ddlBranchForEQ.SelectedIndex != 0) && (ddlRMEQ.SelectedIndex == 0)) { hdnadviserId.Value = advisorVo.advisorId.ToString(); hdnbranchId.Value = ddlBranchForEQ.SelectedValue; hdnAll.Value = "1"; hdnrmId.Value = "0"; } else if (ddlBranchForEQ.SelectedIndex == 0 && ddlRMEQ.SelectedIndex != 0) { hdnadviserId.Value = advisorVo.advisorId.ToString(); hdnbranchId.Value = "0"; hdnAll.Value = "2"; hdnrmId.Value = ddlRMEQ.SelectedValue;; } else if (ddlBranchForEQ.SelectedIndex != 0 && ddlRMEQ.SelectedIndex != 0) { hdnadviserId.Value = advisorVo.advisorId.ToString(); hdnbranchId.Value = ddlBranchForEQ.SelectedValue; hdnrmId.Value = ddlRMEQ.SelectedValue; hdnAll.Value = "3"; } } else if (userType == "rm") { hdnrmId.Value = rmVo.RMId.ToString(); hdnAll.Value = "0"; } else if (userType == "bm") { if (ddlBranchForEQ.SelectedIndex == 0 && ddlRMEQ.SelectedIndex == 0) { hdnbranchHeadId.Value = bmID.ToString(); hdnAll.Value = "0"; hdnrmId.Value = "0"; } else if ((ddlBranchForEQ.SelectedIndex != 0) && (ddlRMEQ.SelectedIndex == 0)) { hdnbranchHeadId.Value = bmID.ToString(); hdnbranchId.Value = ddlBranchForEQ.SelectedValue; hdnAll.Value = "1"; hdnrmId.Value = "0"; } else if (ddlBranchForEQ.SelectedIndex == 0 && ddlRMEQ.SelectedIndex != 0) { hdnbranchHeadId.Value = bmID.ToString(); hdnbranchId.Value = "0"; hdnAll.Value = "2"; hdnrmId.Value = ddlRMEQ.SelectedValue;; } else if (ddlBranchForEQ.SelectedIndex != 0 && ddlRMEQ.SelectedIndex != 0) { hdnbranchHeadId.Value = bmID.ToString(); hdnbranchId.Value = ddlBranchForEQ.SelectedValue; hdnrmId.Value = ddlRMEQ.SelectedValue; hdnAll.Value = "3"; } } if (hdnbranchHeadId.Value == "") { hdnbranchHeadId.Value = "0"; } if (hdnbranchId.Value == "") { hdnbranchId.Value = "0"; } if (hdnadviserId.Value == "") { hdnadviserId.Value = "0"; } if (hdnrmId.Value == "") { hdnrmId.Value = "0"; } if (rbtnPickDate.Checked) { hdnFromDate.Value = txtFromDate.SelectedDate.ToString(); hdnToDate.Value = txtToDate.SelectedDate.ToString(); } else { if (ddlPeriod.SelectedIndex != 0) { dtBo.CalculateFromToDatesUsingPeriod(ddlPeriod.SelectedValue, out dtFrom, out dtTo); hdnFromDate.Value = dtFrom.ToShortDateString(); hdnToDate.Value = dtTo.ToShortDateString(); } } }
protected void btnGo_Click(object sender, EventArgs e) { if (rbtnPickPeriod.Checked) { if (ddlPeriod.SelectedIndex != 0) { dtBo.CalculateFromToDatesUsingPeriod(ddlPeriod.SelectedValue, out dtFrom, out dtTo); } } if (rbtnPickDate.Checked) { if (txtFromDate.Text != null && txtFromDate.Text != "") { convertedFromDate = Convert.ToDateTime(txtFromDate.Text.Trim(), ci); } else { convertedFromDate = DateTime.MinValue; } if (txtToDate.Text != null && txtToDate.Text != "") { convertedToDate = Convert.ToDateTime(txtToDate.Text.Trim(), ci); } else { convertedToDate = DateTime.MinValue; } } /* For BM Branch wise MIS */ if (userType == "adviser" || userType == "ops") { //dsMfMIS = adviserMFMIS.GetMFMISAdviser(advisorVo.advisorId, branchId, rmId, convertedFromDate, convertedToDate); //if (dsMfMIS.Tables[0].Rows.Count > 0) //{ // this.BindGrid(convertedFromDate, convertedToDate); //} if ((ddlBranch.SelectedIndex == 0) && (ddlRM.SelectedIndex == 0)) { hdnbranchId.Value = "0"; hdnall.Value = "0"; hdnrmId.Value = "0"; if (rbtnPickPeriod.Checked) { this.BindGrid(dtFrom, dtTo); } else { this.BindGrid(convertedFromDate, convertedToDate); } } else if ((ddlBranch.SelectedIndex != 0) && (ddlRM.SelectedIndex == 0)) { hdnbranchId.Value = ddlBranch.SelectedValue; hdnall.Value = "1"; hdnrmId.Value = "0"; if (rbtnPickPeriod.Checked) { this.BindGrid(dtFrom, dtTo); } else { this.BindGrid(convertedFromDate, convertedToDate); } } else if ((ddlBranch.SelectedIndex == 0) && (ddlRM.SelectedIndex != 0)) { hdnbranchId.Value = "0"; hdnall.Value = "2"; hdnrmId.Value = ddlRM.SelectedValue; if (rbtnPickPeriod.Checked) { this.BindGrid(dtFrom, dtTo); } else { this.BindGrid(convertedFromDate, convertedToDate); } } else if ((ddlBranch.SelectedIndex != 0) && (ddlRM.SelectedIndex != 0)) { hdnbranchId.Value = ddlBranch.SelectedValue; hdnall.Value = "3"; hdnrmId.Value = ddlRM.SelectedValue; if (rbtnPickPeriod.Checked) { this.BindGrid(dtFrom, dtTo); } else { this.BindGrid(convertedFromDate, convertedToDate); } } } else if (userType == "bm") { if ((ddlBranch.SelectedIndex == 0) && (ddlRM.SelectedIndex == 0)) { hdnbranchId.Value = "0"; hdnbranchHeadId.Value = bmID.ToString(); hdnall.Value = "2"; hdnrmId.Value = "0"; //dsMfMIS = adviserMFMIS.GetMFMIS(userType, ID, dtFrom, dtTo, 0, 0, int.Parse(hdnbranchHeadId.Value.ToString()), 2); if (rbtnPickPeriod.Checked) { this.BindGrid(dtFrom, dtTo); } else { this.BindGrid(convertedFromDate, convertedToDate); } } else if ((ddlBranch.SelectedIndex == 0) && (ddlRM.SelectedIndex != 0)) { hdnbranchId.Value = "0"; hdnbranchHeadId.Value = bmID.ToString(); hdnall.Value = "3"; hdnrmId.Value = ddlRM.SelectedValue; //dsMfMIS = adviserMFMIS.GetMFMIS(userType, ID, dtFrom, dtTo, int.Parse(hdnrmId.Value.ToString()), 0, int.Parse(hdnbranchHeadId.Value.ToString()), 3); if (rbtnPickPeriod.Checked) { this.BindGrid(dtFrom, dtTo); } else { this.BindGrid(convertedFromDate, convertedToDate); } } else if ((ddlBranch.SelectedIndex != 0) && (ddlRM.SelectedIndex == 0)) { hdnbranchId.Value = ddlBranch.SelectedValue; hdnbranchHeadId.Value = bmID.ToString(); hdnall.Value = "1"; //dsMfMIS = adviserMFMIS.GetMFMIS(userType, ID, dtFrom, dtTo, 0, int.Parse(hdnbranchId.Value.ToString()), 0, 1); if (rbtnPickPeriod.Checked) { this.BindGrid(dtFrom, dtTo); } else { this.BindGrid(convertedFromDate, convertedToDate); } } else if ((ddlBranch.SelectedIndex != 0) && (ddlRM.SelectedIndex != 0)) { hdnbranchId.Value = ddlBranch.SelectedValue; hdnbranchHeadId.Value = bmID.ToString(); hdnall.Value = "0"; hdnrmId.Value = ddlRM.SelectedValue; //dsMfMIS = adviserMFMIS.GetMFMIS(userType, ID, dtFrom, dtTo, int.Parse(hdnrmId.Value.ToString()), int.Parse(hdnbranchId.Value.ToString()), 0, 0); if (rbtnPickPeriod.Checked) { this.BindGrid(dtFrom, dtTo); } else { this.BindGrid(convertedFromDate, convertedToDate); } } } else if (userType == "rm") { if (rbtnPickPeriod.Checked) { this.BindGrid(dtFrom, dtTo); } else { this.BindGrid(convertedFromDate, convertedToDate); } } }