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

📄 library.asp

📁 航空订票系统基于asp.net和sql2005包含数据库和图片
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
dim cpbm,ProductList
Sub PutToShopBag( cpbm, ProductList )
   If Len(ProductList) = 0 Then
      ProductList = "'" & cpbm & "'"
   ElseIf InStr( ProductList, cpbm ) <= 0 Then
      ProductList = ProductList & ", '" & cpbm & "'"
   End If
End Sub
'获取时间格式
Function GetFlyTime(str)
if str="-" or trim(str)="来电查询" then 
GetFlyTime = "来电查询"
Else
GetFlyTime = mid(str,1,2)&":"&mid(str,3,len(str))
End If
End Function
'格式化输出Html显示内容
Function ReplaceContent(str)
	If str&"" ="" Then Exit Function
	str = Replace(str,chr(32),"&nbsp;")
	str = Replace(str,chr(10),"<br>")
	ReplaceContent = str
End Function
'该函数获取类别下的所有子类,符合一般搜索习惯
'调用格式如i&getSort(i)
function getSort(i,ClassFatherId) 
	
	dim TypeRs,Sql,strSort,tempsql,rsT,rsTcount
	StrSort = ""
	'If strSort = "" Then strSort = i
	Sql="select * from sm_Class where ClassType="&ClassFatherId&" and FatherId="&i	
'response.Write(sql)
	Set TypeRs = oConn.execute(Sql)
	If TypeRs.Eof Then 
		Exit Function
	Else
		while not TypeRs.eof 
			strSort=strSort&","&TypeRs("ClassId") 
			tempsql = "select 1 from sm_Class where ClassType="&ClassFatherId&" and  FatherId = " & rsID
    		Set rsT = oConn.Execute(sql)
			rsTcount = rsT.RecordCount
			rsT.Close
			Set rsT=nothing
			'response.Write(strSort&"<br>")
			If rsTcount>0 then 
				strSort = strSort& getSort(TypeRs("ClassId"),ClassFatherId)
			End If
			Call getSort(TypeRs("ClassId"),ClassFatherId)
			TypeRs.movenext
		wend
	End If
	TypeRs.Close
	Set TypeRs = Nothing
	getSort = strSort
end function

'读出树状类别列表
Function SelectTreeList(startNodeID, deepNum,ClassId,ClassFatherId)
  Dim sql, rs, rsT, rsID, rsName, i, rsTC, rtnStr,strSelect
  rtnStr = ""
  sql = "select * from sm_Class where ClassType="&ClassFatherId&" And FatherId = " & startNodeID
   Set rs = oConn.Execute(sql)
  do while not rs.eof
    rsID = rs("classid") : rsName = rs("classname")
    strSelect = ""
	if rsId = ClassId then strSelect = " selected"
	'response.Write(strSelect)
    rtnStr = rtnStr & "<option value=""" & rsID & """"&strSelect&">"
    for i = 1 to deepNum
      rtnStr = rtnStr & "+"
    next
	'rtnStr = rtnStr + ">"
    rtnStr = rtnStr & rsName & "</option>"

    sql = "select 1 from sm_Class where ClassType="&ClassFatherId&" And FatherId = " & rsID
    Set rsT = oConn.Execute(sql)
    rsTC = rsT.RecordCount
    rsT.Close
    Set rsT = Nothing
    if rsTC > 0 then
      rtnStr = rtnStr & SelectTreeList(rsID, deepNum + 1,ClassId,ClassFatherId)
    end if

    rs.MoveNext
  loop
  rs.close
  set rs =nothing
  SelectTreeList = rtnStr
End Function

'读出树状类别列表,快速通道(用途:搜索)
Function SelectTreeListSearch(startNodeID,deepNum,ClassFatherId)
  Dim sql, rs, rsT, rsID, rsName, i, rsTC, rtnStr
  rtnStr = ""
  sql = "select * from Sm_Class where ClassType="&ClassFatherId&" And FatherId = " & startNodeID
  Set rs = oConn.Execute(sql)
  do while not rs.eof
    rsID = rs("classid") : rsName = rs("classname")
    rtnStr = rtnStr & "<option value=""" & thisurl& rsID & """"&strSelect&">"
    for i = 1 to deepNum
      rtnStr = rtnStr & "+"
    next
    rtnStr = rtnStr & rsName & "</option>"

    sql = "select 1 from Sm_Class Where ClassType="&ClassFatherId&" And FatherId = " & rsID
    Set rsT = oConn.Execute(sql)
    rsTC = rsT.RecordCount
    rsT.Close
    Set rsT = Nothing
    if rsTC > 0 then
      rtnStr = rtnStr & SelectTreeListSearch(rsId,deepNum+1,ClassFatherId)
    end if

    rs.MoveNext
  loop
  rs.close
  set rs =nothing
  SelectTreeListSearch = rtnStr
End Function


'-------- ??:??????SQL --------
Function Str2SQL(str)
  if str & "" = "" then
    Str2SQL = "Null"
  else
    Str2SQL = "'" & Replace(str, "'", "''") & "'"
  end if
End Function
'-------- ??:??????? --------
Function IsNotNull(str)
  if IsNull(str) = false and Trim(str) <> "" then IsNotNull = True else IsNotNull = False
End Function

Function N2BS(Item)
	if IsNotNull(Item) = True then N2BS = replace(Item," ","&nbsp;")
End Function
'===============================================================
'函数名称:获取字符串字节长度
'输入:fileUrl:Flash文件路径,fileWid:Flash显示宽度,fileHei:Flash显示高度
Function showFlash(fileUrl,fileWid,fileHei) 
  dim flashStr
  flashStr = "<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"" width=" & fileWid & " height=" & fileHei & ">" & vbcrlf & _
             "<param name=""movie"" value=""" & fileUrl & """>" & vbcrlf & _
             "<param name=""quality"" value=""high"">" & vbcrlf & _
             "<embed src=""" & fileUrl & """ quality=""high"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" type=""application/x-shockwave-flash"" width=""370"" height=""90""></embed>" & vbcrlf & _
             "</object>"
  showFlash = flashStr
End Function

'===============================================================
'函数名称:获取字符串字节长度
Function GetStrLen(str)
  ON ERROR RESUME NEXT
  Dim WINNT_CHINESE
  WINNT_CHINESE = (Len("中文") = 2)
  if WINNT_CHINESE then
    Dim l, t, c
    Dim i
    l = Len(str)
    t = l
    for i=1 to l
      c = Asc(Mid(str, i, 1))
      if c < 0 then c = c + 65536
      if c > 255 then t = t + 1
    next
    GetStrLen = t
  else 
    GetStrLen = Len(str)
  end if
  if Err.Number <> 0 then Err.clear
End Function

'===============================================================
'函数名称:截取字符串字节长度
Function CutStr(str, strlen)
	if str&"" = "" then exit Function
	Dim l, t, c
	l = Len(str)
	t = 0
	for i = 1 to l
    c = Abs(Asc(Mid(str, i, 1)))
    if c > 255 then
      t = t + 2
    else
      t = t + 1
    end if
    if t >= strlen then
      CutStr = Left(str, i) & "..."
      exit for
    else
      CutStr = str
    end if
	next
	CutStr = Replace(CutStr, Chr(10), "")
End Function

'===============================================================
'函数名称:JScript特殊符号编码
Function EncodeJScriptStr(str)
  if str <> "" then 
    str = Replace(str, "\", "\\")
    str = Replace(str, "'", "\'")
    str = Replace(str, """", "\""")
  end if
  EncodeJScriptStr = str
End Function

'===============================================================
'函数名称:XML特殊字符编码
Function EncodeXMLStr(str)
  if str <> "" then 
    str = replace(str, "&", "&amp;")
    str = replace(str, "<", "&lt;")
    str = replace(str, ">", "&gt;")
    str = replace(str, "'", "&apos;")
    str = replace(str, """", "&quote;")
  end if
  EncodeXMLStr = str
End Function
'返回顶类标题
Function ReturnTitle(id)
	Select Case id
		Case 1 
			str="国内出发地"
		Case 2 
			str="国内目的地"
		Case 3 
			str="国外出发地"		
		Case 4 
			str="国外目的地"	
		Case 5 
			str="网站公告"	
		Case 6 
			str="常见问题"	
		Case else
			str = "国内出发地"		
	End Select
	ReturnTitle = str
End Function
Function ReturnBasicName(id)
	Select Case id
		Case 1 
			str="机场管理"
		Case 2 
			str="国内航空公司管理"
		Case 3 
			str="国际航空公司管理"		
		Case else
			str = "机场管理"		
	End Select
	ReturnBasicName = str
End Function

Function ReturnFlyTitle(id)
	Select Case id
		Case 1 
			str="国际机票"
		Case 2 
			str="学生机票"
		Case 3 
			str="国内机票"		
		Case else
			str = "国际机票"		
	End Select
	ReturnFlyTitle = str
End Function
'===============================================================
'函数名称:XML特殊字符解码
Function DecodeXMLStr(str)
  if str <> "" then 
    str = replace(str, "&lt;", "<")
    str = replace(str, "&gt;", ">")
    str = replace(str, "&apos;", "'")
    str = replace(str, "&quote;", """")
    str = replace(str, "&amp;", "&")
  end if
  DecodeXMLStr = str
End Function

⌨️ 快捷键说明

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