<%@ Control Language="C#" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.HtmlTags" %>
<%@ Import Namespace="Kesion.APPCode" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Course" %>
<%@ Import Namespace="System.IO" %>
<script runat="server" type="text/C#">
    dynamic __user = HttpContext.Current.Items["user"];                //初始化用户信息，
    private static dynamic __info = new System.Dynamic.ExpandoObject();   //初始化当前页信息
    bool isLoadPage = true;  //定义页面是否加载
    private string param = string.Empty;
    public  string PageData = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {

        param = "KS_SJScore A Left Join KS_SJ B on a.sjid=b.id Where b.inputer='" + __user.UserName + "' and b.realtest=0";


    }

    // 筛选条件
    private void getParam()
    {
        if (!string.IsNullOrEmpty(KSCMS.S("showType")))
        {
            param += " and a.istj=" + Utils.StrToInt(KSCMS.S("showtype"));
        }
        if (!string.IsNullOrEmpty(KSCMS.S("TxtKeyWord")))
        {
            param += " and a.username like '%" + Utils.ChkSQL(KSCMS.S("TxtKeyWord")) + "%'";
        }

        if (!string.IsNullOrEmpty(KSCMS.S("TextBox1")))
        {
            param += " and b.title like '%" + Utils.ChkSQL(KSCMS.S("TextBox1")) + "%'";
        }

        #region 日期限制
        if (!string.IsNullOrEmpty(KSCMS.S("adddate")))
        {
            if (Utils.IsDateTime(KSCMS.S("adddate")))
            {
                param += " and [adddate]>='" + KSCMS.S("adddate") + "'";
            }
        }
        #endregion
    }


</script>
<%
    if (!isLoadPage)
    {
      
        return;
    }
%>
  <form name="myform" action="<%=BasicField.GetUserUrl("sj/TcSjScore") %>" method="post" id="myform" >
  
 <div class="t_tybox">
    	 <div class="tytitle clearfix"><h4 class="fl lf">试卷成绩</h4>
          <div class="top_c_sc mt10">
             <span>考试者：</span>
			 <input name="TxtKeyWord" type="text" id="TxtKeyWord" class="textbox" style="width:100px;border-radius:3px" />
             <span style="padding-left:10px">试卷名称：</span>
			 <input name="TextBox1" type="text" id="TextBox1" class="textbox" style="border-radius:3px;" />
             <input type="submit" onclick="return(submitclick(1))" name="Button1" value=" 搜索 " id="Button1" class="button" style="margin-left:10px;border-left:1px solid #dce2e4;border-radius:3px;" />
         
          </div>
</div>
		 <div class="tabs">
		 <ul >
				<li <%=KSCMS.S("showType")==""?" class='puton'":string.Empty %>><a href='<%=BasicField.GetUserUrl("sj/TcSjScore") %>' ><span>所有记录</span></a></li>
				<li <%=KSCMS.S("showType")=="0"?" class='puton'":string.Empty %>><a href='<%=BasicField.GetUserUrl("sj/TcSjScore","showType-0") %>'><span>已做完的记录</span></a></li>
				<li <%=KSCMS.S("showType")=="1"?" class='puton'":string.Empty %>><a href='<%=BasicField.GetUserUrl("sj/TcSjScore","showType-1") %>'><span>未做完的记录</span></a></li>
			</ul>
        
		</div>
        
	    <div class="clear"></div>
	  
           <table id="tablist" width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" class="border">
            <tr align="center" class="title">
				<td width="6%" align="center">序号</td>
				<td width="40%" align="center">试卷名称</td>            
				<td width="12%" align="center">测试者</td>         
				<td width="14%" align="center">得分</td>
				<td width="14%" align="center">考试时间</td>
				<td width="14%" align="center">↓管理操作</td>
            </tr>
	  <%

          int recordcount, pagecount;
          int CurrPage = new BasicField().GetCurrPage;
          int PageSize = 10;
          getParam();

	 using (DataTable dt = DataFactory.GetPage("a.*,b.dtfs,b.title,b.id,b.kssj as totaltime", param, "scoreid", "order by scoreID desc", CurrPage, PageSize, out recordcount, out pagecount))
          {
              if (dt.Rows.Count > 0)
              {
                  int i = (CurrPage - 1) * PageSize + 1;
                  foreach (DataRow dr in dt.Rows)
                  {
                      PageData += "  <TR class=\"tdbg sort bar\"><td align=\"center\" height=\"30px\" nowrap><input type=\"checkbox\" class=\"checkbtn\"  name=\"ids\" id=\"ids\" value=\"" + dr["id"] + "\" style=\" display:none\" /> " + i + ".</td>" +
     "<td align=\"center\" class=\"tag_left lefticon\"><a href=\"" + BasicField.GetRewriteUrl("examview", Utils.StrToInt(dr["id"].ToString())) + "\" target=\"_blank\"> <i class=\"icon iconfont icon-IE\"></i></a>" +
     "<span class=\"fonths\">" + Utils.CutStr(Convert.ToString(dr["title"]), 40) + "</span> " + (Convert.ToString(dr["istj"]) == "1" ? "<span style='color:red'>未完成</span><div style='color: #909090;padding-left: 30px;font-size: 12px;margin-top: 5px;'>总时间：" + dr["totaltime"] + " 分钟&nbsp;&nbsp;&nbsp;已用时间：" + Convert.ToString(dr["hasusetime"]).Replace(":", "分钟") + "秒</div>" : "") + "</td>" +
     "<td align=\"center\">" + dr["UserName"] + " </td>" +
     "<td align=\"center\"> <font color=red>" + Convert.ToString(Utils.StrToFloat(dr["score"].ToString()).ToString("f1")) + "</font> 分</td>" +
     "<td>" + dr["AddDate"].ToString() + "</td>" +
     "<td><div class=\"gl_btn\">" +
             "<span class=\"span1\" style=\"width:100%\"><a " + (Convert.ToString(dr["istj"]) == "1" ? " disabled" : "") + " href='" + Kesion.BLL.BaseFun.GetRewriteUrl("exam", "do-explained/scoreid-" + Convert.ToInt32(dr["scoreid"].ToString())) + "' target=\"_blank\"><i class=\"icon iconfont icon-chakan\"></i>查看</a>" +
             "</span></div></td></TR>";
                      i++;
                  }
                  KSCMS.W(PageData);
              }
              else
              {
                  KSCMS.W("<TR class=\"tdbg sort bar\"><td colspan=\"6\"><div class=\"empty\">没有找到任何试卷</div></td></TR> ");
              }
          }
	    %>
           
           </table>
    
           <div class="cz_btn clearfix" style="padding-top:10px" >    
		     <input type="hidden" name="do" value="out" id="doid" />
         	 <span><input type="button" class="button" value="打印" onclick="window.print()" /></span>
                
                    <input type="button" ID="ExcelBtn"  value="导出Excel" onclick="location.href='/plus/Course/ImportExcel.aspx?export=scoreexport'" class="addbtn button"/>
                
           </div>   


      <div class="fy_box">
	    <%
            #region 分页
            string PageStr = "[KS:PageStr1]";
            BasicField.ReplaceFilterPage(ref PageStr, CurrPage, PageSize, pagecount, recordcount);
            KSCMS.W(PageStr);
            #endregion
         %>

      </div>
       <div class="clear"></div>
     </div>
	 </form>


	 <script>
	 	function submitclick(i)
	 	{
	 		if (i == 1) {
	 			$("#doid").val("search");
                }
	 		else {
	 			$("#doid").val("out");
	 		}
	 	}

	 </script>