<%@ Page Language="C#" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="eMIS" %> <% string wwwroot = Request.ApplicationPath; if (wwwroot == "/") wwwroot = ""; DataManager dm = new DataManager(); string d = DateTime.Now.ToString("yyyy-MM-dd"); string userId; if (Session["userid"] != null) { userId = Session["userid"].ToString(); } else { string userLogin = WeiXinWebCommon.ReadCookieUserId(this.Context); userId = dm.Operator.ExecuteScalar("select id,xingming from com_yhb where login='" + userLogin+"'").ToString(); } DataTable dt = dm.ExecuteTable("select * from wj_ques where questype=2 and expirydate>='" + d + "' and not exists (select * from wj_ques_users where quesid=wj_ques.id and userid=" + userId + ") order by id"); StringBuilder sb = new StringBuilder(); int idx = 0; string intro; for (int i = 0; i < dt.Rows.Count; i++) { if (idx != 0) sb.Append("
"); idx++; intro = dt.Rows[i]["intro"].ToString(); if (intro.Length > 30) intro = intro.Substring(0, 30); sb.Append("
"); sb.Append("
未投 "); sb.Append("" + dt.Rows[i]["title"].ToString() + ""); sb.Append("
"); sb.Append("
"+intro+"
"); sb.Append("
" + "截至:" + Convert.ToDateTime(dt.Rows[i]["expirydate"]).ToString("yyyy-MM-dd") + "
"); sb.Append("
"); } dt = dm.ExecuteTable("select * from wj_ques where questype=2 and (expirydate>='" + d + "' or exists (select * from wj_ques_users where quesid=wj_ques.id and userid=" + userId + ")) order by id desc"); for (int i = 0; i < dt.Rows.Count; i++) { if (idx != 0) sb.Append("
"); idx++; intro = dt.Rows[i]["intro"].ToString(); if (intro.Length > 30) intro = intro.Substring(0, 30); sb.Append("
"); sb.Append("
历史 "); sb.Append("" + dt.Rows[i]["title"].ToString() + ""); sb.Append("
"); sb.Append("
" + intro + "
"); sb.Append("
" + "截至:" + Convert.ToDateTime(dt.Rows[i]["expirydate"]).ToString("yyyy-MM-dd") + "
"); sb.Append("
"); } //
%> 在线投票
<%=sb.ToString() %>