PageRenderTime 29ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/db/admin/store_edit.asp

https://github.com/semious/dynacomcorp
ASP | 242 lines | 232 code | 9 blank | 1 comment | 18 complexity | e3320d1b2fd1476a1bff1e43935c20c1 MD5 | raw file
  1. <!--#include file="conn.asp"-->
  2. <!--#include file="IsAdmin.asp" -->
  3. <html>
  4. <head>
  5. <title>Edit Store</title>
  6. <link rel="stylesheet" href="css/style.css">
  7. </head>
  8. <body>
  9. <%
  10. Response.Buffer = True
  11. Response.ExpiresAbsolute = Now() - 1
  12. Response.Expires = 0
  13. Response.CacheControl = no-cache
  14. dim edit,id,sql
  15. dim rs
  16. dim flag
  17. flag=0
  18. set rs =server.createobject("adodb.recordset")
  19. edit=trim(request("action"))
  20. id=trim(cstr(request("id")))
  21. 'delete item
  22. if edit = "delete" then
  23. sql = "delete from distributor where id = " & id
  24. conn.execute sql
  25. response.Write("<div style='margin:50px 0 0 200px;font-weight:bold;'>This Store has been deleted.</div>")
  26. response.End()
  27. end if
  28. %>
  29. <script language="javascript">
  30. function confirmDel(id,page){
  31. if (confirm("Are you sure?")){
  32. window.location.href = "store_edit.asp?action=delete&id=" + id+ "&page="+page ;
  33. }
  34. }
  35. function checkdata() {
  36. if (document.DocForm.name.value.length ==0 ) {
  37. alert("Store should not be left blank!")
  38. document.DocForm.name.focus()
  39. return false;
  40. }
  41. if (document.DocForm.address.value.length ==0) {
  42. alert("address should not be left blank!")
  43. document.DocForm.address.focus()
  44. return false;
  45. }
  46. if (document.DocForm.pic.value.length ==0 ) {
  47. alert("You must have a picture !")
  48. document.DocForm.pic.focus()
  49. return false;
  50. }
  51. if (document.DocForm.tel.value.length ==0) {
  52. alert("telephone number should not be left blank!")
  53. document.DocForm.tel.focus()
  54. return false;
  55. }
  56. if (document.DocForm.zone.value.length ==0) {
  57. alert("zone should not be left blank!")
  58. document.DocForm.zone.focus()
  59. return false;
  60. }
  61. return true;
  62. }
  63. //window.onload = function(){
  64. //// document.forms[0]["des"].value = unescape(document.forms[0]["des"].value);
  65. //}
  66. </script>
  67. <div align="center">
  68. <p><font size="4"><b>Store Information</b></font></p>
  69. </div>
  70. <div>
  71. <%
  72. if edit="edit" then
  73. sql="select * from distributor where id = " & id
  74. else
  75. sql="select top 1 * from distributor"
  76. end if
  77. rs.open sql,conn,1,3
  78. if rs.eof and rs.bof then
  79. response.write "No Information"
  80. response.End()
  81. else
  82. %>
  83. <table border="1px" cellspacing="0" width="754" bordercolor="#000000" cellpadding="0" align="left" style="margin:0 0 0 10px; font-size:14px;">
  84. <tr>
  85. <td width="161" align="center" bgcolor="#FEEC85" style="border:1px #000000 solid">
  86. <strong>Store Name</strong> </td>
  87. <td width="241" align="center" bgcolor="#FEEC85" style="border:1px #000000 solid">
  88. <strong>Address</strong></td>
  89. <td width="120" align="center" bgcolor="#FEEC85" style="border:1px #000000 solid">
  90. <b>Telephone</b></td>
  91. <td width="80" align="center" bgcolor="#FEEC85" style="border:1px #000000 solid">
  92. <b>Zone</b></td>
  93. <td width="40" align="center" bgcolor="#FEEC85" style="border:1px #000000 solid">
  94. <b>Del</b></td>
  95. <td width="40" align="center" bgcolor="#FEEC85" style="border:1px #000000 solid">
  96. <b>View</b></td>
  97. </tr>
  98. <%
  99. dim curpage,i
  100. if request("page")="" then
  101. curpage = 1
  102. else
  103. curpage = cint(request("page"))
  104. end if
  105. rs.pagesize = 12
  106. rs.absolutepage = curpage
  107. for i = 1 to rs.pagesize
  108. %>
  109. <tr>
  110. <td bgcolor="#FFFCD9" style="border:1px #000000 solid">
  111. <p align="center" bgcolor="#E8E8E8"><%=rs("name")%>
  112. </td>
  113. <td bgcolor="#FFFCD9" style="border:1px #000000 solid">
  114. <p align="center"><%=rs("address")%>
  115. </td>
  116. <td bgcolor="#FFFCD9" style="border:1px #000000 solid">
  117. <p align="center"><%=rs("tel")%>
  118. </td>
  119. <td bgcolor="#FFFCD9" style="border:1px #000000 solid">
  120. <p align="center"><%=rs("zone")%>
  121. </td>
  122. <td bgcolor="#FFFCD9" style="border:1px #000000 solid">
  123. <p align="center"><a href='javascript:confirmDel(<%= rs("id")%>,<%=cstr(curpage)%>)'>Del</a>
  124. </td>
  125. <td bgcolor="#FFFCD9" style="border:1px #000000 solid">
  126. <p align="center"><a href="../distributors.asp#<%=rs("name")%>" target="_blank">View</a>
  127. </td>
  128. </tr>
  129. <%
  130. rs.movenext
  131. if rs.eof then
  132. i = i + 1
  133. exit for
  134. end if
  135. next
  136. %>
  137. </table>
  138. </div>
  139. <p>
  140. <%
  141. rs.close
  142. end if
  143. if edit="edit" then
  144. set fs=server.createobject("adodb.recordset")
  145. sql="select * from distributor where id = " & id
  146. fs.open sql,conn,1,3
  147. %>
  148. </p>
  149. <p>&nbsp;</p>
  150. <p>&nbsp;</p>
  151. <form onSubmit="return checkdata()" name="DocForm" action="store_add2.asp">
  152. <table border="1" cellspacing="0" width="668" bordercolor="#000000" cellpadding="1" style="margin:0 0 0 20px;font-size:14px;">
  153. <tr>
  154. <td width="15%"></td>
  155. <td width="35%"></td>
  156. <td width="15%"></td>
  157. <td width="35%"></td>
  158. </tr>
  159. <tr align="center">
  160. <td colspan="4" height="20" style="border:1px solid #000000; background-color:FEEC85">
  161. <div align="center"><font color="#FF0000"><b>Detail Information</b></font></div>
  162. </td>
  163. </tr>
  164. <tr align="center">
  165. <td width="110" style="border:1px solid #000000">
  166. <div align="right">Store Name:</div>
  167. </td>
  168. <td colspan="3" style="border:1px solid #000000;padding:0 0 0 10px;">
  169. <div align="left"><input name="name" value="<%=fs("name")%>" size="60" /></div>
  170. </td>
  171. </tr>
  172. <tr>
  173. <td width="94" style="border:1px solid #000000">
  174. <div align="right">Address1:</div>
  175. </td>
  176. <td style="border:1 solid #000000;padding:0 0 0 10px;" colspan="3" align="left">
  177. <div align="left"><textarea name="address" cols="60" rows="1"><%=fs("address")%></textarea></div>
  178. </td>
  179. </tr>
  180. <tr>
  181. <td width="94" style="border:1px solid #000000">
  182. <div align="right">Address2:</div>
  183. </td>
  184. <td style="border:1 solid #000000;padding:0 0 0 10px;" colspan="3" align="left">
  185. <div align="left"><textarea name="address1" cols="60" rows="1"><%=fs("address1")%></textarea></div>
  186. </td>
  187. </tr>
  188. <tr>
  189. <td width="94" style="border:1px solid #000000">
  190. <div align="right">Address3:</div>
  191. </td>
  192. <td style="border:1 solid #000000;padding:0 0 0 10px;" colspan="3" align="left">
  193. <div align="left"><textarea name="address2" cols="60" rows="1"><%=fs("address2")%></textarea></div>
  194. </td>
  195. </tr>
  196. <tr>
  197. <td width="110" style="border:1px solid #000000">
  198. <div align="right">Picture:</div>
  199. </td>
  200. <td width="210" style="border:1px solid #000000;padding:0 0 0 10px;">
  201. <div align="left"><input name="pic" value="<%=fs("pic")%>" size="20" /></div>
  202. </td>
  203. <td width="94" style="border:1px solid #000000">
  204. <div align="right">Telephone:</div>
  205. </td>
  206. <td width="244" style="border:1px solid #000000;padding:0 0 0 10px;">
  207. <div align="left"><input name="tel" value="<%=fs("tel")%>" size="20" /></div>
  208. </td>
  209. </tr>
  210. <tr>
  211. <td width="110" style="border:1px solid #000000">
  212. <div align="right">Zone:</div>
  213. </td>
  214. <td width="210" style="border:1px solid #000000;padding:0 0 0 10px;" colspan="3">
  215. <div align="left"><input name="zone" value="<%=fs("zone")%>" size="20" />&nbsp;</div>
  216. </td>
  217. </tr>
  218. <tr>
  219. <td colspan="4" width="664" style="border:1px solid #000000;padding:0 0 0 10px;">
  220. <div align="center">
  221. <input type="hidden" name="action" value="editsave">
  222. <input type="hidden" name="id" value=<%=id%>>
  223. <input type="hidden" name="page" value="<%=curpage%>">
  224. <input type="submit" name="Submit" value=" Done">
  225. </div>
  226. </td>
  227. </tr>
  228. </table>
  229. </form>
  230. </div>
  231. <%end if%>
  232. </body>
  233. </html>