📄 addtocart.aspx
字号:
<%@ Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.sqlclient" %>
<!--#include file="config.aspx" -->
<!--#include file="scrollerdata.aspx" -->
<!--#include file="man_menu.aspx" -->
<!--#include file="checklogin.aspx" -->
<Script Runat="Server">
Sub Page_Load( s As Object, e As EventArgs )
call logincheck
call checkPhonedetails
call checkstatus
call dbcon
call fillmanu
call fillrecept
call scrollphone
if session("useriD")="" then
btnlogin.text="login"
end if
If Not isPostBack Then
if session("useriD")="" then
btnlogin.text="login"
end if
End If
End Sub
sub logincheck
if session("userID")="" or request.QueryString("phoneId")="" or session.sessionID<>request.QueryString("transID") or request.QueryString("man_name")="" or session("seccode")<>request.QueryString("seccode") then
session("checklog")= true
response.redirect("login.aspx")
end if
end sub
sub checkPhonedetails
call dbcon
mcmd=new sqlcommand("select phoneid,man_id from phone_details where phoneID='" & request.QueryString("phoneID") & "' and man_id=(select man_id from manufacturer where man_name='" & request.QueryString("man_name") & "')" ,bcon)
bcon.open
dr=mcmd.executereader
If dr.HasRows = False Then
session("invalidreq")="yes"
response.Redirect("requesterror.aspx")
End If
end sub
sub fillrecept
dim SQLcart as string
call dbcon
sqlcart="select PhoneID,man_ID,price,quantity,thumnail from phone_details where phoneid='" & request.QueryString("phoneID")& "' and man_id=(select man_id from manufacturer where man_name='" & request.QueryString("man_name") & "')"
bcmd= new sqlcommand(sqlcart,bcon)
bcon.open
objreader=bcmd.executereader
objreader.read
lblMan.text=request.QueryString("man_name")
lblPhone.text=objreader("phoneID")
lblprice.text=objreader("price")
lblqty.text=objreader("quantity")
imgpath=objreader("thumnail")
manID=objreader("man_ID")
objreader.close
bcon.close
end sub
sub addtoDB(sender As Object, e As System.Web.UI.ImageClickEventArgs)
dim qty as decimal
dim totamount as decimal
dim price as decimal
dim checkval,qtycheck as boolean
call dbcon
tcmd=new sqlcommand("select transID,secCode,phoneID,userID,qty from temp_cart where transid='" & request.QueryString("transID") & "' and secCode='" & cint(request.QueryString("secCode")) & "' and phoneID='" & request.QueryString("phoneID") & "' and userID='" & session("userID") & "' ",cartcon)
cartcon.open
objreader=tcmd.executereader
objreader.read
dim counter,chkqty as integer
If objreader.HasRows =true Then
checkval=true
counter=objreader("qty")
else
checkval=false
counter=0
End If
if not isnumeric(txtqty.text) then
lblmessage.text="please enter only digits "
else
chkqty = cint(txtqty.text)+ counter
end if
if chkqty > 50 then
qtycheck=true
else
qtycheck=false
end if
if not isnumeric(txtqty.text) then
else if cint(txtqty.text) > cint(lblqty.text) then
lblmessage.text="please insert a value within the stock limit"
else if qtycheck=true then
lblmessage.text="only 50 pieces on a product are allowed you have added " & counter & " items on this and you can add " & 50-counter & " pieces more"
else if checkval=true then
lblmessage.text="Please type the quantity you need and click add."
qty=cdec(txtqty.text)
price=cdec(lblprice.text)
totamount=qty * price
call dbcon
bcmd=new sqlcommand("update temp_cart set qty=qty+'" & qty & " ',totalamount=totalamount+'" & totamount & "'",bcon)
bcon.open
bcmd.executenonquery
bcon.close
session("cartison")="yes"
response.Redirect("viewcart.aspx?transID=" &request.QueryString("transID") & "&secCode=" &cstr(session("secCode")) & "&userID=" &session("userID"))
else
lblmessage.text="Please type the quantity you need and click add."
qty=cdec(txtqty.text)
price=cdec(lblprice.text)
totamount=qty * price
call dbcon
mcmd=new sqlcommand("insert into temp_cart(transID,seccode,userID,phoneID,man_id,price,qty,totalamount)values(@transID,@secCode,@userID,@phoneId,@man_ID,@price,@qty,@totalamount)",bcon)
MCmd.Parameters.Add(New sqlParameter("@TransID", sqlDbType.Varchar,500))
MCmd.Parameters.Add(New sqlParameter("@secCode", sqlDbType.int))
MCmd.Parameters.Add(New sqlParameter("@userID", sqlDbType.Varchar,50))
MCmd.Parameters.Add(New sqlParameter("@phoneID", sqlDbType.Varchar,100))
MCmd.Parameters.Add(New sqlParameter("@man_id", sqlDbType.int))
MCmd.Parameters.Add(New sqlParameter("@price", sqlDbType.decimal))
MCmd.Parameters.Add(New sqlParameter("@qty", sqlDbType.int))
MCmd.Parameters.Add(New sqlParameter("@totalamount", sqlDbType.decimal))
mCmd.Parameters("@transID").Value=cstr(request.QueryString("transID"))
mCmd.Parameters("@secCode").Value=cstr(request.QueryString("secCode"))
mCmd.Parameters("@useriD").Value=cstr(session("userID"))
mCmd.Parameters("@phoneId").Value=cstr(lblphone.text)
mCmd.Parameters("@man_ID").Value=manID
mCmd.Parameters("@price").Value=cdec(lblprice.text)
mCmd.Parameters("@qty").Value=qty
mCmd.Parameters("@totalamount").Value=totamount
bcon.open
mcmd.executenonquery
bcon.close
session("cartison")="yes"
response.Redirect("viewcart.aspx?transID=" &request.QueryString("transID") & "&secCode=" &cstr(session("secCode")) & "&userID=" &session("userID"))
end if
end sub
public manID as integer
public imgpath as string
</Script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>GSMLanka -Shopping cart- Do you want to add this item in your cart ?</title>
<link href="stylesheet1.css" rel="stylesheet1" type="text/css" />
<SCRIPT language=JavaScript
src="javascript.js"></SCRIPT>
<style type="text/css">
<!--
.borderTable {padding: 0px 0px 0px 0px;
border: 1px solid #cccccc;
}
.borderTable {padding: 0px 0px 0px 0px;
border: 1px solid #CCCCCC;
}
-->
</style>
<link href="stylesheet1.css" rel="stylesheet1" type="text/css" />
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
.style3 {font-weight: bold}
-->
</style>
<link href="stylesheet1.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style4 {color: #FF0000}
-->
</style>
</head>
<body><form runat="server">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="800" height="32" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="307" height="4"></td>
<td width="493"></td>
</tr>
<tr>
<td height="28" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="imagenew/up_serch_ban.jpg">
<!--DWLayoutTable-->
<tr>
<td width="153" height="28"> </td>
<td width="150" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="157" height="28"><font color="#336699">
<asp:TextBox ID="txtSearch" Columns="6" width="104px" runat="server" TextMode="SingleLine" />
<asp:Button ID="btnSearch" Text="Go" Width="32" runat="server" />
</font></td>
</tr>
</table></td>
<td width="4"> </td>
</tr>
</table></td>
<td><table width="100%" height="28" border="0" align="center" cellpadding="0" cellspacing="0" background="imagenew/up_ban.jpg" bgcolor="#FFCC00">
<!--DWLayoutTable-->
<tr>
<td width="52" height="28"
align="center" valign="middle" nowrap="nowrap" class="navtopdark1"
onclick="jump(this)" onMouseOver="colorOnTop(this)" onMouseOut="colorOffTop(this)"><a class="toplink"
href="index.aspx"><span class="style1">Home</span></a></td>
<td width="55"
align="center" valign="middle" nowrap="nowrap" class="navtopdark1"
onclick="jump(this)" onMouseOver="colorOnTop(this)" onMouseOut="colorOffTop(this)"><a class="toplink"
href="signup.aspx"><span class="style1">Register</span></a></td>
<td width="58"
align="center" valign="middle" nowrap="nowrap" class="navtopdark1"
onclick="jump(this)" onMouseOver="colorOnTop(this)" onMouseOut="colorOffTop(this)"><a class="toplink"
href="forum.aspx"><span class="style1">Forums</span></a></td>
<td width="72"
align="center" valign="middle" nowrap="nowrap" class="navtopdark1"
onclick="jump(this)" onMouseOver="colorOnTop(this)" onMouseOut="colorOffTop(this)"><a class="toplink"
href="orderstatus.aspx"><span class="style1">Track Order </span></a></td>
<td width="66"
align="center" valign="middle" nowrap="nowrap" class="navtopdark1"
onclick="jump(this)" onMouseOver="colorOnTop(this)" onMouseOut="colorOffTop(this)"><a class="toplink"
href="multimedia.aspx">Multimedia</a></td>
<td width="42"
align="center" valign="middle" nowrap="nowrap" class="navtopdark1"
onclick="jump(this)" onMouseOver="colorOnTop(this)" onMouseOut="colorOffTop(this)"><a class="toplink"
href="faq.aspx"><span class="style1">Faq</span></a></td>
<td width="50"
align="center" valign="middle" nowrap="nowrap" class="navtopdark1"
onclick="jump(this)" onMouseOver="colorOnTop(this)" onMouseOut="colorOffTop(this)"><a class="toplink"
href="about.aspx"><span class="style1">About</span></a></td>
<td width="80"
align="center" valign="middle" nowrap="nowrap" class="navtopdark1"
onclick="jump(this)" onMouseOver="colorOnTop(this)" onMouseOut="colorOffTop(this)"><a class="toplink"
href="contact.aspx"><span class="style1">Contact Us </span></a></td>
<td width="18"> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="799" border="0" align="center" cellpadding="0" cellspacing="0" class="border4">
<!--DWLayoutTable-->
<tr>
<td width="7" height="7"></td>
<td width="783"></td>
<td width="7"></td>
</tr>
<tr>
<td height="134"></td>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="imagenew/main_ban.jpg">
<!--DWLayoutTable-->
<tr>
<td width="783" height="134" valign="top"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="783" height="134" title="Banner">
<param name="movie" value="Flash Banner/banner.swf">
<param name="quality" value="high">
<embed src="Flash Banner/banner.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="783" height="134"></embed>
</object></td>
</tr>
</table></td>
<td></td>
</tr>
<tr>
<td height="8"></td>
<td></td>
<td></td>
</tr>
</table>
<table width="799" border="0" align="center" cellpadding="0" cellspacing="0" class="border4">
<!--DWLayoutTable-->
<tr>
<td width="7" height="18"></td>
<td width="783" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="783" height="18"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="f3f3f3">
<!--DWLayoutTable-->
<tr>
<td width="203" height="24" valign="middle">You are logged in as
<asp:Label ID="lblusertext" runat="server" Text='Guest' Font-Bold="true" /></td>
<td width="203"> </td>
<td width="377" align="right" valign="middle"><span class="style3">
<asp:LinkButton ID="btnViewprof" Text="View Profile" runat="server" />
<asp:LinkButton runat="server" id="showcart" OnClick="viewthecart" />
<asp:linkButton ID="btnlogin" onclick="sign" runat="server" />
</span></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="7"></td>
</tr>
<tr>
<td height="9"></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -