我有一个下拉菜单,指示应用程序“当前”或“已过期”的状态。我希望在“结束日期”超出 c# 中的“当前日期”之后将此值更改为“过期”。
下面是加载状态的代码
public void loadStatus()
{
ArrayList arrNew = new ArrayList();
String[] tmpArray = InfoLoader.loadStatus(2).Split('\n');
for (int i = 0; i < tmpArray.Length; i++)
{
String[] cols = tmpArray[i].Split('\t');
if (cols.Length == 2)
{
arrNew.Add(new ListValues(cols[0], cols[1], ListValues.FORWARD));
}
}
cmboStatus.DataSource = arrNew;
cmboStatus.DisplayMember = "Desc";
cmboStatus.ValueMember = "ID";
}
以下是加载页面的代码
enter code here
public void loadPage(int newEmpIndex)
{
empIndex = newEmpIndex;
DataTable dtEA = dbcEA.getDT();
DataRow row = dbcEA.getDT().Rows[empIndex];
cmboApptType.SelectedValue =row["EmpAppTypeID"].ToString();
txtFTRate.Text = row["EmpAppointFTCompRate"].ToString();
txtTimeBase.Text = row["EmpAppointTimeBase"].ToString();
txtSalary.Text = row["EmpAppointSalary"].ToString();
txtFund.Text = row["EmpAppointPrimaryFund"].ToString();
txtDateStart.Text = DateTime.Parse(row["EmpAppointDateBegin"].ToString()).ToShortDateString();
txtDateEnd.Text = DateTime.Parse(row["EmpAppointDateEnd"].ToString()).ToShortDateString();
txtPayrollStart.Text = UtilityDates.parse(row["EmpAppointPayrollDateStart"].ToString(), UtilityDates.SHORTDATE);
txtPayrollEnd.Text = UtilityDates.parse(row["EmpAppointPayrollDateEnd"].ToString(), UtilityDates.SHORTDATE);
txtETrac.Text = row["EmpAppointEtrac"].ToString();
cmboStatus.SelectedValue = row["EmpAppointStatusID"].ToString().Trim();
cmboPositionNumber.SelectedValue = row["EmpAppointPositionNum"].ToString().Trim();
txtPositionNum.Text = row["EmpAppointPositionNum"].ToString();
txtMemo.Text = row["EmpAppointMemo"].ToString();
cmboJobCodeID.SelectedValue = row["JobCodeID"].ToString();
//if (UtilityParser.isInt(dtEA.Rows[empIndex].ItemArray[16].ToString()))
if (UtilityParser.isInt(row["TransFundID"].ToString()))
{
TransFundID = int.Parse(row["TransFundID"].ToString());
}
resetIsChanged();
checkNavButtons();
}
请帮我解决这个问题。我想知道如何在上面的代码中插入“if”条件。