<%@ 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" %>
<%@ Import Namespace="Kesion.Course" %>
<%@ Import Namespace="System.Xml" %>
<script runat="server" type="text/C#">

   dynamic __user = HttpContext.Current.Items["user"];                //初始化用户信息，
    private static dynamic __info = new System.Dynamic.ExpandoObject();   //初始化当前页信息
    bool isLoadPage = true;  //定义页面是否加载

    EpConfig ep = null;
    string param = string.Empty;
    
    int recordcount, pagecount;
    int PageIndex = new BasicField().GetCurrPage;
    int pagesize = 10;
    protected void Page_Load(object sender, EventArgs e)
    {
        param = " where  UserID=" + new TemporaryVar().UserID;
        __info.CreditScore = Utils.StrToInt(DataFactory.GetOnlyValue("select top 1 CreditScore from KS_CosTeacher where field='" + (new TemporaryVar()).UserName + "'"));
    }
    //获取成绩
    public string GetScore(double point, int inoroutflag, int type)
    {
        if (type == inoroutflag)
        {
            return string.Format("{0}", point);
        }
        else
        {
            return "-";
        }
    }
    //获取摘要
    public string GetOpType(int type)
    {
        if (type == 1)
            return "<span style='color:red'>提高</span>";
        else
            return "<span style='color:blue'>减少</span>";

    }
</script>
<div class="t_tybox">
    <div class="tytitle"><h4>信誉积分明细</h4>
       </div>
<div style="padding-right:4px;height:30px;line-height:30px;" class="toptips">
 
   <span style="float:left">您的总信誉积分：<font style="font-size:25px;color: #f14e29;"><%=__info.CreditScore %> 分</font></span>
   <div class="clear"></div>
  </div>
		   
    <table id="tablist" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
      <tr align="center" class="title">
        	<td width="60" align="center">用户</td>
        	<td align="center">发生时间</td>
            <td align="center" nowrap> 增加(分) </td>
            <td nowrap align="center"> 减少(分) </td>
            <td align="center">摘要</td>
	        <td align="center" nowrap>余额(分)</td>
	        <td align="center">备注</td>
       </tr>

        <%
            
            if (Utils.StrToInt(KSCMS.S("IncomeOrPayOut")) > 0)
            {
              //  param += " and CaozuoType=" + Utils.StrToInt(KSCMS.S("IncomeOrPayOut"));
            }

            using (DataTable dt = DataFactoryUser.GetPage("*", "[KS_CosTeacherScore]" + param, "id", "order by id desc", PageIndex, pagesize, out recordcount, out pagecount))
            {
                if (dt.Rows.Count > 0)
                {
                    foreach(DataRow dr  in dt.Rows)
                    {
                        KSCMS.W(@"<tr class=""tdbg"" >");
                        KSCMS.W("<td class='splittd' align='center'>"+dr["UserName"].ToString() +"</td>");
                        KSCMS.W(@"<td class=""splittd"" style=""text-align:center"">" + Utils.FormatHumanizedTime(Convert.ToDateTime(dr["AddDate"]))+"</td>");
                        KSCMS.W(@"<td class=""splittd"" align=""center"">" + GetScore(Convert.ToDouble(dr["score"]), Convert.ToInt16(dr["CaozuoType"]), 1) + "</td>");
                        KSCMS.W(@"<td class=""splittd"" align=""center"">" + GetScore(Convert.ToDouble(dr["score"]), Convert.ToInt16(dr["CaozuoType"]), 2) + "</td>");
                        KSCMS.W(@"<td class=""splittd"" align=""center"">" + GetOpType(Convert.ToInt16(dr["CaozuoType"])) + "</td>");
                        KSCMS.W(@"<td class=""splittd"" align=""center"">累计" + dr["CurrentScore"].ToString() + "分</td>");
                        KSCMS.W(@"<td class=""splittd""  style=""width:200px;word-break:break-all"">" + dr["remark"].ToString());
                        KSCMS.W(@"</td></tr>");
                    }
                }
                else {
                    KSCMS.W(@"<tr class=""tdbg"" >");
                    KSCMS.W(@"<td class=""splittd"" style=""text-align:center"" colspan=""10"">");
                    KSCMS.W(@"<div class=""empty"">没有信誉积分记录！</div>");
                    KSCMS.W(@"</td></tr>");
                }
            }
                      
            
             %>    
      
    </table>
  <div class="fy_box">
         <%
            #region 分页
            string PageStr = "[KS:PageStr1]";
            BasicField.ReplaceFilterPage(ref PageStr, PageIndex, pagesize, pagecount, recordcount);
            KSCMS.W(PageStr);
            #endregion
         %>
  </div>
  <div class="clearfix"></div>
</div>


<div ID="Panel2" >
<div class="t_tybox">
    <div class="tytitle"><h4>加分规则</h4></div>
	<div class="m20">
    <table cellspacing="0" cellpadding="0" class="border" width="100%" align="center" border="0" style="padding:0">

	    <%
               XmlDocument doc = new XmlDocument();
            doc.Load(Server.MapPath("~/config/course/score.config"));
            XmlNode nodes = doc.SelectSingleNode("/model/module[@name='teacher']");
                int i = 0;
               foreach (XmlNode topnode in nodes.ChildNodes) //顶级菜单
               {               
                 %>
         
                   <tr>
                    <td class="righttd" style="font-size:14px;font-weight:bold;text-align:right !important;">
                      <label><%=topnode.SelectSingleNode("@title").InnerText %> </label>
                   </td>
                <td>
                    <table cellspacing="0" cellpadding="0" class="border2" width="100%" align="center" border="0" style="padding:0">
                   <%   
                   foreach (XmlNode item in topnode.SelectNodes("rote")) //顶级菜单
                   {  
                   %>
                   <tr >                  
                       <td class="lefttd" align="right" style="width: 198px">
                         <%=item.SelectSingleNode("@title").InnerText %>
                       </td>
                         <td class="righttd">
                          <%=item.SelectSingleNode("@value").InnerText %>
                                               
                        <span class="tips"> 分</span>
                       </td>
                    </tr>
                <%} %>
               </table>
               </td>
            <%} %>
                    
                 
          </tr>
	</table>
    </div>
</div>


</div>