HS_Tenancy_Action.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:7k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../../FS_Inc/Function.asp" -->
  5. <!--#include file="../../FS_Inc/Func_page.asp" -->
  6. <!--#include file="../lib/strlib.asp" -->
  7. <!--#include file="../lib/UserCheck.asp" -->
  8. <%'Copyright (c) 2006 Foosun Inc. Code by Einstein.liu
  9. Dim tid,action,tenancyRs,sqlstatement,i
  10. Dim floorArray(2), HouseStyleArray(3)
  11. DIm t_TID,t_UseFor,t_Class,t_Position,t_CityArea,t_Price,t_HouseStyle,t_Area,t_Floor,t_BuildDate,t_equip,t_Decoration,t_LinkMan,t_Contact,t_period,t_Remark,t_PubDate,t_Audited,t_PicNumber
  12. MF_Default_Conn
  13. action=request.QueryString("action")
  14. tid=NoSqlHack(request("id"))
  15. response.Charset="GB2312"
  16. if action="delete" then
  17. Conn.execute("Delete from FS_HS_Tenancy where tid in ("&tid&")")
  18. Response.Write("ok")
  19. response.End()
  20. elseif action="add" then'------------------------------------------------------------------------------------------
  21. Set tenancyRs=Server.CreateObject(G_FS_RS)
  22. sqlstatement="select TID,UseFor,Class,Position,CityArea,Price,HouseStyle,Area,Floor,BuildDate,equip,Decoration,LinkMan,Contact,Period,Remark,PubDate,Audited,PicNumber,UserNumber from FS_HS_Tenancy"
  23. t_usefor=trim(request.Form("sel_usefor"))
  24. t_class=trim(request.Form("sel_class"))
  25. t_Position=trim(request.Form("txt_Position"))
  26. t_cityarea=trim(request.Form("txt_cityarea"))
  27. HouseStyleArray(0)="1"
  28. HouseStyleArray(1)="1"
  29. HouseStyleArray(2)="1"
  30. if trim(request.Form("txt_HouseStyle_1"))<>"" then HouseStyleArray(0)=trim(request.Form("txt_HouseStyle_1"))
  31. if trim(request.Form("txt_HouseStyle_2"))<>"" then HouseStyleArray(1)=trim(request.Form("txt_HouseStyle_2"))
  32. if trim(request.Form("txt_HouseStyle_3"))<>"" then HouseStyleArray(2)=trim(request.Form("txt_HouseStyle_3"))
  33. t_HouseStyle=HouseStyleArray(0)&","&HouseStyleArray(1)&","&HouseStyleArray(2)
  34. t_BuildDate=trim(request.Form("txt_BuildDate"))
  35. t_Area=trim(request.Form("txt_Area"))
  36. floorArray(0)="0"
  37. floorArray(1)="0"
  38. if trim(request.Form("txt_Floor_1"))<>"" then  floorArray(0)=trim(request.Form("txt_Floor_1"))
  39. if trim(request.Form("txt_Floor_2"))<>"" then  floorArray(1)=trim(request.Form("txt_Floor_2"))
  40. t_floor=floorArray(0)&","&floorArray(1)
  41. t_equip=request.Form("chk_equip")
  42. t_Decoration=request.Form("sel_Decoration")
  43. t_price=request.Form("txt_Price")
  44. t_LinkMan=request.Form("txt_LinkMan")
  45. t_contact=request.Form("txt_Contact")
  46. t_Period=request.Form("txt_Period")
  47. t_Remark=request.Form("txt_Remark")
  48. t_picNumber=request.Form("PicNum")
  49. t_pubDate=DateValue(Now)
  50. t_Audited=0
  51. tenancyRs.open sqlstatement,Conn,1,3
  52. tenancyRs.addnew
  53. tenancyRs("UseFor")=t_usefor
  54. tenancyRs("Class")=t_class
  55. tenancyRs("Position")=t_Position
  56. tenancyRs("CityArea")=t_cityarea
  57. tenancyRs("HouseStyle")=t_HouseStyle
  58. tenancyRs("Area")=t_Area
  59. if t_price="" then t_price=0
  60. tenancyRs("Price")=t_Price
  61. tenancyRs("Floor")=t_Floor
  62. if tenancyRs("BuildDate")="" then t_BuildDate=0
  63. tenancyRs("BuildDate")=t_BuildDate
  64. tenancyRs("equip")=t_equip
  65. tenancyRs("Decoration")=t_Decoration
  66. tenancyRs("Period")=t_Period
  67. tenancyRs("LinkMan")=t_LinkMan
  68. tenancyRs("contact")=t_contact
  69. tenancyRs("Remark")=t_Remark
  70. tenancyRs("PubDate")=t_PubDate
  71. tenancyRs("Audited")=t_Audited
  72. tenancyRs("UserNumber")=session("FS_UserNumber")
  73. t_picNumber=trim(request.Form("txt_PicNum"))
  74. if t_picNumber="" then t_picNumber=0
  75. tenancyRs("picNumber")=t_picNumber
  76. tenancyRs.update
  77. if Cint(t_picNumber)>0 then
  78. for i=0 to Cint(t_picNumber)
  79. if trim(request.Form("txt_PicNum_"&(i+1)))<>"" then
  80. Conn.execute("Insert into FS_HS_Picture (HS_Type,ID,PIC) values(2,"&tenancyRs("tID")&",'"&request.Form("txt_PicNum_"&(i+1))&"')")
  81. End if
  82. next
  83. End if
  84. tenancyRs.close
  85. elseif action="edit" then
  86. Set tenancyRs=Server.CreateObject(G_FS_RS)
  87. sqlstatement="select TID,UseFor,Class,Position,CityArea,Price,HouseStyle,Area,Floor,BuildDate,equip,Decoration,LinkMan,Contact,Period,Remark,PubDate,Audited,PicNumber,UserNumber from FS_HS_Tenancy where tid="&tid
  88. t_usefor=trim(request.Form("sel_usefor"))
  89. t_class=trim(request.Form("sel_class"))
  90. t_Position=trim(request.Form("txt_Position"))
  91. t_cityarea=trim(request.Form("txt_cityarea"))
  92. HouseStyleArray(0)="1"
  93. HouseStyleArray(1)="1"
  94. HouseStyleArray(2)="1"
  95. if trim(request.Form("txt_HouseStyle_1"))<>"" then HouseStyleArray(0)=trim(request.Form("txt_HouseStyle_1"))
  96. if trim(request.Form("txt_HouseStyle_2"))<>"" then HouseStyleArray(1)=trim(request.Form("txt_HouseStyle_2"))
  97. if trim(request.Form("txt_HouseStyle_3"))<>"" then HouseStyleArray(2)=trim(request.Form("txt_HouseStyle_3"))
  98. t_HouseStyle=HouseStyleArray(0)&","&HouseStyleArray(1)&","&HouseStyleArray(2)
  99. t_BuildDate=trim(request.Form("txt_BuildDate"))
  100. t_Area=trim(request.Form("txt_Area"))
  101. if trim(request.Form("txt_Floor_1"))<>"" then  floorArray(0)=trim(request.Form("txt_Floor_1"))
  102. if trim(request.Form("txt_Floor_2"))<>"" then  floorArray(1)=trim(request.Form("txt_Floor_2"))
  103. t_floor=floorArray(0)&","&floorArray(1)
  104. t_equip=request.Form("chk_equip")
  105. t_Decoration=request.Form("sel_Decoration")
  106. t_price=request.Form("txt_Price")
  107. t_LinkMan=request.Form("txt_LinkMan")
  108. t_contact=request.Form("txt_Contact")
  109. t_Period=request.Form("txt_Period")
  110. t_Remark=request.Form("txt_Remark")
  111. t_picNumber=request.Form("PicNum")
  112. t_pubDate=DateValue(Now)
  113. t_Audited=0
  114. tenancyRs.open sqlstatement,Conn,1,3
  115. tenancyRs("UseFor")=t_usefor
  116. tenancyRs("Class")=t_class
  117. tenancyRs("Position")=t_Position
  118. tenancyRs("HouseStyle")=t_HouseStyle
  119. tenancyRs("Area")=t_Area
  120. tenancyRs("CityArea")=t_cityarea
  121. if t_price="" then t_price=0
  122. tenancyRs("Price")=t_Price
  123. tenancyRs("Floor")=t_Floor
  124. if tenancyRs("BuildDate")="" then t_BuildDate=0
  125. tenancyRs("BuildDate")=t_BuildDate
  126. tenancyRs("equip")=t_equip
  127. tenancyRs("Decoration")=t_Decoration
  128. tenancyRs("Period")=t_Period
  129. tenancyRs("Remark")=t_Remark
  130. tenancyRs("LinkMan")=t_LinkMan
  131. tenancyRs("contact")=t_contact
  132. tenancyRs("PubDate")=t_PubDate
  133. tenancyRs("Audited")=t_Audited
  134. tenancyRs("UserNumber")=session("FS_UserNumber")
  135. t_picNumber=trim(request.Form("txt_PicNum"))
  136. if t_picNumber="" then t_picNumber=0
  137. tenancyRs("picNumber")=t_picNumber
  138. tenancyRs.update
  139. if Cint(t_picNumber)>0 then
  140. for i=0 to Cint(t_picNumber)
  141. if trim(request.Form("txt_PicNum_"&(i+1)))<>"" then
  142. Conn.execute("Insert into FS_HS_Picture (HS_Type,ID,PIC) values(2,"&tenancyRs("tid")&",'"&request.Form("txt_PicNum_"&(i+1))&"')")
  143. End if
  144. next
  145. End if
  146. tenancyRs.close
  147. End if
  148. Conn.close
  149. User_Conn.close
  150. Set User_Conn=nothing
  151. Set Conn=nothing
  152. Set tenancyRs=nothing
  153. if err.number=0 then
  154. Response.Redirect("../success.asp?ErrCodes=<li>操作成功</li>&ErrorURL=House/HS_Tenancy.asp")
  155. Response.End()
  156. Else
  157. Response.Redirect("../error.asp?ErrCodes=<li>请检查输入是否合法</li>")
  158. Response.End()
  159. End if
  160. %>