<!--#include file="userCheck.asp"-->
<!-- #include file="conn.asp"-->
<%
	    dim i,newPrice,newPgMes,pos
		pos=-1
		newPrice=""
		newPgMes=""
		
		carid=request.QueryString("carid")
		pgsid=session("userId23")		
		
		if Request("pgPrice")    = "" then call wrong("请填写您给出的评估价格！")
	    if Request("pgMes")    = "" then call wrong("请填写您给出的点评信息！")	
		
        '===================================================================================
		'处理product表中价格和评估信息字段
		'1.读出车辆的两个字段    2.找到相应位置更新
		set rs=server.createobject("adodb.recordset")      
		sql="select top 1 pgshiId,pgMes,pgPrice from product where id=" & carid
		rs.open sql,conn,1,3
		
		ary_pgs=split(rs("pgshiId"),"|")
		ary_pgPrice=split(rs("pgPrice"),"|")
		ary_pgMes=split(rs("pgMes"),"|")		
		
		for i=0 to Ubound(ary_pgs)
			if pgsid=cint(ary_pgs(i)) then
				pos=i
				exit for
			end if			
		next		
				
		ary_pgPrice(pos)=trim(Request("pgPrice"))
		ary_pgMes(pos)=trim(Request("pgMes"))
		
		for i=0 to Ubound(ary_pgs)								
			if i=0 then
					newprice=ary_pgPrice(i)
					newPgMes=ary_pgMes(i)
			else
					newprice=newprice & "|" & ary_pgPrice(i)
					newPgMes=newPgMes & "|" & ary_pgMes(i)
			end if		
		next
		
		rs.close
			
		Set InsertCursor = Server.CreateObject("ADODB.Recordset")
    	InsertCursor.Open "select top 1 pgshiId,pgMes,pgPrice from product where id=" & carid ,conn,1,3
		
		if trim(newprice)="" then
			InsertCursor("pgPrice")    = "nothing"
		else			
			InsertCursor("pgPrice")    = newprice
		end if	
		
		if trim(newPgMes)="" then
			InsertCursor("pgMes")    = "nothing"
		else
			InsertCursor("pgMes")    = newPgMes
		end if	
	
		InsertCursor.Update
    	InsertCursor.close
%>
<script language=Javascript>
<!--
alert("提交成功！");
window.location="user_main.asp"
-->
</script>