<!--#include file="inc/conn.asp"-->
<!--#include file="inc/Function.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/Config.asp"-->
<%
Session.CodePage=65001
Response.Charset="UTF-8"
Call ConnectionDataBase()
Action = Request("Action")
Select Case Action
	Case "reg"
		Call register
	Case "login"
		Call login
	Case "modiuserinfor"
		Call modiuserinfor
	Case "modicompanyinfor"
		Call modicompanyinfor
	Case "modiuserpwd"
		Call modiuserpwd
	Case "addnews"
		Call addnews
	Case "LogicDelNews"
		Call LogicDelNews
	Case "DelNews"
		Call DelNews
	Case "LogicDelProducts"
		Call LogicDelProducts
	Case "DelProducts"
		Call DelProducts	
	Case "addproducts"
		Call addproducts	
	Case "addzb"
		Call addzb
	Case "submitballot"
		Call submitballot
	Case "addsales"
		Call addsales
	Case "LogicDelSales"
		Call LogicDelSales
	Case "DelSales"
		Call DelSales
	Case "LogicDelCase"
		Call LogicDelCase
	Case "DelCase"
		Call DelCase	
	Case "addcase"
		Call addcase	
	Case "LogicDelTeam"
		Call LogicDelTeam
	Case "DelTeam"
		Call DelTeam	
	Case "addteam"
		Call addteam
	Case "LogicDelJob"
		Call LogicDelJob
	Case "DelJob"
		Call DelJob	
	Case "addjob"
		Call addjob
	Case "send"
		Call send
	Case "LogicDelMsg"
		Call LogicDelMsg
	Case "DelMsg"
		Call DelMsg
	Case "addaffiche"
		Call addaffiche
	Case "addlink"
		Call addlink
	Case "LogicDelLink"
		Call LogicDelLink
	Case "DelLink"
		Call DelLink
	Case "LogicDelTender"
		Call LogicDelTender
	Case "DelTender"
		Call DelTender
	Case "addask"
		Call addask
	Case "LogicDelAsk"
		Call LogicDelAsk
	Case "DelAsk"
		Call DelAsk
	Case "submitask"
		Call submitask
	Case "good"
		Call good


	Case "AcceptTender"
		Call AcceptTender



End Select

Sub register()
	VipGroup = Checkstr(Request.Form("VipGroup"))
	username = Checkstr(Request.Form("username"))
	pwd = Checkstr(Request.Form("pwd"))
	pwd2 = Checkstr(Request.Form("pwd2"))
	email = Checkstr(Request.Form("email"))
	ChkCode = Checkstr(Request.Form("ChkCode"))
	realname = Checkstr(Request.Form("realname"))
	usersex = Checkstr(Request.Form("usersex"))
	mtel = Checkstr(Request.Form("mtel"))
	qq = Checkstr(Request.Form("qq"))
	area = Checkstr(Request.Form("areaid"))	
	company = Checkstr(Request.Form("company"))	
	Call ChkIsNull(username,"请输入用户名")
	Call ChkIsNull(pwd,"请输入密码")
	Call ChkIsNull(pwd2,"请输入确认密码")
	IF pwd<>pwd2 Then Call ok("两次密码输入不一致","reg.asp")
	Call ChkIsNull(email,"请输入E-mail")
	Call ChkIsNull(ChkCode,"请输入验证码")
	Call ChkIsNull(mtel,"请输入手机号码")
	Call ChkIsNull(qq,"请输入QQ号码")
	IF Cstr(Session("GetCode"))<>Cstr(ChkCode) Then Call ok("验证码错误!","reg.asp")
	Session("GetCode")=""

	Sql="Select VipGroup,UserName,UserPwd,RealName,Sex,CityID,Email,Mobile,QQ,NickName,company From T_Users Where UserName='"& username &"'"
	SetRs Rs,Sql,conn,1,3
	IF Not Rs.Eof Then
		Call Success("该用户名已经存在!","reg.asp")
	Else
		Rs.Addnew
		Rs("VipGroup")=VipGroup
		Rs("UserName")=UserName
		Rs("UserPwd")=MD5(pwd)
		Rs("RealName")=realname
		Rs("Sex")=usersex
		Rs("CityID")=area
		Rs("Email")=email
		Rs("Mobile")=mtel
		Rs("QQ")=qq
		Rs("NickName")=company
		Rs("company")=company
		Rs.Update
	End IF
	DisRs Rs
	Sql="Select ID,VIP,VipGroup,UserName,UserPwd,RealName,Recycle From T_Users Where UserName='"& username &"' and UserPwd='"&MD5(pwd)&"'"
	SetRs Rs,Sql,conn,1,1
	IF Not Rs.Eof Then
		Session("DjbUserID")=Rs("ID")
		Session("VIP")=Rs("VIP")
		Session("DjbUserName")=UserName
		Session("DjbVipGroup")=Rs("VipGroup")
		Session("RealName")=Rs("RealName")
		StrSql="Select Rights From T_Rights Where UserClassID="&Rs("VipGroup")
		SetRs Rs1,StrSql,conn,1,1
		IF Not Rs1.EOF Then Session("DjbVipRights")=Rs1("Rights")
		DisRs Rs1		
	End IF
	Call CloseDatabase
	Call Success("恭喜您注册成功,现在就去登陆完善您的会员信息吧!","index.asp")
End Sub

Sub login()
	username = Checkstr(Request.Form("username"))
	pwd = Checkstr(Request.Form("pwd"))
	ChkCode = Checkstr(Request.Form("ChkCode"))

	Call ChkIsNull(username,"请输入用户名")
	Call ChkIsNull(pwd,"请输入密码")
	Call ChkIsNull(ChkCode,"请输入验证码")
	IF Cstr(Session("GetCode"))<>Cstr(ChkCode) Then Call ok("验证码错误!","login.asp")
	Session("GetCode")=""

	Sql="Select ID,VIP,VipGroup,UserName,UserPwd,RealName,Recycle From T_Users Where UserName='"& username &"'"
	SetRs Rs,Sql,conn,1,1
	IF Not Rs.Eof Then
		IF Rs("Recycle") Then
			Call ok("该账号已经被锁定,请联系管理员!","login.asp")
		ElseIF Rs("UserPwd")<>MD5(pwd) Then
			Call ok("密码输入错误!","login.asp")
		Else
			Session("DjbUserID")=Rs("ID")
			Session("VIP")=Rs("VIP")
			Session("DjbUserName")=UserName
			Session("DjbVipGroup")=Rs("VipGroup")
			Session("RealName")=Rs("RealName")
			StrSql="Select Rights From T_Rights Where UserClassID="&Rs("VipGroup")
			SetRs Rs1,StrSql,conn,1,1
			IF Not Rs1.EOF Then Session("DjbVipRights")=Rs1("Rights")
			DisRs Rs1
			Response.Redirect("index.asp")
		End IF
	Else
		Call IsError("该用户不存在!")
	End IF
	DisRs Rs
	Call CloseDatabase
	
End Sub


Sub modiuserinfor()
	nickname  = Checkstr(Request.Form("nickname"))
	question  = Checkstr(Request.Form("question"))
	answer  = Checkstr(Request.Form("answer"))
	realname  = Checkstr(Request.Form("realname"))
	sex  = Checkstr(Request.Form("sex"))
	birthday  = Checkstr(Request.Form("birthday"))
	areaid  = Checkstr(Request.Form("area"))
	email  = Checkstr(Request.Form("email"))
	address  = Checkstr(Request.Form("address"))
	postcode  = Checkstr(Request.Form("postcode"))
	tel  = Checkstr(Request.Form("tel"))
	mobile  = Checkstr(Request.Form("mobile"))
	fax  = Checkstr(Request.Form("fax"))
	qq  = Checkstr(Request.Form("qq"))
	msn = Checkstr(Request.Form("msn"))
	logo = Checkstr(Request.Form("logo"))
	Banner = Checkstr(Request.Form("Banner"))
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Sql="Select * From T_Users Where ID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Not Rs.Eof Then
		Rs("nickname")=nickname
		Rs("question")=question
		Rs("answer")=answer
		Rs("realname")=realname
		Rs("sex")=sex
		Rs("birthday")=birthday
		Rs("cityid")=areaid
		Rs("email")=email
		Rs("address")=address
		Rs("postcode")=postcode
		Rs("tel")=tel
		Rs("mobile")=mobile
		Rs("fax")=fax
		Rs("qq")=qq
		Rs("msn") = msn
		Rs("logo") = logo
		Rs("Banner") = Banner
		Rs.Update
	End IF
	DisRs Rs
	Call CloseDatabase
	Call Success("信息修改成功!",Request.ServerVariables("HTTP_REFERER"))
End Sub

Sub modicompanyinfor()
	BusinessCard  = Checkstr(Request.Form("BusinessCard"))
	houseid  = Checkstr(Request.Form("houseid"))
	Content  = Checkstr(Request.Form("Content"))
	company	  = Checkstr(Request.Form("company"))
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Sql="Select * From T_Users Where ID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Not Rs.Eof Then
		Rs("BusinessCard")=BusinessCard
		Rs("houseids")=houseid
		Rs("Content")=Content	
		Rs("company")=company		
		Rs.Update
	End IF
	DisRs Rs
	Call CloseDatabase
	Call Success("信息修改成功!",Request.ServerVariables("HTTP_REFERER"))
End Sub

Sub modiuserpwd()
	oldpwd  = Checkstr(Request.Form("oldpwd"))
	newpwd  = Checkstr(Request.Form("newpwd"))
	newpwd1  = Checkstr(Request.Form("newpwd1"))	
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Call ChkIsNull(oldpwd,"请输入原密码")
	Call ChkIsNull(newpwd,"请输入新密码")
	Call ChkIsNull(newpwd1,"请输入确认密码")
	IF newpwd<>newpwd1 Then Call IsError("两次密码输入不一致!")
	Sql="Select userpwd From T_Users Where ID=" & ID & " And userpwd='"& MD5(oldpwd)&"'"
	SetRs Rs,Sql,conn,1,3
	IF Not Rs.Eof Then
		Rs("userpwd")=MD5(newpwd)	
		Rs.Update
	Else
		Call IsError("原密码有误,请重输!")
	End IF
	DisRs Rs
	Call CloseDatabase
	Call Success("密码修改成功!请妥善保管",Request.ServerVariables("HTTP_REFERER"))
End Sub

Sub addnews()
	newstitle  = Checkstr(Request.Form("newstitle"))
	Content  = Checkstr(Request.Form("Content"))
	SortID  = Checkstr(Request.Form("SortID"))
	UserID = Checkstr(Request.Form("UserID"))
	NewsPic = Checkstr(Request.Form("NewsPic"))
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Call ChkIsNumber(SortID,"对不起,请输入正确的排序号")
	Call ChkIsNumber(UserID,"对不起,参数类型错误")
	Call ChkIsNull(newstitle,"请输入新闻标题")
	Call ChkIsNull(Content,"请输入新闻内容")
	Sql="Select UserID,NewsTitle,Content,SortID,NewsPic From T_News Where ID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Rs.Eof Then Rs.Addnew
	Rs("NewsTitle")=NewsTitle
	Rs("Content")=Content
	Rs("SortID")=SortID
	Rs("UserID")=UserID
	Rs("NewsPic")=NewsPic
	Rs.Update	
	DisRs Rs
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub

'逻辑删除
Sub LogicDelNews()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")	
	StrSql = "UPDATE T_News SET Recycle=1 Where ID in (" & ChkBox & ")"
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success("记录已经成功删除!",request.ServerVariables("HTTP_REFERER"))	
End Sub

'物理删除/还原
Sub DelNews()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")
	btnSubmit = Trim(Request("btnSubmit"))
	IF btnSubmit="还原" Then
		StrSql = "UPDATE T_News SET Recycle=0 Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功还原!"
	Else
		StrSql = "DELETE FROM T_News Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功删除!"
	End IF
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success(Msg,request.ServerVariables("HTTP_REFERER"))	
End Sub

'逻辑删除
Sub LogicDelProducts()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")	
	StrSql = "UPDATE T_Products SET Recycle=1 Where ID in (" & ChkBox & ")"
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success("记录已经成功删除!",request.ServerVariables("HTTP_REFERER"))	
End Sub

'物理删除/还原
Sub DelProducts()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")
	btnSubmit = Trim(Request("btnSubmit"))
	IF btnSubmit="还原" Then
		StrSql = "UPDATE T_Products SET Recycle=0 Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功还原!"
	Else
		StrSql = "DELETE FROM T_Products Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功删除!"
	End IF
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success(Msg,request.ServerVariables("HTTP_REFERER"))	
End Sub

Sub addproducts()
	ProCategory  = Checkstr(Request.Form("ProCategory"))
	Brand  = Checkstr(Request.Form("Brand"))
	proname  = Checkstr(Request.Form("proname"))
	price  = Checkstr(Request.Form("price"))
	ProPic  = Checkstr(Request.Form("ProPic"))
	recommend  = Checkstr(Request.Form("recommend"))
	Content  = Checkstr(Request.Form("Content"))
	SortID  = Checkstr(Request.Form("SortID"))
	UserID = Checkstr(Request.Form("UserID"))
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Call ChkIsNumber(SortID,"对不起,请输入正确的排序号")
	Call ChkIsNumber(UserID,"对不起,参数类型错误")
	Call ChkIsNull(proname,"请输入产品名称")
	IF recommend="" Then recommend=0
	Sql="Select ClassID,BrandID,UserID,ProName,ProPic,Price,Content,SortID,Recommend From T_Products Where ID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Rs.Eof Then Rs.Addnew
	Rs("ClassID")=ProCategory
	Rs("BrandID")=Brand
	Rs("proname")=proname
	Rs("price")=price
	Rs("ProPic")=ProPic
	Rs("recommend")=recommend
	Rs("Content")=Content
	Rs("SortID")=SortID
	Rs("UserID")=UserID
	Rs.Update	
	DisRs Rs
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub

Sub addzb()
	ClassID= Checkstr(Request.Form("rdTender"))
	Title = Checkstr(Request.Form("Title"))
	content = Checkstr(Request.Form("content"))
	areas = Checkstr(Request.Form("areas"))
	Price = Checkstr(Request.Form("Price"))
	area = Checkstr(Request.Form("area"))
	houseid = Checkstr(Request.Form("houseid"))
	EndTime = Checkstr(Request.Form("EndTime"))
	ImgTitle = Checkstr(Request.Form("ImgTitle"))
	ImgPath = Checkstr(Request.Form("ImgPath"))
	RowsCount = Checkstr(Request.Form("RowsCount"))	

	ItemsClassID = Request.Form("ItemsClassID")	
	StepClassID = Request.Form("StepClass")	
	years = Request.Form("years")	
	months = Request.Form("months")	
	designer = Checkstr(Request.Form("designer"))	

	For i=1 TO RowsCount
	ImgTitles=ImgTitles & Checkstr(Request.Form("ImgTitle"&i)) & ","
	ImgPaths=ImgPaths & Checkstr(Request.Form("ImgPath"&i)) & ","
	Next
	IF ImgTitles<>"" Then ImgTitles=Left(ImgTitles,Len(ImgTitles)-1)
	IF ImgPaths<>"" Then ImgPaths=Left(ImgPaths,Len(ImgPaths)-1)
	OpenContact = Checkstr(Request.Form("OpenContact"))	
	Email = Checkstr(Request.Form("Email"))	
	Tel = Checkstr(Request.Form("Tel"))	
	Mobile = Checkstr(Request.Form("Mobile"))	
	Fax = Checkstr(Request.Form("Fax"))	
	QQ = Checkstr(Request.Form("QQ"))	
	MSN = Checkstr(Request.Form("MSN"))	
	UserID = Checkstr(Request.Form("UserID"))	
	ID = Checkstr(Request.Form("ID"))	
	Call ChkIsNull(Title,"请输入项目名称")
	Call ChkIsNull(content,"请输入项目描述")
	Call ChkIsNull(Price,"请输入预算评估")
	Call ChkIsNull(EndTime,"请输入结束时间")
	Call ChkIsNumber(UserID,"对不起,参数类型错误,请登陆后再发布招标信息")
	Call ChkIsNumber(ID,"对不起,参数类型错误,请文明访问本站")
	Sql="Select ClassID,Title,content,area,Price,City,house,EndTime,ImgTitle,ImgPath,ImgTitles,ImgPaths,OpenContact,Email,Tel,Mobile,Fax,QQ,MSN,UserID,ItemsClass,StepClass,years,months,designer From T_Tender Where TenderID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Rs.Eof Then Rs.Addnew
	Rs("ClassID")=ClassID
	Rs("Title")=Title
	Rs("content")=content
	Rs("Area")=areas
	Rs("Price")=Price
	Rs("City")=area
	Rs("House")=houseid	
	Rs("EndTime")=EndTime
	Rs("ImgTitle")=ImgTitle
	Rs("ImgPath")=ImgPath
	Rs("ImgTitles")=ImgTitles
	Rs("ImgPaths")=ImgPaths
	Rs("OpenContact")=OpenContact
	Rs("Email")=email
	Rs("Tel")=Tel
	Rs("Mobile")=Mobile
	Rs("Fax")=Fax
	Rs("QQ")=qq
	Rs("MSN")=MSN
	Rs("UserID")=UserID	
	Rs("ItemsClass")=ItemsClassID
	Rs("StepClass")=StepClassID
	Rs("years")=years
	Rs("months")=months
	Rs("designer")=designer
	Rs.Update
	DisRs Rs
	Call CloseDatabase
	Call Success("招标信息发布成功!",Request.ServerVariables("HTTP_REFERER"))
End Sub

Sub submitballot()
	content = Checkstr(Request.Form("content"))
	UserID = Checkstr(Request.Form("UserID"))
	TenderID = Checkstr(Request.Form("TenderID"))
	OpenType = Checkstr(Request.Form("OpenType"))
	Call ChkIsNumber(TenderID,"对不起,参数类型错误")
	Call ChkIsNull(content,"请输入投标信息")
	Call ChkIsNumber(UserID,"对不起,参数类型错误,请登陆后再发布投标信息")

	Sql="Select UserID,TenderID,content,OpenType From T_Ballot"
	SetRs Rs,Sql,conn,1,3
	Rs.Addnew
	Rs("TenderID")=TenderID
	Rs("OpenType")=OpenType
	Rs("content")=content
	Rs("UserID")=UserID
	Rs.Update
	DisRs Rs
	Call CloseDatabase
	Call Success("投标信息提交成功!",Request.ServerVariables("HTTP_REFERER"))
End Sub
'促销信息
Sub addsales()
	Brand  = Checkstr(Request.Form("Brand"))
	newstitle  = Checkstr(Request.Form("newstitle"))
	Content  = Checkstr(Request.Form("Content"))
	SortID  = Checkstr(Request.Form("SortID"))
	UserID = Checkstr(Request.Form("UserID"))
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Call ChkIsNumber(SortID,"对不起,请输入正确的排序号")
	Call ChkIsNumber(UserID,"对不起,参数类型错误")
	Call ChkIsNull(newstitle,"请输入新闻标题")
	Call ChkIsNull(Content,"请输入新闻内容")
	Sql="Select BrandID,UserID,NewsTitle,Content,SortID From T_Sales Where ID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Rs.Eof Then Rs.Addnew
	Rs("NewsTitle")=NewsTitle
	Rs("Content")=Content
	Rs("SortID")=SortID
	Rs("UserID")=UserID
	Rs("BrandID")=Brand
	Rs.Update	
	DisRs Rs
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub

'逻辑删除
Sub LogicDelSales()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")	
	StrSql = "UPDATE T_Sales SET Recycle=1 Where ID in (" & ChkBox & ")"
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success("记录已经成功删除!",request.ServerVariables("HTTP_REFERER"))	
End Sub

'物理删除/还原
Sub DelSales()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")
	btnSubmit = Trim(Request("btnSubmit"))
	IF btnSubmit="还原" Then
		StrSql = "UPDATE T_Sales SET Recycle=0 Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功还原!"
	Else
		StrSql = "DELETE FROM T_Sales Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功删除!"
	End IF
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success(Msg,request.ServerVariables("HTTP_REFERER"))	
End Sub

'逻辑删除
Sub LogicDelCase()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")	
	StrSql = "UPDATE T_Case SET Recycle=1 Where ID in (" & ChkBox & ")"
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success("记录已经成功删除!",request.ServerVariables("HTTP_REFERER"))	
End Sub

'物理删除/还原
Sub DelCase()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")
	btnSubmit = Trim(Request("btnSubmit"))
	IF btnSubmit="还原" Then
		StrSql = "UPDATE T_Case SET Recycle=0 Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功还原!"
	Else
		StrSql = "DELETE FROM T_Case Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功删除!"
	End IF
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success(Msg,request.ServerVariables("HTTP_REFERER"))	
End Sub

Sub addcase()
	proname  = Checkstr(Request.Form("proname"))
	ProPic  = Checkstr(Request.Form("ProPic"))
	recommend  = Checkstr(Request.Form("recommend"))
	Content  = Checkstr(Request.Form("Content"))
	SortID  = Checkstr(Request.Form("SortID"))
	UserID = Checkstr(Request.Form("UserID"))
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Call ChkIsNumber(SortID,"对不起,请输入正确的排序号")
	Call ChkIsNumber(UserID,"对不起,参数类型错误")
	Call ChkIsNull(proname,"请输入案例名称")
	IF recommend="" Then recommend=0
	Sql="Select UserID,ProName,ProPic,Content,SortID,Recommend From T_Case Where ID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Rs.Eof Then Rs.Addnew
	Rs("proname")=proname
	Rs("ProPic")=ProPic
	Rs("recommend")=recommend
	Rs("Content")=Content
	Rs("SortID")=SortID
	Rs("UserID")=UserID
	Rs.Update	
	DisRs Rs
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub

'逻辑删除
Sub LogicDelTeam()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")	
	StrSql = "UPDATE T_Team SET Recycle=1 Where ID in (" & ChkBox & ")"
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success("记录已经成功删除!",request.ServerVariables("HTTP_REFERER"))	
End Sub

'物理删除/还原
Sub DelTeam()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")
	btnSubmit = Trim(Request("btnSubmit"))
	IF btnSubmit="还原" Then
		StrSql = "UPDATE T_Team SET Recycle=0 Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功还原!"
	Else
		StrSql = "DELETE FROM T_Team Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功删除!"
	End IF
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success(Msg,request.ServerVariables("HTTP_REFERER"))	
End Sub

Sub addteam()
	proname  = Checkstr(Request.Form("proname"))
	ProPic  = Checkstr(Request.Form("ProPic"))
	recommend  = Checkstr(Request.Form("recommend"))
	Content  = Checkstr(Request.Form("Content"))
	SortID  = Checkstr(Request.Form("SortID"))
	UserID = Checkstr(Request.Form("UserID"))
	post  = Checkstr(Request.Form("post"))
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Call ChkIsNumber(SortID,"对不起,请输入正确的排序号")
	Call ChkIsNumber(UserID,"对不起,参数类型错误")
	Call ChkIsNull(proname,"请输入案例名称")
	IF recommend="" Then recommend=0
	Sql="Select UserID,ProName,ProPic,Content,SortID,Recommend,Post From T_Team Where ID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Rs.Eof Then Rs.Addnew
	Rs("proname")=proname
	Rs("ProPic")=ProPic
	Rs("recommend")=recommend
	Rs("Content")=Content
	Rs("SortID")=SortID
	Rs("UserID")=UserID
	Rs("Post")=Post
	Rs.Update	
	DisRs Rs
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub

'逻辑删除
Sub LogicDelJob()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")	
	StrSql = "UPDATE T_Job SET Recycle=1 Where ID in (" & ChkBox & ")"
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success("记录已经成功删除!",request.ServerVariables("HTTP_REFERER"))	
End Sub

'物理删除/还原
Sub DelJob()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")
	btnSubmit = Trim(Request("btnSubmit"))
	IF btnSubmit="还原" Then
		StrSql = "UPDATE T_Job SET Recycle=0 Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功还原!"
	Else
		StrSql = "DELETE FROM T_Job Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功删除!"
	End IF
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success(Msg,request.ServerVariables("HTTP_REFERER"))	
End Sub

Sub addjob()
	dept  = Checkstr(Request.Form("dept"))
	postname  = Checkstr(Request.Form("postname"))
	Edu  = Checkstr(Request.Form("Edu"))
	Content  = Checkstr(Request.Form("Content"))
	SortID  = Checkstr(Request.Form("SortID"))
	UserID = Checkstr(Request.Form("UserID"))
	Sex  = Checkstr(Request.Form("Sex"))
	IsWork  = Checkstr(Request.Form("IsWork"))
	Deal  = Checkstr(Request.Form("Deal"))
	Address  = Checkstr(Request.Form("Address"))
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Call ChkIsNumber(SortID,"对不起,请输入正确的排序号")
	Call ChkIsNumber(UserID,"对不起,参数类型错误")
	Call ChkIsNull(postname,"请输入岗位名称")
	Call ChkIsNull(dept,"请输入部门名称")
	Sql="Select * From T_Job Where ID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Rs.Eof Then Rs.Addnew
	Rs("dept")=dept
	Rs("postname")=postname
	Rs("Edu")=Edu
	Rs("Content")=Content
	Rs("SortID")=SortID
	Rs("UserID")=UserID
	Rs("Sex")=Sex
	Rs("IsWork")=IsWork
	Rs("Deal")=Deal
	Rs("Address")=Address
	Rs.Update	
	DisRs Rs
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub

Sub send()
	username  = Checkstr(Request.Form("username"))
	tel  = Checkstr(Request.Form("tel"))
	email  = Checkstr(Request.Form("email"))
	address  = Checkstr(Request.Form("address"))
	title  = Checkstr(Request.Form("title"))
	Content  = Checkstr(Request.Form("Content"))
	UserID = Checkstr(Request.Form("UserID"))
	Call ChkIsNumber(UserID,"对不起,参数类型错误")
	Call ChkIsNull(username,"请输入联系人姓名")
	Call ChkIsNull(tel,"请输入联系电话")
	Call ChkIsNull(title,"请输入留言主题")
	Call ChkIsNull(Content,"请输入留言内容")
	Sql="Select * From T_Message"
	SetRs Rs,Sql,conn,1,3
	Rs.Addnew
	Rs("username")=username
	Rs("tel")=tel
	Rs("email")=email
	Rs("address")=address
	Rs("title")=title
	Rs("Content")=Content
	Rs("UserID")=UserID	
	Rs.Update	
	DisRs Rs
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub

'逻辑删除
Sub LogicDelMsg()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")	
	StrSql = "UPDATE T_Message SET Recycle=1 Where ID in (" & ChkBox & ")"
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success("记录已经成功删除!",request.ServerVariables("HTTP_REFERER"))	
End Sub

'物理删除/还原
Sub DelMsg()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")
	btnSubmit = Trim(Request("btnSubmit"))
	IF btnSubmit="还原" Then
		StrSql = "UPDATE T_Message SET Recycle=0 Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功还原!"
	Else
		StrSql = "DELETE FROM T_Message Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功删除!"
	End IF
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success(Msg,request.ServerVariables("HTTP_REFERER"))	
End Sub

Sub addaffiche()
	UserID  = Checkstr(Request.Form("UserID"))	
	Content  = Checkstr(Request.Form("Content"))
	Call ChkIsNumber(UserID,"对不起,参数类型错误")
	Sql="Select * From T_Note Where UserID=" & UserID
	SetRs Rs,Sql,conn,1,3
	IF Rs.Eof Then Rs.Addnew
	Rs("Content")=Content
	Rs("UserID")=UserID	
	Rs.Update	
	DisRs Rs
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub

Sub addlink()
	LinkName  = Checkstr(Request.Form("LinkName"))	
	LinkType  = Checkstr(Request.Form("LinkType"))	
	ID  = Checkstr(Request.Form("ID"))	
	Url  = Checkstr(Request.Form("Url"))	
	PicPath  = Checkstr(Request.Form("PicPath"))	
	SortID  = Checkstr(Request.Form("SortID"))	
	UserID  = Checkstr(Request.Form("UserID"))	
	Content  = Checkstr(Request.Form("Content"))
	Call ChkIsNumber(UserID,"对不起,参数类型错误")
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Call ChkIsNumber(SortID,"对不起,参数类型错误")
	Sql="Select * From T_FriendLink Where ID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Rs.Eof Then Rs.Addnew
	Rs("Content")=Content
	Rs("UserID")=UserID	
	Rs("LinkName")=LinkName	
	Rs("LinkType")=LinkType	
	Rs("Url")=Url	
	Rs("PicPath")=PicPath	
	Rs("SortID")=SortID	
	Rs.Update	
	DisRs Rs
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub
'逻辑删除
Sub LogicDelLink()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")	
	StrSql = "UPDATE T_FriendLink SET Recycle=1 Where ID in (" & ChkBox & ")"
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success("记录已经成功删除!",request.ServerVariables("HTTP_REFERER"))	
End Sub

'物理删除/还原
Sub DelLink()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")
	btnSubmit = Trim(Request("btnSubmit"))
	IF btnSubmit="还原" Then
		StrSql = "UPDATE T_FriendLink SET Recycle=0 Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功还原!"
	Else
		StrSql = "DELETE FROM T_FriendLink Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功删除!"
	End IF
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success(Msg,request.ServerVariables("HTTP_REFERER"))	
End Sub

'逻辑删除
Sub LogicDelTender()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")	
	StrSql = "UPDATE T_Tender SET Recycle=1 Where TenderID in (" & ChkBox & ")"
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success("记录已经成功删除!",request.ServerVariables("HTTP_REFERER"))	
End Sub

'物理删除/还原
Sub DelTender()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")
	btnSubmit = Trim(Request("btnSubmit"))
	IF btnSubmit="还原" Then
		StrSql = "UPDATE T_Tender SET Recycle=0 Where TenderID in (" & ChkBox & ")"
		Msg = "记录已经成功还原!"
	Else
		StrSql = "DELETE FROM T_Tender Where TenderID in (" & ChkBox & ")"
		Msg = "记录已经成功删除!"
	End IF
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success(Msg,request.ServerVariables("HTTP_REFERER"))	
End Sub

Sub addask()
	title  = Checkstr(Request.Form("title"))
	Content  = Checkstr(Request.Form("Content"))
	classid  = Checkstr(Request.Form("classid"))
	UserID = Checkstr(Request.Form("UserID"))	
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Call ChkIsNumber(UserID,"对不起,参数类型错误")
	Call ChkIsNull(title,"请输入标题")
	Sql="Select UserID,ClassID,Title,Content From T_Ask Where ID=" & ID
	SetRs Rs,Sql,conn,1,3
	IF Rs.Eof Then Rs.Addnew
	Rs("Title")=Title
	Rs("Content")=Content
	Rs("ClassID")=ClassID
	Rs("UserID")=UserID
	Rs.Update	
	DisRs Rs
	conn.execute("update t_users set score=score+"&QuestionScore&" where id="&UserID)
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub

'逻辑删除
Sub LogicDelAsk()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")	
	StrSql = "UPDATE T_Ask SET Recycle=1 Where ID in (" & ChkBox & ")"
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success("记录已经成功删除!",request.ServerVariables("HTTP_REFERER"))	
End Sub

'物理删除/还原
Sub DelAsk()
	Dim ID,StrSql,Cate
	ChkBox = Checkstr(Trim(Request("ChkBox")))
	Call ChkIsNull(ChkBox,"参数错误!请选择要删除的记录!")
	btnSubmit = Trim(Request("btnSubmit"))
	IF btnSubmit="还原" Then
		StrSql = "UPDATE T_Ask SET Recycle=0 Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功还原!"
	Else
		StrSql = "DELETE FROM T_Ask Where ID in (" & ChkBox & ")"
		Msg = "记录已经成功删除!"
	End IF
	SetRs Rs,StrSql,conn,1,3
	Call CloseDatabase
	Call Success(Msg,request.ServerVariables("HTTP_REFERER"))	
End Sub

Sub submitask()
	Call ChkLogin(Session("DjbUserName"))
	Content  = Checkstr(Request.Form("Content"))
	ID = Checkstr(Request.Form("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Call ChkIsNull(Content,"请输入回复内容")
	Sql="Select UserID,AskID,Content From T_Answer"
	SetRs Rs,Sql,conn,1,3
	Rs.Addnew
	Rs("Content")=Content
	Rs("UserID")=Session("DjbUserID")
	Rs("AskID")=ID
	Rs.Update	
	DisRs Rs
	conn.execute("update t_users set score=score+"&AnswerScore&" where id="&Session("DjbUserID"))
	conn.execute("update t_ask set icount=icount+1 where id="&ID)
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub

Sub good()
	ID = Checkstr(Request.QueryString("ID"))
	Call ChkIsNumber(ID,"对不起,参数类型错误")
	Sql="Select UserID,AskID,Good From T_Answer Where ID="&ID
	SetRs Rs,Sql,conn,1,3
	Rs("Good")=1
	UserID=Rs("UserID")
	AskID=Rs("AskID")
	Rs.Update	
	DisRs Rs
	conn.execute("update t_users set score=score+"&GoodScore&" where id="&UserID)
	conn.execute("update t_ask set IsOver=1 where id="&AskID)
	Call CloseDatabase
	Call Success("信息提交成功.",Request.ServerVariables("HTTP_REFERER"))
End Sub


'设置中标信息
Sub AcceptTender()
	business =1
	

	UserID = Request.QueryString("UserID")
	TenderID = Request.QueryString("TenderID")



	Call ChkIsNumber(UserID,"参数类型错误!")
	Call ChkIsNumber(TenderID,"参数类型错误!")
	'设置中标人成交量

	
	conn.execute("UPDATE T_Users Set Business=Business+" & business & " Where ID=" & UserID)
		
	IF business=1 Then
		Accept=1
	Else
		UserID=0
		Accept=0
	End IF
	'设置招标信息里中标人ID
	conn.execute("UPDATE T_Tender Set Accept=" & UserID & " Where TenderID=" & TenderID)

	Call CloseDatabase
	Call Success("信息提交成功!",Request.ServerVariables("HTTP_REFERER"))
	
	
End Sub


%>