DateTime tmEndDate = DateTime.Today;
DateTime tmBuyDate;
CommandText = "select .... from ..... where id=" + tbid.ToString();
tmBuyDate = Convert.ToDateTime(sqlAccess.ExecuteScalar(CommandText));
int iMonthCount = ((tmEndDate.Year) - (tmBuyDate.Year)) * 12;
iMonthCount += (tmEndDate.Month) - (tmBuyDate.Month);
if ((tmEndDate.Day) - (tmBuyDate.Day) < 0)
{
iMonthCount--;
}
protected void gridSystemList_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex > -1)
{
if (dtSystemDetail != null && dtSystemDetail.Rows.Count > 0)
{
string dtSystemDetail = Convert.ToString(dtSystemDetail.Rows[e.Row.RowIndex].ItemArray[dtSystemDetail.Columns.IndexOf("dtSystemDetail")]);
string StartTime = Convert.ToString(dtSystemDetail.Rows[e.Row.RowIndex].ItemArray[dtSystemDetail.Columns.IndexOf("StartTime")]);
string EndTime = Convert.ToString(dtSystemDetail.Rows[e.Row.RowIndex].ItemArray[dtSystemDetail.Columns.IndexOf("EndTime")]);
int Question = Convert.ToInt32(dtSystemDetail.Rows[e.Row.RowIndex].ItemArray[dtSystemDetail.Columns.IndexOf("Question")]);
DateTime nowaday = DateTime.Today;
DateTime StartTime = DateTime.Today;
DateTime EndTime = DateTime.Today;
if (StartTime.Length > 0)
StartTime = Convert.ToDateTime(StartTime);
if (EndTime.Length>0)
EndTime = Convert.ToDateTime(EndTime);
if (StartTime.Length<=0 && EndTime.Length<=0)
e.Row.Cells[12].Enabled = false;
if (StartTime.Length > 0 && EndTime.Length > 0 && Question>0) {
if (nowaday.Day-StartTime.Day>=0 && EndTime.Day- nowaday.Day>=0) {
((Label)e.Row.Cells[10].FindControl("lbldtSystemDetail")).Text = dtSystemDetail;
} else {
if (dtSystemDetail.Length>0) {
((Label)e.Row.Cells[10].FindControl("lbldtSystemDetail")).Text = dtSystemDetail;
}
else
{
((Label)e.Row.Cells[10].FindControl("lbldtSystemDetail")).Text = "未在答疑时间。";
}
e.Row.Cells[12].Enabled = false;
}
}
}
}
}