private void LoadDurationData() { if (ddlSpType.SelectedIndex > 0) { //to do... string sSPCurrency = ViewState[_SPTYPE_CUREENCY] as string; DDListUtil.Assign(ddlConversionCurrency, sSPCurrency); } SetToDate(); if (ddlDuration.SelectedIndex > 0) { CommissionClaimDAL commClaimDAL = new CommissionClaimDAL(); Result oResult = null; Config oConfig = (Config)Session[Constants.SES_USER_CONFIG]; string sCriteria = string.Empty; if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Daily))) { oResult = commClaimDAL.GetCommissionClaimToDateSource(sCriteria, txtDateFrom.Text); if (oResult.Status) { ddlDateTo.DataSource = null; DataTable dtDateTo = (DataTable)oResult.Return; ddlDateTo.DataSource = dtDateTo; ddlDateTo.DataTextField = "DisplayMember"; ddlDateTo.DataValueField = "ValueMember"; ddlDateTo.DataBind(); if (dtDateTo.Rows.Count == 2) { ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString(); } ddlDateTo.Enabled = false; } } else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Date_Range))) { /* * If Me.chkFource.Checked Then * cboToDate.DataSource = Nothing * cboToDate.DataSource = Me.cOCommon.GetCommissionClaimToDateSource(Nothing, Format(CDate(txtFromDate.Text.Trim), modCommon.DateFormat)) * End If */ gvData.DataSource = null; gvData.DataBind(); txtTotalFaceValue.Text = "0.00"; txtTotalNonOrgCommission1.Text = "0.00"; txtTotalNonOrgCommission2.Text = "0.00"; txtTotalOrgCommission1.Text = "0.00"; txtTotalOrgCommission2.Text = "0.00"; txtTotalCommissionClaim.Text = "0.00"; if (ddlConversionCurrency.Items.Count > 0) { ddlConversionCurrency.SelectedIndex = 0; } ddlConversionCurrency.Enabled = false; txtConversionRate.Text = "0.0000"; ddlDateTo.SelectedIndex = 0; ddlDateTo.Enabled = true; } else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Half_Yearly))) { DateTime dtFromDate = DateTime.Now; DateTime dtToDate = DateTime.Now; if (!string.IsNullOrEmpty(txtDateFrom.Text)) { dtFromDate = Util.GetDateTimeByString(txtDateFrom.Text); if (dtFromDate.Month >= 1 && dtFromDate.Month <= 6) { dtFromDate = new DateTime(dtFromDate.Year, 1, 1); dtToDate = new DateTime(dtFromDate.Year, 6, 30); } else if (dtFromDate.Month >= 7) { dtFromDate = new DateTime(dtFromDate.Year, 7, 1); dtToDate = new DateTime(dtFromDate.Year, 12, 31); } txtDateFrom.Text = dtFromDate.ToString(Constants.DATETIME_FORMAT); ddlDateTo.DataSource = null; oResult = commClaimDAL.GetCommissionClaimToDateSource(sCriteria, dtToDate.ToString(Constants.DATETIME_FORMAT)); if (oResult.Status) { DataTable dtDateTo = (DataTable)oResult.Return; ddlDateTo.DataSource = dtDateTo; ddlDateTo.DataTextField = "DisplayMember"; ddlDateTo.DataValueField = "ValueMember"; ddlDateTo.DataBind(); if (dtDateTo.Rows.Count == 2) { ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString(); } ddlDateTo.Enabled = false; } } } /* * ElseIf cboDuration.SelectedValue = CStr(modCommon.enmDurationType.Monthly) Then * Dim dtFromDate As Date * Dim dtToDate As Date * If Me.txtFromDate.Text <> "" Then * dtFromDate = CDate(Me.txtFromDate.Text) * dtFromDate = New Date(dtFromDate.Year, dtFromDate.Month, 1) * dtToDate = DateAdd(DateInterval.Month, 1, dtFromDate) * dtToDate = DateAdd(DateInterval.Day, -1, dtToDate) * End If * txtFromDate.Text = Format(dtFromDate, modCommon.DateFormat) * cboToDate.DataSource = Nothing * cboToDate.DataSource = Me.cOCommon.GetCommissionClaimToDateSource(Nothing, Format(dtToDate, modCommon.DateFormat)) * End If */ else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Monthly))) { DateTime dtFromDate = DateTime.Now; DateTime dtToDate = DateTime.Now; if (!string.IsNullOrEmpty(txtDateFrom.Text)) { dtFromDate = Util.GetDateTimeByString(txtDateFrom.Text); dtFromDate = new DateTime(dtFromDate.Year, dtFromDate.Month, 1); int iNoOfDays = System.DateTime.DaysInMonth(dtFromDate.Year, dtFromDate.Month); dtToDate = dtFromDate.AddDays(iNoOfDays - 1); //dtToDate.Add(dtFromDate.i txtDateFrom.Text = dtFromDate.ToString(Constants.DATETIME_FORMAT); ddlDateTo.DataSource = null; oResult = commClaimDAL.GetCommissionClaimToDateSource(sCriteria, dtToDate.ToString(Constants.DATETIME_FORMAT)); if (oResult.Status) { DataTable dtDateTo = (DataTable)oResult.Return; ddlDateTo.DataSource = dtDateTo; ddlDateTo.DataTextField = "DisplayMember"; ddlDateTo.DataValueField = "ValueMember"; ddlDateTo.DataBind(); if (dtDateTo.Rows.Count == 2) { ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString(); } ddlDateTo.Enabled = false; } } } if (ddlDateTo.Items.Count > 1) { ddlDateTo.SelectedIndex = 1; } FillReferenceDetailGrid(""); ddlConversionCurrency.Enabled = true; } else { gvData.DataSource = null; gvData.DataBind(); txtTotalFaceValue.Text = "0.00"; txtTotalNonOrgCommission1.Text = "0.00"; txtTotalNonOrgCommission2.Text = "0.00"; txtTotalOrgCommission1.Text = "0.00"; txtTotalOrgCommission2.Text = "0.00"; txtTotalCommissionClaim.Text = "0.00"; if (ddlConversionCurrency.Items.Count > 0) { ddlConversionCurrency.SelectedIndex = 0; } ddlConversionCurrency.Enabled = false; txtConversionRate.Text = "0.0000"; ddlDateTo.SelectedIndex = -1; ddlDateTo.Enabled = true; } }
private void LoadDurationData() { gvData.DataSource = null; gvData.DataBind(); txtTotalFaceValue.Text = "0.00"; if (ddlDuration.SelectedIndex > 0) { CommissionClaimDAL commClaimDAL = new CommissionClaimDAL(); Result oResult = null; if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Daily))) { //ddlDateTo.Text = Util.GetDateTimeByString(txtDateFrom.Text).ToString(Constants.DATETIME_dd_MMM_yyyy);//for the time being oResult = commClaimDAL.GetCommissionClaimToDateSource("", txtDateFrom.Text); if (oResult.Status) { ddlDateTo.DataSource = null; DataTable dtDateTo = (DataTable)oResult.Return; ddlDateTo.DataSource = dtDateTo; ddlDateTo.DataTextField = "DisplayMember"; ddlDateTo.DataValueField = "ValueMember"; ddlDateTo.DataBind(); if (dtDateTo.Rows.Count == 2) { ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString(); } } ddlDateTo.Enabled = false; FillRegistrationDetailGrid(""); } else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Date_Range))) { SetToDate(Util.GetDateTimeByString(txtDateFrom.Text)); ddlDateTo.Enabled = true; if (ddlDateTo.Items.Count > 0) { ddlDateTo.SelectedIndex = 0; } } else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Half_Yearly))) { DateTime dtFromDate = DateTime.Now; DateTime dtToDate = DateTime.Now; if (!string.IsNullOrEmpty(txtDateFrom.Text)) { dtFromDate = Util.GetDateTimeByString(txtDateFrom.Text); if (dtFromDate.Month > 1 && dtFromDate.Month <= 6) { dtFromDate = new DateTime(dtFromDate.Year, 1, 1); dtToDate = new DateTime(dtFromDate.Year, 6, 30); } else if (dtFromDate.Month >= 7) { dtFromDate = new DateTime(dtFromDate.Year, 7, 1); dtToDate = new DateTime(dtFromDate.Year, 12, 31); } txtDateFrom.Text = dtFromDate.ToString(Constants.DATETIME_FORMAT); ddlDateTo.DataSource = null; oResult = commClaimDAL.GetCommissionClaimToDateSource("", dtToDate.ToString(Constants.DATETIME_FORMAT)); if (oResult.Status) { DataTable dtDateTo = (DataTable)oResult.Return; ddlDateTo.DataSource = dtDateTo; ddlDateTo.DataTextField = "DisplayMember"; ddlDateTo.DataValueField = "ValueMember"; ddlDateTo.DataBind(); if (dtDateTo.Rows.Count == 2) { ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString(); } ddlDateTo.Enabled = false; } FillRegistrationDetailGrid(""); } } else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Monthly))) { DateTime dtFromDate = DateTime.Now; DateTime dtToDate = DateTime.Now; if (!string.IsNullOrEmpty(txtDateFrom.Text)) { dtFromDate = Util.GetDateTimeByString(txtDateFrom.Text); dtFromDate = new DateTime(dtFromDate.Year, dtFromDate.Month, 1); int iNoOfDays = System.DateTime.DaysInMonth(dtFromDate.Year, dtFromDate.Month); dtToDate = dtFromDate.AddDays(iNoOfDays - 1); txtDateFrom.Text = dtFromDate.ToString(Constants.DATETIME_FORMAT); ddlDateTo.DataSource = null; oResult = commClaimDAL.GetCommissionClaimToDateSource("", dtToDate.ToString(Constants.DATETIME_FORMAT)); if (oResult.Status) { DataTable dtDateTo = (DataTable)oResult.Return; ddlDateTo.DataSource = dtDateTo; ddlDateTo.DataTextField = "DisplayMember"; ddlDateTo.DataValueField = "ValueMember"; ddlDateTo.DataBind(); if (dtDateTo.Rows.Count == 2) { ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString(); } ddlDateTo.Enabled = false; } FillRegistrationDetailGrid(""); } } } else { ddlDateTo.SelectedIndex = -1; ddlDateTo.Enabled = true; } }