DataTable dt=new DataTable();
DataColumn dc;
DataRow dr;
dc=new DataColumn("ID",typeof(System.Int32));
dt.Columns.Add(dc);
dc=new DataColumn("SUBJECT",typeof(System.String));//标题
dt.Columns.Add(dc);
dc=new DataColumn("DISPLAY_NAME",typeof(System.String));//提交部门
dt.Columns.Add(dc);
dc=new DataColumn("CO_DEPT_NAME",typeof(System.String));//受理部门
dt.Columns.Add(dc);
dc=new DataColumn("ISSUE_DATE",typeof(System.DateTime));//提交时间
dt.Columns.Add(dc);
dc=new DataColumn("DEADLINE",typeof(System.String));//回复情况
dt.Columns.Add(dc);
dc=new DataColumn("Num",typeof(System.Int32));//办理情况 排序 //红灯=3 黄灯=2 绿灯=1
dt.Columns.Add(dc);
dc=new DataColumn("CO_TYPE",typeof(System.String));
dt.Columns.Add(dc);
dc=new DataColumn("FEEDBACK_FLAG",typeof(System.String));
dt.Columns.Add(dc);
string n=System.Configuration.ConfigurationSettings.AppSettings["ZnNum"].ToString();
int num=int.Parse(n);
string sql="SELECT top "+num+" CO_TYPE,DEPT_INFO.DISPLAY_NAME, CO_BASEINFO.SUBJECT, CO_BASEINFO.CO_DEPT_NAME,";
sql+=" CO_BASEINFO.ISSUE_DATE, CO_BASEINFO.PUBLISH_DATE, CO_BASEINFO.ID,CO_BASEINFO.FEEDBACK_FLAG,CO_BASEINFO.DEADLINE";
sql+=" FROM CO_BASEINFO INNER JOIN";
sql+=" DEPT_INFO ON CO_BASEINFO.ISSUE_DEPT_ID = DEPT_INFO.ID where CO_BASEINFO.ISSUE_FLAG='1' and CO_BASEINFO.CO_TYPE not in('police_abroad','customs_abroad') and CO_BASEINFO.OPEN_FLAG=1 order by FEEDBACK_FLAG asc,ISSUE_DATE desc";
DataTable dt2=GetNewTableByHb2004(sql);
for(int i=0;i
dr=dt.NewRow();
dr["ID"]=Convert.ToInt32(dt2.Rows[i]["ID"].ToString());
dr["SUBJECT"]=dt2.Rows[i]["SUBJECT"].ToString();
dr["DISPLAY_NAME"]=dt2.Rows[i]["DISPLAY_NAME"].ToString();
dr["CO_DEPT_NAME"]=dt2.Rows[i]["CO_DEPT_NAME"].ToString();
dr["ISSUE_DATE"]=Convert.ToDateTime(dt2.Rows[i]["ISSUE_DATE"].ToString());
dr["DEADLINE"]=dt2.Rows[i]["DEADLINE"].ToString();
dr["CO_TYPE"]=dt2.Rows[i]["CO_TYPE"].ToString();
dr["FEEDBACK_FLAG"]=dt2.Rows[i]["FEEDBACK_FLAG"].ToString();
//判断处理情况
int ifnum=IsClose2(dt2.Rows[i]["ISSUE_DATE"].ToString(),dt2.Rows[i]["DEADLINE"].ToString(),3,dt2.Rows[i]["FEEDBACK_FLAG"].ToString());
dr["Num"]=ifnum;
dt.Rows.Add(dr);
}
//**************下面才能实现按照需要的排序输出******************//
DataRow[] rows=dt.Select("","Num desc,ISSUE_DATE desc");
DataTable tmptb=dt.Clone();
tmptb.Rows.Clear();
foreach(DataRow row in rows)
tmptb.ImportRow(row);
//**************************************************//
return tmptb;