private void InitcboRound() { cPayment_round oPayment_round = new cPayment_round(); DataSet ds = new DataSet(); string strMessage = string.Empty, strCriteria = string.Empty; string strYear = string.Empty; string strPay_Month = string.Empty; string strPay_Year = string.Empty; try { strCriteria = " and round_status= 'O' "; if (!oPayment_round.SP_PAYMENT_ROUND_SEL(strCriteria, ref ds, ref strMessage)) { lblError.Text = strMessage; } else { if (ds.Tables[0].Rows.Count > 0) { #region get Data strYear = ds.Tables[0].Rows[0]["payment_year"].ToString(); strPay_Month = ds.Tables[0].Rows[0]["pay_month"].ToString(); strPay_Year = ds.Tables[0].Rows[0]["pay_year"].ToString(); #endregion } else { #region get Data strYear = ((DataSet)Application["xmlconfig"]).Tables["default"].Rows[0]["yearnow"].ToString(); if (DateTime.Now.Year < 2200) { strPay_Year = (DateTime.Now.Year + 543).ToString(); } if (DateTime.Now.Month < 10) { strPay_Month = "0" + DateTime.Now.Month; } else { strPay_Month = DateTime.Now.Month.ToString(); } #endregion } #region set Control InitcboYear(); if (cboYear.Items.FindByValue(strYear) != null) { cboYear.SelectedIndex = -1; cboYear.Items.FindByValue(strYear).Selected = true; } #endregion } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } finally { oPayment_round.Dispose(); } }
private void InitcboRound() { cPayment_round oPayment_round = new cPayment_round(); DataSet ds = new DataSet(); string strMessage = string.Empty, strCriteria = string.Empty; string strYear = string.Empty; string strPay_Month = string.Empty; string strPay_Year = string.Empty; try { strCriteria = " and round_status= 'O' "; if (!oPayment_round.SP_PAYMENT_ROUND_SEL(strCriteria, ref ds, ref strMessage)) { lblError.Text = strMessage; } else { if (ds.Tables[0].Rows.Count > 0) { #region get Data strYear = ds.Tables[0].Rows[0]["payment_year"].ToString(); strPay_Month = ds.Tables[0].Rows[0]["pay_month"].ToString(); strPay_Year = ds.Tables[0].Rows[0]["pay_year"].ToString(); #endregion #region set Control InitcboYear(); if (cboYear.Items.FindByValue(strYear) != null) { cboYear.SelectedIndex = -1; cboYear.Items.FindByValue(strYear).Selected = true; } InitcboPay_Month(); if (cboPay_Month.Items.FindByValue(strPay_Month) != null) { cboPay_Month.SelectedIndex = -1; cboPay_Month.Items.FindByValue(strPay_Month).Selected = true; } InitcboPay_Year(); if (cboPay_Year.Items.FindByValue(strPay_Year) != null) { cboPay_Year.SelectedIndex = -1; cboPay_Year.Items.FindByValue(strPay_Year).Selected = true; } #endregion } } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } finally { oPayment_round.Dispose(); } }