DataTable dt = objDB.GetDataTable("InviteManageList", pamSearchUser);
dt.Columns.Add("State2", typeof(String));
foreach (DataRow dr in dt.Rows)
{
int intType=0;
if (dr["State"].ToString() == "0" && Convert.ToDateTime(dr["AddTime"].ToString()).AddHours(72) > System.DateTime.Now)
{
dr["State2"] = "<img src='../image/red_h.gif'> 邀约等待";
intType = 1;
}
else if (dr["State"].ToString() == "0" && Convert.ToDateTime(dr["AddTime"].ToString()).AddHours(72) <= System.DateTime.Now)
{
dr["State2"] = "<img src='../image/gray_h.gif'> 邀约过时";
intType = 2;
}
else if (dr["State"].ToString() == "2")
{
dr["State2"] = "<img src='../image/gray_h.gif'> 邀约被拒";
intType = 3;
}
else if (dr["State"].ToString() == "1" && dr["AcceptTime"] != null && Convert.ToDateTime(dr["AcceptTime"].ToString()).AddHours(72) > System.DateTime.Now)
{
dr["State2"] = "<img src='../image/red_h2.gif'> 交换等待";
intType = 4;
}
else if (dr["State"].ToString() == "1" && dr["AcceptTime"] != null && Convert.ToDateTime(dr["AcceptTime"].ToString()).AddHours(72) <= System.DateTime.Now)
{
dr["State2"] = "<img src='../image/gray_h.gif'> 交换过时";
intType = 5;
}
else if (dr["State"].ToString() == "3")
{
dr["State2"] = "<img src='../image/red_h3.gif'> 交换成功";
intType = 6;
}
if(ddlType.SelectedValue != "0" && ddlType.SelectedValue != intType.ToString())
{
dr.Delete();
}
}
dt.AcceptChanges();
this.grdFriendToMe.VirtualItemCount = dt.Rows.Count;
this.grdFriendToMe.CurrentPageIndex = pageIndex;
this.grdFriendToMe.DataSource = dt;
this.grdFriendToMe.DataBind();