<!--#include file="userCheck.asp"-->
<!-- #include file="conn.asp"-->
<%
	    carid=request.QueryString("carid")
		
		if Request("pgPrice")    = "" then call wrong("请填写您给出的评估价格！")
	    if Request("pgMes")      = "" then call wrong("请填写您给出的点评信息！")	
		
        '===================================================================================
		'处理product表中当前用户（评估师）的三个与评估相关的字段		
		set rs=server.createobject("adodb.recordset")      
		sql="select top 1 pgshiId,pgMes,pgPrice from product where id=" & carid
		rs.open sql,conn,1,3
			
		'评估师ID写入
		if rs("pgshiId")="nothing" then
			rs("pgshiId")=trim(session("userId23"))
		else
			rs("pgshiId")=trim(rs("pgshiId")) & "|" & trim(session("userId23"))			
		end if
		'评估师评估价格写入
		if rs("pgPrice")="nothing" then
			rs("pgPrice")=trim(Request("pgPrice"))
		else
			rs("pgPrice")=trim(rs("pgPrice")) & "|" & trim(Request("pgPrice"))			
		end if
		'评估师点评信息写入
		if rs("pgMes")="nothing" then
			rs("pgMes")=trim(Request("pgMes"))
		else
			rs("pgMes")=trim(rs("pgMes")) & "|" & trim(Request("pgMes"))			
		end if		
		
		rs.update
		rs.close
				
        '===================================================================================				
        '将member表中当前用户（评估师）的待评估状态改为已评估状态
		'思路：1.将session（"userId23"）对应的member表中的评估师信息找到
		'      2.将waitPgcarid中与carid相同的去掉
		'      3.将carid添加到pgAllCarId		
		
		set rs=server.createobject("adodb.recordset")      
		sql="select top 1 waitPgcarid,pgAllCarId from member where id=" & session("userId23")
		rs.open sql,conn,1,3		
				
		ary_wait=split(rs("waitPgcarid"),"|")
		dim newwait	
		newwait=""	
		
		rs.update
		rs.close		
					
		'waitPgcarid处理
		for i=0 to Ubound(ary_wait)
			if ary_wait(i)<>carid then
				if newwait="" then 
					newwait=ary_wait(i)
				else
					newwait=newwait & "|" & ary_wait(i)
				end if
			end if
		next
		
		if trim(newwait)="" then
			conn.execute("update member set waitPgCarId='nothing' where id=" & session("userId23"))
		else
			conn.execute("update member set waitPgCarId='" & newwait & "' where id=" & session("userId23"))
		end if
		
		'pgAllCarId处理
		set rs=server.createobject("adodb.recordset")      
		sql="select top 1 pgAllCarId from member where id=" & session("userId23")
		rs.open sql,conn,1,3		
		
		if rs("pgAllCarId")="nothing" then
			rs("pgAllCarId")=trim(carid)
		else
			rs("pgAllCarId")=trim(rs("pgAllCarId")) & "|" & carid						
		end if
		rs.update
		rs.close

	conn.execute("update userJiFen set yikaxinyu = yikaxinyu + 2 where userId="& session("userId23") &"")

%>
<script language=Javascript>
<!--
alert("提交成功！");
window.location="user_main.asp"
-->
</script>