⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jpmanage.asp

📁 航空订票系统基于asp.net和sql2005包含数据库和图片
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="../global/inc/CheckSession.asp"-->
<!--#include file="../global/inc/global.inc.asp"-->
<%
		Rem 新闻
		Dim cmd, oDict, oTemplate	
		'全局变量		
		Dim strSQL,InterId,ClassId,thisurl
		'获取搜索字段开始
		ClassId = Request("ClassId")
		Key = Request("Key")
		'获取搜索字段结束
		'FlyFlag 为总分类id号
		Dim FlyFlag:FlyFlag = Request.QueryString("FlyFlag")
		'Response.Write(FlyFlag)
		'Response.End()
		'输出类名
		ClassName = ReturnFlyTitle(FlyFlag)
		'设置标题
		Sub SetFlyNo()
			dict("#FatherFlyNoId#") = FlyFlag
			dict("#FatherFlyNo#") = ClassName
			oDict("template") = oTemplate.ReplaceMacros(oDict("template"),dict)
		End Sub
		
		Set oDict = Server.CreateObject("Scripting.Dictionary")
		set dict = server.CreateObject("scripting.dictionary")
		'类实例化
		Set oTemplate = New Cls_Template	
		'获取动作参数
		cmd = Request("cmd")		
		select case cmd
		case "delete"
			Delete
		case "save"
			Save
		case "add"
			Add
		'列表操作	
		case "News_EditDel"
			News_EditDel
		end select		
		oDict("template") = oTemplate.Load(server.MapPath("jpManage.asp"))
		oDict("template") = oTemplate.GetPart(oDict("template"),chr(60) & "!--body-->",chr(60) & "!--//body-->")
		'处理信息
		select case cmd
		case "edit"
			ShowEdit
		case "new"
			ShowNew
		case else
			ShowList
		end select		
		'显示内容
		SetFlyNo
		Response.Write oDict("template")		
		'销毁对象
		Set oDict = Nothing
		Set oTemplate = Nothing
		Response.End			
'----------------------------------------------------------
'页面相关处理函数说明
'
'
'
'
'__________________________________________________________		
	function Add()
		CompanyId = Request.Form("CompanyId")
		FlyId = Request.Form("FlyId")
		FromClassId = Request.Form("FromClassId")
		'InterId = Request.Form("InterId")
		ValidFlag = Request.Form("ValidFlag")
		ToClassId = Request.Form("ToClassId")
		FlyNo = Request.Form("FlyNo")
		RecommendFlag = Request.Form("RecommendFlag")
		FromTime = Request.Form("FromTime")
		FlyDoublePrice = Request.Form("FlyDoublePrice")
		FlyWeekNo = Request.Form("FlyWeekNo")
		ToTime = Request.Form("ToTime")
		FlyType = Request.Form("FlyType")
		FlyPrice = Request.Form("FlyPrice")		
		For i = 1 To Request.Form("FlyMemo").Count
			FlyMemo = FlyMemo & Request.Form("FlyMemo")(i)
		Next	

	    oConn_Start
		sql = "Select * From Sm_InterFly Order by InterId Desc"
		Set oRs = Server.CreateObject("Adodb.RecordSet")
		oRs.Open sql,oConn,1,3
		oRs.Addnew
			oRs("FlyMemo") = FlyMemo
			oRs("ValidFlag") = ValidFlag
			oRs("FromClassId") = FromClassId
			oRs("CompanyId") = CompanyId
			oRs("FlyId") = FlyId
			oRs("ToClassId") = ToClassId
			oRs("FlyNo") = FlyNo
			oRs("RecommendFlag") = RecommendFlag
			oRs("FromTime") = FromTime
			oRs("FlyDoublePrice") = FlyDoublePrice
			oRs("FlyWeekNo") = FlyWeekNo
			oRs("ToTime") = ToTime
			oRs("FlyType") = FlyType
			oRs("FlyPrice") = FlyPrice
			oRs("FlyFlag") = FlyFlag
		oRs.Update
		oRs.close
		Set oRs = Nothing
		oConn_Close			
		response.Redirect "jpManage.asp?FlyFlag="&FlyFlag
	end function

	function Save()
		CompanyId = Request.Form("CompanyId")
		FlyId = Request.Form("FlyId")
		FromClassId = Request.Form("FromClassId")
		InterId = Request.Form("InterId")
		ValidFlag = Request.Form("ValidFlag")
		ToClassId = Request.Form("ToClassId")
		FlyNo = Request.Form("FlyNo")
		RecommendFlag = Request.Form("RecommendFlag")
		FromTime = Request.Form("FromTime")
		FlyDoublePrice = Request.Form("FlyDoublePrice")
		FlyWeekNo = Request.Form("FlyWeekNo")
		ToTime = Request.Form("ToTime")
		FlyType = Request.Form("FlyType")
		FlyPrice = Request.Form("FlyPrice")		

		For i = 1 To Request.Form("FlyMemo").Count
			FlyMemo = FlyMemo & Request.Form("FlyMemo")(i)
		Next
			
		'数据操作
		sql = "select * From Sm_InterFly Where InterId= "&Clng(InterId)		
		
	    oConn_Start
		set oRs = Server.CreateObject("Adodb.RecordSet")
		oRs.open sql,oConn,1,3
		If oRs.Eof Then
			oRs.Close
			Set oRs = Nothing
			oConn_Close
			InfoErrorWrite("系统中找不到该项目")
		Else 
			oRs("FlyMemo") = FlyMemo
			oRs("ValidFlag") = ValidFlag
			oRs("ToClassId") = ToClassId
			oRs("FromClassId") = FromClassId
			oRs("CompanyId") = CompanyId
			oRs("FlyId") = FlyId
			oRs("FlyNo") = FlyNo
			oRs("RecommendFlag") = RecommendFlag
			oRs("FromTime") = FromTime
			oRs("FlyDoublePrice") = FlyDoublePrice
			oRs("FlyWeekNo") = FlyWeekNo
			oRs("ToTime") = ToTime
			oRs("FlyType") = FlyType
			oRs("FlyPrice") = FlyPrice
			oRs.Update
		End If		
		oRs.close
		Set oRs = Nothing
		oConn_Close
		response.Redirect "jpManage.asp?FlyFlag="&FlyFlag
	end function

	function Delete()
		dim InterId,sql
		InterId = cint(Request("InterId"))
		oConn_Start
		sql = "Delete From Sm_InterFly Where InterId = "&InterId
		oConn.execute sql
		oConn_Close
		response.Redirect("jpManage.asp?FlyFlag="&FlyFlag)
	end function
	'________________________________________________
	'删除新闻
	Sub DeleteClass(id) 
		  
		strSQL="delete from [Sm_InterFly] where InterId="&cstr(id)
		'DELSQL(id)
		'response.Write(strSql)
		'response.End()
		Oconn.execute strSQL
	End sub
	'修改新闻
	Sub ModifyClass(id)
		Dim FlyNo,ValidFlag,ClassId
		ValidFlag = Request.Form("ValidFlag"&id)
		RecommendFlag = Request.Form("RecommendFlag"&id)
		sql="Update [Sm_InterFly] set ValidFlag="&ValidFlag&",RecommendFlag="&RecommendFlag&" Where InterId="&id
		'response.write sql
		'response.End()
		oConn.execute sql
	End Sub

	
	'循环操作数据函数
	Sub News_EditDel
		oConn_Start
		if not isempty(request("selAnnounce")) then
			dim idlist,act
			idlist=request("selAnnounce")
			act=Request.Form("act")
			'response.Write(idlist&act)
			'response.End()
			dim idarr '定义储存数组
			dim id
			if act="删 除" then
				   if instr(idlist,",")>0 then
						 idArr=split(idlist)
						 for i = 0 to ubound(idarr)
						   id=clng(idarr(i))
							 call DeleteClass(id)
						   next
				   else
						call DeleteClass(clng(idlist))
				   end if
			 elseif act="修 改" then
				if instr(idlist,",")>0 then
					 idArr=split(idlist)		 
					 for i = 0 to ubound(idarr)
						 id=clng(idarr(i))
						 call ModifyClass(id)
					 next
				else
					  call ModifyClass(clng(idlist))
				end if
			end if
		else
			call InfoErrorWrite("至少应该选择一项信息才能操作")
		end if	
		oConn_Close
		Call InfoErrorDisplay("修改成功","jpManage.asp?FlyFlag="&FlyFlag)
	End Sub	
'关于显示的操作函数	
	function ShowEdit()
		dim id,oRs,sql,InterId
		dim body,dict     
		InterId = cint(Request("InterId"))        
		body  = oTemplate.GetPart(oDict("template"),"<!--edit-->","<!--//edit-->")
		set dict = server.CreateObject("scripting.dictionary")
	    oConn_Start
		sql = "select * from Sm_InterFly where InterId = " & InterId 
		Set oRs = oConn.Execute(sql)

		if oRs.eof then
			Set oRs = Nothing
			oConn_Close
			InfoErrorWrite("系统出错找不到该项")			
		end if			
		dict("#cmd#") = "save"
		If oRs("ValidFlag")=1 then
			 dict("#check1#") = " checked" 
		Else
			 dict("#check2#") = " checked"
		End If		
		If oRs("RecommendFlag")=1 then
			 dict("#check3#") = " checked" 
		Else
			 dict("#check4#") = " checked"
		End If	
		dict("#FromClassIdOptions#") = GetOptions("Select ClassId as id,ClassName as name from sm_Class Where ClassType=3 And FatherId=0 And ValidFlag=1",oRs("FromClassId"))
        dict("#FlyIdOptions#") = GetOptions("Select BasicId as id,BasicName as name from sm_BasicParam Where BasicType=1 And ValidFlag=1",oRs("FlyId"))
		dict("#CompanyIdOptions#") = GetOptions("Select BasicId as id,BasicName as name from sm_BasicParam Where BasicType=3 And ValidFlag=1",oRs("CompanyId"))

		dict("#InterId#") = oRs("InterId")
		dict("#FlyMemo#") = Null2Space(Server.HTMLEncode(oRs("FlyMemo")&""))
		ToClassId = oRs("ToClassId")
		dict("#FlyNo#") = oRs("FlyNo")
		dict("#RecommendFlag#") = oRs("RecommendFlag")
		dict("#FromTime#") = oRs("FromTime")
		dict("#FlyDoublePrice#") = oRs("FlyDoublePrice")
		dict("#FlyWeekNo#") = oRs("FlyWeekNo")
		dict("#ToTime#") = oRs("ToTime")
		dict("#FlyType#") = oRs("FlyType")
		dict("#FlyPrice#") = oRs("FlyPrice")

        dict("#input#") = "修改"&ClassName		
		oRs.close
Set oRs = oConn.Execute("select ClassName From sm_Class Where ClassId="&ToClassId)
if Not oRs.Eof Then
dict("#ToClassIdOption#") = "<option value='"&ToClassId&"' selected>"&oRs(0)&"</option>"
End If
oRs.Close
		set oRs = nothing
		body = oTemplate.ReplaceMacros(body,dict)
		oDict("template") = oTemplate.ReplacePart(oDict("template"),"<!--list-->","<!--//list-->",body)
		oConn_Close
		set dict = nothing
	end function

	function ShowNew()
		dim id,sql
		dim body,dict        
		body  = oTemplate.GetPart(oDict("template"),"<!--edit-->","<!--//edit-->")
		set dict = server.CreateObject("scripting.dictionary")	    
		dict("#cmd#") = "add"
		dict("#InterId#") = ""
		oConn_Start
		dict("#FromClassIdOptions#") = GetOptions("Select ClassId as id,ClassName as name from sm_Class Where ClassType=3 And FatherId=0 And ValidFlag=1",null)
        dict("#FlyIdOptions#") = GetOptions("Select BasicId as id,BasicName as name from sm_BasicParam Where BasicType=1 And ValidFlag=1",null)
		dict("#CompanyIdOptions#") = GetOptions("Select BasicId as id,BasicName as name from sm_BasicParam Where BasicType=3 And ValidFlag=1",null)
		oConn_Close
		dict("#check1#") =" checked" 
		dict("#check4#") =" checked" 

		dict("#FlyMemo#") = ""
		dict("#ValidFlag#") = ""
		dict("#ToClassId#") = ""
		dict("#FlyNo#") = ""
		dict("#RecommendFlag#") = ""
		dict("#FromTime#") = ""
		dict("#FlyDoublePrice#") = ""
		dict("#FlyWeekNo#") = ""
		dict("#ToTime#") = ""
		dict("#FlyType#") = ""
		dict("#FlyPrice#") = ""
		dict("#input#") = "添加"&ClassName
		body = oTemplate.ReplaceMacros(body,dict)
		oDict("template") = oTemplate.ReplacePart(oDict("template"),"<!--list-->","<!--//list-->",body)
		set dict = nothing
	end function

	function ShowList()
		dim pagesize
		if IsEmpty(request("pagesize")) then
		    pagesize = ListRowsMax
		else
			pagesize = cint(request("pagesize"))
		end if
		'打开数据库
	    oConn_Start		
		dim body,loopT,loopH,arrClassId
		thisurl = "jpManage.asp?FlyFlag="&FlyFlag&"&classid="
		dim page,sql,oRs,pagecount,recordcount,rows
		dim dict		
		set dict = server.CreateObject("scripting.dictionary")
		'获取快速通道的下拉列表
		dict("#rapidoption#") = SelectTreeListSearch(0,0,FlyFlag)
		dict("#key#") = key
		dict("#ClassId#") = ClassId
		page = cint(Request("page"))        
		body  = oTemplate.GetPart(oDict("template"),"<!--newslist-->","<!--//newslist-->")
		loopT = oTemplate.GetPart(body,"<!--loop-->","<!--//loop-->")	
		set oRs = server.CreateObject("adodb.recordset")
		'获取该分类下的所有子分类
		If ClassId="" Then
		arrClassId = FlyFlag&""&getSort(0,FlyFlag)		
		Else
		arrClassId = ClassId&""&getSort(ClassId,FlyFlag)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -