
<!--#include file="../inc/Conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim rs,sql
dim ID
dim Title,Content,User,Action
dim ok,AddDatee,Hits
FoundErr=false

StrTitle="信息"

ID=Request.Form("ID")
Title=Trim(request.form("Title"))
Content=trim(request.form("Content"))
Content2=trim(request.form("Content2"))
Content3=trim(request.form("Content3"))
Content4=trim(request.form("Content4"))
keyword=Trim(request.form("keyword"))
Descriptions=trim(request.form("Description"))
User=Trim(request.form("User"))
UpdateTime=trim(request.form("UpdateTime"))
Hits=trim(request.form("Hits"))
Action=trim(request("Action"))
Area=trim(request("Area"))
Theme=trim(request("Theme"))
DefaultPicUrl=trim(request.form("DefaultPicUrl"))
Downurl=trim(request.form("Downurl"))
Mapurl=trim(request.form("Mapurl"))
Url1=trim(request.form("Url1"))
Url2=trim(request.form("Url2"))
Url3=trim(request.form("Url3"))
Url4=trim(request.form("Url4"))
elite=request("elite")
SNew=request("SNew")
Hot=request("Hot")
Choice=request("Choice")
Phone=request("Phone")
OrderID=request("OrderID")
Address=request("Address")
Bus=request("Bus")
TitleCon=request("TitleCon")
Mzk=request("Mzk")
IsOK=request("IsOK")
IsApply=request("IsApply")
QQ=request("QQ")
OrderEndTime=request("OrderEndTime")

if trim(request("Area")) = "请选择" then
	founderr=true
	errmsg="<li>请先选择地区</li>"
end if

if trim(request("Theme")) = "请选择" then
	founderr=true
	errmsg="<li>请先选择分类</li>"
end if

if Title="" then
	founderr=true
	errmsg="<li>"&StrTitle&"标题不能为空</li>"
end if

if founderr=false then	
	if UpdateTime<>"" and IsDate(UpdateTime)=true then
		UpdateTime=CDate(UpdateTime)
	else
		UpdateTime=now()
	end if
	
	if Hits<>"" then
		Hits=CLng(Hits)
	else
		Hits=0
	end if
	
	set rs=server.createobject("adodb.recordset")
	select case Action
	  case "Add"	
		sql="select * from Dream_Menpiao where (id is null)" 
		rs.open sql,conn,1,3
		rs.addnew
		call SaveData()		
		rs.update	
		rs.close
		set rs=nothing
		response.redirect "Menpiao_Manage.asp?mkid="&mkid
	 case "Modify"	
  		if ID<>"" then
			sql="select * from Dream_Menpiao where id="&ID
			rs.open sql,conn,1,3
			if not (rs.bof and rs.eof) then
			    
				call SaveData()				
				rs.update
				rs.close
				set rs=nothing
	            response.redirect "Menpiao_Manage.asp?mkid="&mkid
 			else
				founderr=true
				errmsg=errmsg+"<li>找不到此"&StrTitle&"，可能已经被删除。</li>"
				call WriteErrMsg()
			end if
		else
			founderr=true
			errmsg=errmsg+"<li>不能确定ID的值</li>"
			call WriteErrMsg()
		end if
	 Case else
		founderr=true
		errmsg=errmsg+"<li>没有选定参数</li>"
		call WriteErrMsg()
	end select
	call CloseConn()
else
	WriteErrMsg
end if
%>

<%
sub SaveData()  
  rs("Dream_Title")=Title
  rs("Dream_Content")=Content
  rs("Dream_Content2")=Content2
  rs("Dream_Content3")=Content3
  rs("Dream_Content4")=Content4
  rs("Dream_User")=User
  rs("Dream_UpdateTime")=UpdateTime
  rs("Dream_Description")=Descriptions
  rs("Dream_keyword")=keyword
  rs("Dream_DefaultPicUrl")=DefaultPicUrl
  rs("Dream_DownUrl")=Downurl
  rs("Dream_Url1")=Url1
  rs("Dream_Url2")=Url2
  rs("Dream_Url3")=Url3
  rs("Dream_Url4")=Url4
  rs("Dream_MapUrl")=Mapurl
  rs("Dream_Area")=Area
  rs("Dream_Theme")=Theme
  rs("Dream_Address")=Address
  rs("Dream_TitleCon")=TitleCon
  rs("Dream_Bus")=Bus
  rs("Dream_QQ")=QQ
  rs("Dream_IsApply")=IsApply  
  if OrderEndTime<>"" then
  rs("Dream_OrderEndTime")=OrderEndTime
  end if
  rs("Dream_Phone")=Phone
  if OrderID<>"" then
  rs("Dream_OrderID")=OrderID
  end if
  if IsOK="yes" then
	rs("Dream_IsOK")=true
  else
    rs("Dream_IsOK")=false
  end if
  
  if Mzk="yes" then
	rs("Dream_Mzk")=true
  else
    rs("Dream_Mzk")=false
  end if
  
  if elite="yes" then
	rs("Dream_Elite")=true
	rs("Dream_EliteTime")=now()
  else
    rs("Dream_Elite")=false
  end if
  
  if Hot="yes" then
	rs("Dream_Hot")=true
	rs("Dream_HotTime")=now()
  else
    rs("Dream_Hot")=false
  end if
  
  if SNew="yes" then
	rs("Dream_New")=true
	rs("Dream_NewTime")=now()
  else
    rs("Dream_New")=false
  end if
  
  if Choice="yes" then
	rs("Dream_Choice")=true
	rs("Dream_ChoiceTime")=now()
  else
    rs("Dream_Choice")=false
  end if
  
end sub
%>