body_sell_item.asp

来自「电子投标系统」· ASP 代码 · 共 367 行 · 第 1/2 页

ASP
367
字号
<%@ Language=VBScript%>
<% option explicit %>
<!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="Microsoft FrontPage 5.0">
<TITLE>Item to be sold</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 Startbid,Reservedbid,Item_title,Quantity,Auction_type,Item_description,Location,Country,Date,Time,Duration,Category,Picture,Sound,Payment,Shipping,dd,mm,yy,temp
dim errorMsg, i
dim category_id,category_name

if Request.ServerVariables("REQUEST_METHOD") = "POST" then
	Startbid= Request.Form("minbid")
	Reservedbid= Request.Form("reservebid")
	Item_title= Request.Form("itemtitle")
	Quantity= Request.Form("quantity")
	Auction_type= Request.Form("auctiontype")
	Item_description= Request.Form("itemdescription")
	Location= Request.Form("location")
	Country= Request.Form("country")
	dd= Request.Form("dd")
	mm= Request.Form("mm")
	yy=Request.Form("yy")
	Date=dd&"-"&mm&"-"&yy
	
	Duration= Request.Form("duration")
	Category= Request.Form("category")
	category_id=category
	category_name=Request.Form("category_name")
	Picture= Request.Form("picture")
	Sound= Request.Form("sound")
	
	if Request.Form("ShippingRadioButton1")=1 then
			Shipping=0
	elseif Request.Form("ShippingRadioButton1")=2 then
			Shipping=1
	elseif len(Request.Form("hiddenshipping")) then
			Shipping=Request.Form("hiddenshipping")
	else
		errorMsg="Please Select a Shipping Agreement"
	end if
	if len(errorMsg)=0 then
		if Request("PaymentRadioButton3")=1 then
			Payment=0
		elseif Request("PaymentRadioButton3")=2 then
			Payment=1
		elseif Request("PaymentRadioButton3")=3 then
			Payment=2
		elseif Request("PaymentRadioButton3")=4 then
			Payment=3
		elseif len(Request.Form("hiddenpayment")) then
			payment=Request.Form("hiddenpayment")
		else
			errorMsg="Please Select a Payment Mode"
		end if
	end if

	if len(errorMsg)=0 then
		if Date<Now() then
			errorMsg="Invalid Date Entered"
		end if
	end if

	if len(errorMsg)=0 then
		if len(Reservedbid)= 0 then
			errorMsg="You must enter an amount as reserved bid."
		end if
	end if
	if len(errorMsg) = 0 then
		if len(Item_title)= 0 then
			errorMsg="You must enter an Item for bid."
		end if
	end if

	if len(errorMsg)= 0 then
		if len(Quantity)= 0 then
			errorMsg= "You must enter a valid quantity"				
		end if
	end if
	
	if len(category)=0 then
		errorMsg= "Please select a category"
	end if
	if len(errorMsg)= 0 then
		if len(Country)= 0 then
			errorMsg= "You must specify a country"				
		end if
	end if
	if len(errorMsg)= 0 then
		if len(Location)= 0 then
			errorMsg= "You must specify a location"				
		end if
	end if

	if len(errorMsg)= 0 then
		if len(Duration)= 0 then
			errorMsg= "You must specify the expected duration of auction"				
		elseif not isNumeric(Duration) then
			errorMsg= "Enter Duration in Number of days"
		end if
	end if

	if len(errorMsg) <> 0 then
		Response.Write errorMsg
	else
		Dim dbconn,dbconn2
		Dim dbRec1,dbRec2
		Dim SqlString1,SqlString2,LoginName
		LoginName=Session("LoginName")
		SqlString1 = "insert into auction values (auction_id.NextVAL,'" & Date & "','" & Duration & "','" & Startbid & "','" & Reservedbid & "')"
		SqlString2 = "insert into auctiondetails values (auction_id.CurrVal,'" &LoginName&"',"&category&",'"&Item_title&"','"&item_description&"'," & Quantity & ",'" & Location & "','" & Country & "','" & Picture & "','" & Sound & "'," & Shipping & "," & Payment & ")"
		
		Set dbconn = Server.CreateObject("ADODB.Connection")
		dbconn.mode=adModeReadWrite

		dbconn.open "BidBase","scott","tiger"
		dbconn.BeginTrans
		dbconn.Execute SqlString1,,adCmdText+adExecuteNoRecords
		dbconn.Execute SqlString2,,adCmdText+adExecuteNoRecords
		if dbconn.Errors.Count=0 then
			dbconn.CommitTrans
			Response.Write "Your item has been sent for auction"
		else
			dbconn.RollbackTrans
			Response.Write "Transaction Rolled back"
		end if
		dbconn.close
		Response.End
	end if
else
	Date=FormatDateTime(CLng(Now()),vbLongDate)
	yy=right(Date,8)
	dd=left(yy,2)
	yy=right(yy,4)
	temp=instr(1,Date,",")
	mm=mid(Date,int(temp+1),4)	
end if
%>

    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=498 NOF=LY>
        <TR VALIGN=TOP ALIGN=LEFT>
            <TD HEIGHT=7></TD>
        </TR>
        <TR VALIGN=TOP ALIGN=LEFT>
            <TD WIDTH=498 HEIGHT=1007>
                <FORM NAME="LayoutRegion1FORM" ACTION="" TARGET="body" METHOD=POST>
                    <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 NOF="LayoutRegion1">
                        <TR VALIGN=TOP ALIGN=LEFT>
                            <TD WIDTH=27 HEIGHT=37><IMG SRC="../../clearpixel.gif" WIDTH=27 HEIGHT=1 BORDER=0></TD>
                            <TD></TD>
                        </TR>
                        <TR VALIGN=TOP ALIGN=LEFT>
                            <TD></TD>
                            <TD WIDTH=385>
                                <TABLE ID="Table2" BORDER=0 CELLSPACING=3 CELLPADDING=1 WIDTH=385>
                                    <TR>
                                        <TD WIDTH=111 HEIGHT=26><P>Minimum Bid</TD>
                                        <TD WIDTH=261><P><INPUT ID="FormsEditField1" TYPE=TEXT NAME="minbid" VALUE="<%=Startbid%>" SIZE=30 MAXLENGTH=8>&nbsp;</TD>
                                    </TR>
                                    <TR>
                                        <TD>&nbsp;</TD>
                                        <TD WIDTH=261><P>Only give numerals for this field. Dont enter the currency sign. The bidding will be in Pakistani Rupees</TD>
                                    </TR>
                                    <TR>
                                        <TD WIDTH=111><P>Reserve Bid</TD>
                                        <TD WIDTH=261><P><INPUT ID="FormsEditField2" TYPE=TEXT NAME="reservebid" VALUE="<%=Reservedbid%>" SIZE=30 MAXLENGTH=8>&nbsp;</TD>
                                    </TR>
                                    <TR>
                                        <TD>&nbsp;</TD>
                                        <TD WIDTH=261><P>The minimum amount on which u will sell your item. This amount will not be visible to the buyer</TD>
                                    </TR>
                                    <TR>
                                        <TD WIDTH=111><P>Item Title</TD>
                                        <TD WIDTH=261><P><INPUT ID="FormsEditField4" TYPE=TEXT NAME="itemtitle" VALUE="<%=Item_title%>" SIZE=30 MAXLENGTH=30>&nbsp;</TD>
                                    </TR>
                                    <TR>
                                        <TD>&nbsp;</TD>

⌨️ 快捷键说明

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