<%@ Control Language="C#"  %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Config" %>
<%@ Import Namespace="Kesion.Components" %>
<%@ Import Namespace="Kesion.HtmlTags" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Controllers" %>
<script runat="server" type="text/C#">
    dynamic __user = HttpContext.Current.Items["user"];
    private static dynamic __info = new System.Dynamic.ExpandoObject();   //初始化当前页信息
    bool isLoadPage = true;  //定义页面是否加载

    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUserLogin.Run();

    }
     public   string GetErrorType(int ErrorType)
      {
            #region 错误类型
            string error = string.Empty;
            switch (ErrorType)
            {
                case 11:
                    error = "含有错别字";
                    break;
                case 12:
                    error = "答案不正确";
                    break;
                case 13:
                    error = "题目不完整";
                    break;
                case 14:
                    error = "图片不存在";
                    break;
                case 15:
                    error = "解析不正确";
                    break;
                case 16:
                    error = "内容超纲";
                    break;
                case 17:
                    error = "过期考点";
                    break;
                case 18:
                    error = "章节归类错误";
                    break;
                case 19:
                    error = "其他错误";
                    break;

            }

            return error;
            #endregion
      }
 </script> 
<%
    if (!isLoadPage) return;
%>
<script src="ks_inc/exam/exam.js"></script>
<div class="r_tybox nomar disting">

    <div class="r_title"><h4 class="disting_show">试题纠错</h4>
	  
    </div>
     <div class="top-sort clearfix">
        <div class="top-sort-tab">
                <ul>                
                    <li <%if (BasicField.GetParam("show") == "") Response.Write(" class='puton'"); %>><a href="<%=BasicField.GetUserUrl("exam/MyErrorSt") %>">所有记录</a></li>
                    <li <%if (BasicField.GetParam("show") == "1") Response.Write(" class='puton'"); %>><a href="<%=BasicField.GetUserUrl("exam/MyErrorSt","show-1") %>">已纠正</a></li>
                    <li <%if (BasicField.GetParam("show") == "2") Response.Write(" class='puton'"); %>><a href="<%=BasicField.GetUserUrl("exam/MyErrorSt","show-2") %>">未纠正</a></li>         
                </ul>	
        </div>
     </div>
    <table id="tablist" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
        <tr class="title">
            <td  align="center">序号</td>
            <td align="center">题目ID</td>
           <td align="center">错误类型</td>
            <td class="align_left_text" align="center" style="width:30%">题目内容</td>
            <td align="center">错误内容</td>
            <td align="center">提交时间</td>
            <td align="center">状态</td>
	       
        </tr>
		     <%
                 int recordcount, pagecount;
                 int CurrPage = new BasicField().GetCurrPage;
                 int PageSize = 10;
                 Kesion.HtmlTags.CommonFunc.InitBlogNav(UserManage.GetUserInfo().UserID, (new TemporaryVar()).UserName);


                 string sql = "  KS_SJCorrection A Left Join KS_SJTK B on a.tmid=b.tmid where  a.userid=" + (new TemporaryVar()).UserID;
                 if (KSCMS.S("show") == "1")
                 {
                     sql += " and status=1";
                 }
                 else if(KSCMS.S("show") == "2")
                 {
                      sql += " and status=0";
                 }

                 string orderstr = "order by a.id desc";
                 using (DataTable dt = DataFactory.GetPage("a.*,b.tmnr,b.Title", sql, "a.id", orderstr, CurrPage, PageSize, out recordcount, out pagecount))
                 {
                     int i = 1;
                     if (dt.Rows.Count > 0)
                     {
                         foreach (DataRow dr in dt.Rows)
                         {
            %>
            <tr>
                <td class="splittd" style="text-align: center"><%=i+1 %></td>
                <td class="splittd" style="text-align: left"><%=dr["tmid"].ToString() %></td>

                <td class="splittd" style="text-align: left"><%=Kesion.Exam.Function.GetErrorType(Utils.StrToInt(dr["ErrorType"].ToString())) %></td>

                 <td class="splittd" style="text-align: left"><%=Kesion.Exam.Function.ReplaceTKTTags(Convert.ToString(dr["Title"]),0, Convert.ToInt32(dr["tmid"])) %><%= Kesion.Exam.Function.ReplaceTKTTags(Utils.CutStr(Utils.RemoveHtml(dr["tmnr"].ToString(), "img"), 300), 0,Convert.ToInt32(dr["tmid"].ToString()))%></td>
                <td class="splittd" style="text-align: center"><%=dr["content"].ToString() %></td>
                <td class="splittd" style="text-align: center"><%=dr["adddate"].ToString() %></td>
                <td class="splittd" style="text-align: center"><%=Convert.ToString(dr["status"])=="1"?"<font color=green>已纠正</font>":"<font color=red>未纠正</font>" %></td>
            </tr>
            <%
                            i++;
                        }
                    }
                    else
                    {
                        KSCMS.S(@"<tr><td colspan='7'><div class=""empty"">
                                        暂时没有您参与试题的纠错！
                                  </div></td></tr>");
                    }
                }
            %>
        </table>
	
        <div class="cz_btn">
		      <%
            #region 分页
             string PageStr=__user.GroupID==3||__user.GroupID==4?"[KS:PageStr1]": "[KS:PageStr2]";
            BasicField.ReplaceFilterPage(ref PageStr, CurrPage, PageSize, pagecount, recordcount);
            KSCMS.W(PageStr);
            #endregion
         %>
         </div>
  </div>
