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

📄 body_buy_this_item.asp

📁 电子投标系统
💻 ASP
字号:
<%@Language=VBScript%>
<%option explicit%>
<%Response.Expires=-1%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META NAME="Generator" CONTENT="NetObjects Fusion 4.0 Trial for Windows">
<TITLE>Buy this item</TITLE>
<BASE TARGET="_parent">
</HEAD>
<BODY BACKGROUND="../../FunkshowBackgr.gif" LINK="#99CCCC" VLINK="#CCCC99" TEXT="#FFFFCC" TOPMARGIN=2 LEFTMARGIN=2 MARGINWIDTH=2 MARGINHEIGHT=2>
<%
Server.execute "../../ValidateUser.asp"
Dim auction_id,LatestHighestBid,DateTime,quantity
Dim highestBid,highestIncrements,highestMax,highestBidder,startbid
Dim dbRec,dbConn,SqlString1,SqlString2
Dim buyerLogin,MaxAmount,Increments,myBid
Dim errorMsg

DateTime=Now()

	if Request.Form("buythisitem")="Bid Item" or Request.QueryString("process")="increase" then
		if Request.QueryString("process")="increase" then
			dim dbRecQuantity,dbconnQuantity
			dim QuantityString
			auction_id=Request.QueryString("auction_id")
			QuantityString="select item_quantity from auctiondetails where auction_id="&auction_id
		
			set dbconnQuantity=Server.CreateObject("ADODB.Connection")
			set dbRecQuantity=Server.CreateObject("ADODB.Recordset")
			dbconnQuantity.Mode=adModeRead
			dbconnQuantity.open "BidBase","scott","tiger"
			dbRecQuantity.open QuantityString,dbconnQuantity
			if not dbRecQuantity.EOF then
				quantity=dbRecQuantity("item_quantity")
				dbRecQuantity.close
				dbconnQuantity.close			
			else
				Response.Write "Invalid Entry"
				dbRecQuantity.close
				dbconnQuantity.close			
				Response.End
			end if
		else 
			auction_id=Request.Form("auction_id")
			startbid=Request.Form("start_bid")
			quantity=Request.Form("quantity")
		end if
			
		set dbConn=Server.CreateObject("ADODB.Connection")
		set dbRec=Server.CreateObject("ADODB.RecordSet")
		
		SqlString1="Select auction_id from expired_auctions where auction_id="&auction_id
		dbConn.Mode=adModeRead
		dbConn.open "BidBase","scott","tiger"
		dbRec.open SqlString1,dbConn
		if not dbRec.EOF then
			Response.Write "This Auction has expired"
			dbRec.close
			dbConn.close
			Response.End
		end if
		dbRec.close
		SqlString2="Select MAX(LATEST_BID_AMOUNT) highestbid from bidding where auction_id="&auction_id
		dbRec.open SqlString2,dbConn
		if not dbRec.EOF then
			LatestHighestBid=dbRec("highestbid")
		else
			LatestHighestBid=0
		end if		
	elseif Request.Form("bidthisitem")="Submit Bid" then
		buyerLogin=Session("LoginName")
		startbid=Request.Form("start_bid")
		auction_id=Request.Form("auction_id")
		quantity=Request.Form("quantity")
		MaxAmount=Request.Form("MaxAmount")
		Increments=Request.Form("Increments")
		myBid=Request.Form("myBid")
		if not isNumeric(myBid) then
			errorMsg="<b>Please Enter Bid in numerals only!</b>"
		end if
		if len(errorMsg)=0 then
			if not MaxAmount="" then
				if not isNumeric(MaxAmount) then
					errorMsg="<b>Please Enter MaxBid in numerals only!</b>"
				elseif MaxAmount<myBid then
					errorMsg="<b>Maximum Bid cannot be less than your current bid!</b>"
				end if
			else
				MaxAmount=0
			end if
		end if
		if len(errorMsg)=0 then
			if not isNumeric(Increments) then
				errorMsg="<b>Please Enter Increments in numerals only!</b>"
			end if
		end if
		if len(errorMsg)=0 then
			if myBid<startbid then
				errorMsg="<b>Your bid is less than starting bid</b>"
			end if
		end if

		if len(errorMsg)<> 0 then
			Response.Write errorMsg
		else
			Dim dbRecBid,dbConnBid,SqlStringBid,insertString,errorBid
			set dbConnBid=Server.CreateObject("ADODB.Connection")
			set dbRecBid=Server.CreateObject("ADODB.RecordSet")
			SqlStringBid="select * from bidding where auction_id="&auction_id&" order by latest_bid_amount desc"
			insertString="insert into bidding values ('"&buyerLogin&"',"&auction_id&","&quantity&","&MaxAmount&","&Increments&","&myBid&")"
			dbConnBid.mode=adModeReadWrite
			dbConnBid.open "BidBase","scott","tiger"
'			dbRecBid.open SqlStringBid,dbConnBid,adOpenStatic,adLockPessimistic,adCmdText



			dbRecBid.open SqlStringBid,dbConnBid,adOpenStatic,,adCmdText
			if dbRecBid.EOF then
				dbConnBid.execute insertString
				dbRecBid.close
			else
				highestBidder=dbRecBid("member_buyer_login")
				if not highestBidder=buyerLogin	then
					highestBid=dbRecBid("latest_bid_amount")
					LatestHighestBid=highestBid				
					highestIncrements=dbRecBid("proxy_increments")
					highestMax=dbRecBid("proxy_max_amount")
					while Cint(highestMax)>Cint(highestBid) and Cint(MaxAmount)>Cint(myBid)
						while (Cint(highestBid)>=Cint(myBid)) and (Cint(MaxAmount)>Cint(myBid)) 
							if increments=0 then
								myBid=cint(MaxAmount)
							else
								myBid=Cint(myBid)+Cint(increments)
							end if
						wend
						if Cint(highestBid)>=Cint(myBid) then
							LatestHighestBid=highestBid
							errorBid="You've been outbid!"
						else
							while Cint(myBid)>=Cint(highestBid) and Cint(highestMax)>Cint(highestBid)
								if Cint(highestincrements)=0 then
									highestBid=cint(highestMax)
								else
									highestBid=Cint(highestBid)+Cint(highestIncrements)
								end if
							wend
							if Cint(highestBid)>=Cint(myBid) then
								errorBid="You've been outbid, the highest bid= "&highestBid
							else
								LatestHighestBid=myBid
							end if
						end if
					wend
				
					dbConnBid.Execute "update bidding set latest_bid_amount="&highestbid& "  where member_buyer_login='"&dbRecBid("member_buyer_login")&"' and auction_id="&auction_id
'					dbRecBid.latest_bid_amount=highestBid
'					dbRecBid.update
					if len(errorBid)=0 then
						dbConnBid.execute insertString
						dbRecBid.close
						dbConnBid.close
						'Application("Bidding")(auction_id)=""
						Response.Write "Your Bid has been successfully Entered!"
						Response.End
					else 
						dbRecBid.close
						Response.Write errorBid
					end if
				else
					if highestbid>myBid then
						Response.Write "Cannot Decrease Bid!"
					else 
						dbConnBid.Execute "update bidding set latest_bid_amount="&mybid& ", proxy_max_amount="&MaxAmount&",proxy_increments="&Increments&" where member_buyer_login='"&dbRecBid("member_buyer_login")&"' and auction_id="&auction_id

						dbRecBid.Close
						dbConnBid.close
						Response.Write "Your Bid has been successfully increased!"
					'	Application(auction_id)=""
						Response.End
					end if
					dbRec.latest_bid_amount=myBid
				end if
			end if	
			'dbConn.close
			'Application(auction_id)=""
		end if
	end if
%>
    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=456 NOF=LY>
        <TR VALIGN=TOP ALIGN=LEFT>
            <TD WIDTH=15 HEIGHT=14><IMG SRC="../../clearpixel.gif" WIDTH=15 HEIGHT=1 BORDER=0></TD>
            <TD></TD>
        </TR>
        <TR VALIGN=TOP ALIGN=LEFT>
            <TD HEIGHT=298></TD>
            <TD WIDTH=441>
                <FORM NAME="LayoutRegion1FORM" ACTION="body_buy_this_item.asp" TARGET="body" METHOD=POST>
                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 NOF="LayoutRegion1">
                        <TR VALIGN=TOP ALIGN=LEFT>
                            <TD WIDTH=23 HEIGHT=27><IMG SRC="../../clearpixel.gif" WIDTH=23 HEIGHT=1 BORDER=0></TD>
                            <TD></TD>
                        </TR>
                        <TR VALIGN=TOP ALIGN=LEFT>
                            <TD WIDTH=385>
                                <TABLE ID="Table2" BORDER=0 CELLSPACING=3 CELLPADDING=1 WIDTH=385>
                                    <TR>
  				                           <TD></TD>
                                       <TD WIDTH=261><P><b>Highest Bid:Rs.<%=LatestHighestBid%>
                                    <TR>
                                      <TD></TD>
   			                           <TD WIDTH=261><P><b>generated at <%=DateTime%><b>
  	                                    </TD>
                                    </TR>
												<TR></TR>
												<TR>
                                        <TD WIDTH=111 HEIGHT=28><P>Proxy Increment</TD>
                                        <TD WIDTH=261><P>
  														<INPUT ID="Increments" Type=TEXT Name="Increments" Value="0">
                                        </TD>
                                    </TR>
                                    <TR>
                                        <TD WIDTH=111 HEIGHT=27><P>Quantity</TD>
                                        <TD WIDTH=261><P><%=Quantity%>
                                        </TD>
                                    </TR>
                                    <TR>
                                        <TD WIDTH=111><P>Your Bid</TD>
                                        <TD WIDTH=261><P><INPUT ID="FormsEditField2" TYPE=TEXT NAME="myBid" VALUE="<%=myBid%>" SIZE=15 MAXLENGTH=5>&nbsp;</TD>
                                    </TR>
                                    <TR>
                                        <TD WIDTH=111><P>Maximum Bid</TD>
                                        <TD WIDTH=261><P><INPUT ID="MaxBid" TYPE=TEXT NAME="MaxAmount" VALUE="<%=MaxAmount%>" SIZE=15 MAXLENGTH=5>&nbsp;</TD>
                                    </TR>
													
                                </TABLE>
                            </TD>
                        </TR>
                    </TABLE>
                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=240 NOF="LayoutRegion1">
                        <TR VALIGN=TOP ALIGN=LEFT>
                            <TD WIDTH=54 HEIGHT=50><IMG SRC="../../clearpixel.gif" WIDTH=54 HEIGHT=1 BORDER=0></TD>
                            <TD></TD>
                        </TR>
                        <TR VALIGN=TOP ALIGN=LEFT>
                            <TD HEIGHT=24></TD>
                            <TD WIDTH=186><INPUT TYPE=SUBMIT NAME="bidthisitem" VALUE="Submit Bid" ID="FormsButton2"></TD>
                        </TR>
                    </TABLE>
						 <INPUT ID="hidden" TYPE=hidden NAME="auction_id" VALUE="<%=auction_id%>" SIZE=20 MAXLENGTH=5>
						 <INPUT ID="hidden" TYPE=hidden NAME="start_bid" VALUE="<%=startBid%>" SIZE=20 MAXLENGTH=5>
		        		 <INPUT ID="quantity" Type=hidden Name="quantity" Value=<%=Quantity%>>
                          
                </FORM>
            </TD>
        </TR>
    </TABLE>
</BODY>
</HTML>
 

⌨️ 快捷键说明

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