<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="../HSK_Cls/HSK.CommonCls.asp"-->
<!--#include file="../HSK_Cls/HSK.AdministratorCls.asp"-->
<!--#include file="../HSK_Cls/HSK.Label.CommonCls.asp"-->
<!--#include file="Include/Session.asp"-->
<%
'****************************************************
' 信誉评价处理  2010-11-29
'****************************************************
Dim KSCls
Set KSCls = New Admin_TiXian
KSCls.HSK_Run()
Set KSCls = Nothing

Class Admin_TiXian
        Private KS,KSCls
		Private totalPut,rs, Page, MaxPerPage,DomainStr,SearchType,SQLParam
		Private Sub Class_Initialize()
		  Set KS=New PublicCls
		  Set KSCls=New ManageCls
		End Sub
        Private Sub Class_Terminate()
		 Call CloseConn()
		 Set KS=Nothing
		 Set KSCls=Nothing
		End Sub
		Public Sub HSK_Run()
	    If Not (KS.ReturnPowerResult(0, "KMUA10007") or KS.ReturnPowerResult(5,"M510014"))Then
			  Call KS.ReturnErr(1, "")
		End If
		SearchType=KS.ChkClng(KS.G("SearchType"))
		dim begindate:begindate=request("begindate")
		dim enddate:enddate=request("enddate")

		Dim ID,Action : Action=KS.S("Action")
		IF Action = "Reply" Then	'解释
			Dim ReplyContent
		'	Dim Rs
			Dim sql
			ID = KS.ChkClng(KS.S("ID"))
			ReplyContent = KS.LoseHtml(KS.S("ReplyContent"))
			IF KS.IsNul(ReplyContent) Then KS.AlertHintScript "解释内容不能为空！"
			IF ID<>0 Then
				sql = "Select ReplyContent From PingJia Where ID=" & ID	
				Set RS=Server.CreateObject("ADODB.RECORDSET")
				RS.Open sql,Conn,1,1
				If Not Rs.Eof Then
					Conn.Execute("UPDate PingJia Set ReplyContent='" & ReplyContent & "',ReplyDate="& SqlNowString &" Where ID=" & ID)
					KS.AlertHintScript "提交成功！"
				Else
					KS.AlertHintScript "抱歉！提交ID出错！"
				End If
				RS.Close
				Set Rs = Nothing
			Else
				KS.AlertHintScript "抱歉！提交参数有误！"
			End IF
		ElseIF Action="Del" And KS.G("ID") <>"" then
			Conn.Execute("Delete From PingJia Where id In("& KS.G("ID") & ")")
			KS.AlertHintScript("删除成功！")
		ElseIF Action="del" then
			Dim Param
			Select Case KS.ChkClng(KS.G("DelType"))
				Case 1 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>11"
				Case 2 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>31"
				Case 3 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>61"
				Case 4 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>91"
				Case 5 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>181"
				Case 6 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>366"
			End Select
			If Param<>"" Then
				Conn.Execute("Delete From PingJia Where 1=1 and " & Param)
				KS.AlertHintScript "已按所选的条件，删除了信用评价的相关记录！"
			End IF
		End If
		%>
<html>
<head><title>信用评价管理</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<link href="include/Admin_Style.css" type=text/css rel=stylesheet>
<script src="../HSK_JS/jquery.js" type="text/javascript"></script>
<script src="../HSK_JS/common.js" language="JavaScript"></script>
</head>
<body leftMargin=2 topMargin=0 marginheight="0" marginwidth="0">
  <div class="topdashed" style="padding:4px;">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td><strong>信用评价管理：</strong></td>
<FORM name=form2 action=LogPingJia.asp method=post>
      <td style="border:1px #cccccc dashed">高级查询： 
<Select id=Field name=Field class='textbox'> 
  <Option value=1 selected>评价ID号</Option> 
  <Option value=2>任务ID号</Option>
  <Option value=3>用户名（包含以下三种）</Option> 
  <Option value=4>来自接手方的用户名</Option>
  <Option value=5>来自发布方的用户名</Option>
  <Option value=6>给他人评价的用户名</Option>
</Select> 关键字：
  <Input id=Keyword class='textbox' maxLength=30 name=Keyword value="<%=KS.G("KeyWord")%>"> 
  <Input class='button' type=submit value=" 查 询 " name=Submit2> 
        <Input id=SearchType type=hidden value=5 name=SearchType> </td></FORM>
    </tr>
  </table>
  </div>

  <div style="border:1px #cccccc dashed;overflow:hidden"></div>
  
   <table width="100%" border="0">
<form action="?action=search&SearchType=100" method=post name="myform">
   
   <tr>
     <td width="12%"><strong>按时间段查询</strong></td>
     <td width="48%">
       
       <table width="100%"  align="center" border=0 cellPadding=0 cellSpacing=0>
         <tr>
           <td nowrap="nowrap" class=form-left>起始日期：
             <%if isdate(begindate) then%>
             <input type="text" name="begindate" value="<%=begindate%>" size="12" class="form-input">
             <%else%>
             <input type="text" name="begindate" value="<%=year(now)&"-"&month(now)&"-1"%>" size="12" class="form-input">
             <%end if%>
            </td>    
		    <td  class=form-left>终止日期：  
		      <%if isdate(enddate) then%>            
		      <input type="text" name="enddate" value="<%=enddate%>" size="12" class="form-input">
		      <%else%>
		      <input type="text" name="enddate" value="<%=formatdatetime(now,2)%>" size="12" class="form-input">
		      <%end if%>
		      </td>    
			</tr>
        </table>	 </td>
     <td width="40%">用户名：
      <input type="text" class='textbox' name="keyword" size="10" value="<%=request("keyword")%>" /> &nbsp;
      <input name="submit2" type="submit" value="按日期查找" class='button' />
      </td>
    </tr>
</form>
 </table>
<table width="100%">
    <tr>
      <td align=left>
	  <%
	  if begindate<>"" and enddate<>"" then
	   response.write "<br><div align=center style='font-size:14px'>"
	 response.write "查询时间段 <font color=red>" & begindate & "</font> 至 <font color=red>" & enddate & "</font><br></div>"
	  end if
	  %></td>
    </tr>
  </table>
  
  
  
  <table width="100%">
    <tr>
      <td align=left>您现在的位置：<a href="LogPingJia.asp">信用评价管理</a>&nbsp;&gt;&gt;&nbsp;
	  <%Dim SearchTypeStr,SQLStr,TotalPages
	    Dim KeyWord:KeyWord=Trim(KS.G("KeyWord"))
	  Select Case SearchType
		 Case 5 
		    Select Case KS.ChkClng(KS.G("Field"))
			  Case 1:SearchTypeStr="评价ID号含有<font color=red>""" & KeyWord & """</font>"
			  Case 2:SearchTypeStr="任务ID号含有<font color=red>""" & KeyWord & """</font>"
			  Case 3:SearchTypeStr="用户名含有<font color=red>""" & KeyWord & """</font>"
			  Case 4:SearchTypeStr="来自接手方的用户名含有<font color=red>""" & KeyWord & """</font>"
			  Case 5:SearchTypeStr="来自发布方的用户名含有<font color=red>""" & KeyWord & """</font>"
			  Case 6:SearchTypeStr="给他人评价的用户名含有<font color=red>""" & KeyWord & """</font>"
			End Select
		Case 100:SearchTypeStr="时间段查询结果"
	  End Select
	  Response.Write SearchTypeStr%></td>
    </tr>
  </table>
    <div style="border:1px #cccccc dashed;overflow:hidden"></div>

  <table cellSpacing=0 cellPadding=0 width="100%" border=0>
  <form name=selform method=post action=?action=Del>
    <tr class=sort align=middle>
	  <td width="4%" nowrap>选择</th>
      <td width="8%" height="25">ID号</td>
      <td width="12%">任务编号</td>
      <td width="8%">任务区</td>
      <td width="10%">评价人</td>
      <td width="10%">被评价人</td>
      <td width="8%">评分</td>
      <td width="12%">评价时间</td>
      <td width="">评价内容</td>
      <td width="8%">操作</td>
    </tr>
	<%
			MaxPerPage=20
			Page = KS.ChkClng(KS.G("page"))
			If Page<=0 Then  Page = 1
			SqlParam="1=1"
            If SearchType<>"0" Then
			  Select Case SearchType

			  Case 5
			      Select Case KS.ChkClng(KS.G("Field"))
				   Case 1
				   	 If KS.IsNul(Keyword) Then Keyword = 0
				     SqlParam=SqlParam &" And ID=" & Keyword
				   Case 2
				     SqlParam=SqlParam &" And TaskID Like '%" & Keyword & "%'"
				   Case 3
				     SqlParam=SqlParam &" And (UserName Like '%" & Keyword & "%' OR FriendName Like '%" & Keyword & "%')"
				   Case 4
				     SqlParam=SqlParam &" And FriendName Like '%" & Keyword & "%' And NameType=1"
				   Case 5
				     SqlParam=SqlParam &" And FriendName Like '%" & Keyword & "%' And NameType=2"
				   Case 6
				     SqlParam=SqlParam &" And UserName Like '%" & Keyword & "%'"
				  End Select
			  Case 100
			  		If Keyword <> "" Then
			  			SqlParam=SqlParam &" And UserName Like '%" & Keyword & "%'"
					End If
			  End Select
			End If
			If CInt(DataBaseType) = 1 Then         'Sql
				if isdate(begindate) then SqlParam=SqlParam & " and AddDate>='" & begindate & "'"
				if isdate(enddate) then enddate=DateAdd("d", 1,EndDate):SqlParam=SqlParam & " and AddDate<='" & enddate & "'"
			else
				if isdate(begindate) then SqlParam=SqlParam & " and AddDate>=#" & begindate & "#"
				if isdate(enddate) then enddate=DateAdd("d", 1,EndDate):SqlParam=SqlParam & " and AddDate<=#" & enddate & "#"
			end if


    If DataBaseType=1 Then
					Dim Cmd : Set Cmd = Server.CreateObject("ADODB.Command")
					Set Cmd.ActiveConnection=conn
					Cmd.CommandText="KS_GetPageRecords"
					Cmd.CommandType=4	
					CMD.Prepared = true 
					Cmd.Parameters.Append cmd.CreateParameter("@tblName",202,1,200)
					Cmd.Parameters.Append cmd.CreateParameter("@fldName",202,1,200)
					Cmd.Parameters.Append cmd.CreateParameter("@pagesize",3)
					Cmd.Parameters.Append cmd.CreateParameter("@pageindex",3)
					Cmd.Parameters.Append cmd.CreateParameter("@ordertype",3)
					Cmd.Parameters.Append cmd.CreateParameter("@strWhere",202,1,1000)
					Cmd.Parameters.Append cmd.CreateParameter("@fieldIds",202,1,1000)
					Cmd("@tblName")="PingJia"
					Cmd("@fldName")= "ID"
					Cmd("@pagesize")=MaxPerPage
					Cmd("@pageindex")=page
					Cmd("@ordertype")=1
					Cmd("@strWhere")=SqlParam
					Cmd("@fieldIds")="*"
					Set Rs=Cmd.Execute
					Set Cmd = Nothing
	 Else
			SQLStr=KS.GetPageSQL("PingJia","ID",MaxPerPage,Page,1,SqlParam,"*")
			Set RS = Server.CreateObject("AdoDb.RecordSet")
			RS.Open SQLStr, conn, 1, 1
	 End If
	If RS.Eof AND RS.Bof Then
	 Response.WRITE "<tr class=list onmouseover=""this.className='listmouseover'"" onmouseout=""this.className='list'""><td colspan=10 align=center height='25'>找不到" & SearchTypeStr & "!</td></tr></table>"
   Else
        totalPut = Conn.Execute("Select Count(1) From PingJia Where "& SQLParam)(0)
		Call showContent()
   End If
   RS.Close:Set RS=Nothing
   %>
	<br><br/>
	<br/>
<div class="attention">
<strong>特别提醒：</strong>
信用评价记录不可以轻易删除，影响到所有用户的信誉评价！
<br />
<!--
<iframe src='about:blank' style='display:none' name='_hiddenframe' id='_hiddenframe'></iframe>
<form action="?action=del" target="_hiddenframe" method=post onSubmit="return(confirm('确实要删除有关记录吗？请慎重!'))">
删除范围：<input name="deltype" type="radio" value=1 disabled>
10天前 
    <input name="deltype" type="radio" value="2" />
    1个月前
    <input name="deltype" type="radio" value="3" />
    2个月前
    <input name="deltype" type="radio" value="4" />
    3个月前
    <input name="deltype" type="radio" value="5" />
    6个月前
    <input name="deltype" type="radio" value="6" checked="checked" />
    1年前
    <input type="submit" value="执行删除" class="button">
	</form>
    -->
</div>
	<br/>
</body>
</html>
   <%
   End Sub
  
  Sub ShowContent()
     on error resume next
     Dim I
     Do While Not rs.eof 
	%>
    <tr class=list onMouseOver="this.className='listmouseover'" onMouseOut="this.className='list'">
	  <td align="center" class="splittd"><input type=checkbox name=ID value='<%=rs("id")%>'></td>
      <td  class="splittd" align=middle onClick="$('#C<%=rs("id")%>').toggle()" style="cursor:pointer"><%=rs("ID")%></td>
      <td  class="splittd" align=middle onClick="$('#C<%=rs("id")%>').toggle()" style="cursor:pointer"><%=rs("TaskID")%></td>
	  <td  class="splittd" align=middle><%=KS.C_C(rs("tid"),1)%></td>
      <td  class="splittd" align=middle><a href="/task/UserInfo.asp?UserName=<%=Rs("UserName")%>" target="_blank"><%=rs("UserName")%></a></td>
      <td  class="splittd" align=middle><a href="/task/UserInfo.asp?UserName=<%=Rs("FriendName")%>" target="_blank"><%=rs("FriendName")%></a></td>
      <td  class="splittd" align=center><%
	IF KS.ChkClng(rs("HaoPing"))=1 Then KS.Echo "好评"
	IF KS.ChkClng(rs("ZhongPing"))=1 Then KS.Echo "中评"
	IF KS.ChkClng(rs("ChaPing"))=1 Then KS.Echo "差评"%></td>
      <td  class="splittd" align=center><%=rs("AddDate")%></td>
      <td  class="splittd" align=center><%=rs("Content")%><%if rs("ReplyContent")<>"" then KS.Echo "<br><span class='red'>解释内容：" & rs("ReplyContent")%></span>&nbsp;</td>
      <td  class="splittd" align=middle><%
	  if Not KS.IsNul(rs("ReplyContent")) then
	  ks.echo "<font color=red>已解释</font> <a href=""javascript:void(0)"" onclick=""show('?Action=Reply&ID="& rs("ID") &"')"" title=""回复解释"">修改</a>"
	  else
	  KS.echo "<a href=""javascript:void(0)"" onclick=""show('?Action=Reply&ID="& rs("ID") &"')"" title=""回复解释"">我要解释</a>"
	  end if%></td>
    </tr>
    <tr id="C<%=rs("id")%>" bgcolor="#EEEEEE" style="display:none;">
      <td class="splittd" align=center colSpan=10>任务标题：<%=rs("Title")%> &nbsp;&nbsp; 用户IP：<%=rs("IP")%> &nbsp;&nbsp; 解释时间：<%=rs("ReplyDate")%></td>
    </tr>
	<%
	I = I + 1
	RS.MoveNext
	If I >= MaxPerPage Then Exit Do
	loop
	%>
<tr>
	<td class='list' onMouseOver="this.className='listmouseover'" onMouseOut="this.className='list'" height='25' colspan=10>
	&nbsp;&nbsp;<input id="chkAll" onClick="CheckAll(this.form)" type="checkbox" value="checkbox"  name="chkAll">全选
	<input class="button" type="submit" name="Submit2" value=" 删除选中的信誉评价 " onClick="{if(confirm('此操作不可逆，确定要删除选中的记录吗?')){this.document.selform.submit();return true;}return false;}"></td>
</tr>
</form>
<tr>
	<td  colspan=10 align=right>
	<%
	 Call KSCLS.ShowPage(totalPut, MaxPerPage, "logPingJia.asp", True, "条", Page, KS.QueryParam("page"))
	%></td>
</tr>
</table>
<script type="text/javascript" src="/HSK_JS/HSK.box.js"></script>

<script type="text/javascript">
function check()
{
 var ReplyContent=$("#ReplyContent").val();
 var url=$("#url").val();
 if (url==''){
  alert('参数传递出错!');
  closeWindow();
 }
 if (ReplyContent==''){
   alert('请输入解释内容!');
   $("#ReplyContent").focus();
   return false;
 }
 location.href=url + "&ReplyContent=" + ReplyContent;
}
function show(url)
{
 new KesionPopup().popupTips("<img src='../images/user/log/106.gif'> 评价解释","请输入本次评价的解释内容(可输入255个字符)<br /><textarea name='ReplyContent' id='ReplyContent' style='width:340px;height:80px'></textarea><div style='text-align:center;margin:10px'><input type='button' onclick='return(check());' value=' 确 定 ' class='button'><input type='hidden' value="+url+" name='url' id='url'> <input type='button' value=' 取 消 ' onclick='closeWindow()' class='button'></div>",354,350);
}		 
</script>
		<%
		End Sub
		
End Class
%> 
