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"] = " invitation pending ";
Inttype = 1;
}
Else if (Dr ["state"]. tostring () = "0" & convert. todatetime (Dr ["addtime"]. tostring ()). addhours (72) <= system. datetime. now)
{
Dr ["state2"] = " invitation expired ";
Inttype = 2;
}
Else if (Dr ["state"]. tostring () = "2 ")
{
Dr ["state2"] = " the invitation is rejected ";
Inttype = 3;
}
Else if (Dr ["state"]. tostring () = "1" & Dr ["accepttime"]! = NULL & convert. todatetime (Dr ["accepttime"]. tostring (). addhours (72)> system. datetime. Now)
{
Dr ["state2"] = " exchange wait ";
Inttype = 4;
}
Else if (Dr ["state"]. tostring () = "1" & Dr ["accepttime"]! = NULL & convert. todatetime (Dr ["accepttime"]. tostring (). addhours (72) <= system. datetime. Now)
{
Dr ["state2"] = " switch out of date ";
Inttype = 5;
}
Else if (Dr ["state"]. tostring () = "3 ")
{
Dr ["state2"] = " exchange successful ";
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 ();