频道直达 - 学院 - 下载 - 交易 - 特效 - 字库 - 手册 -排名-工具- 繁體
网页教学网站开发 设为首页
加入收藏
联系我们
建站搜索: 常用广告代码   用户注册 | 用户登陆
您当前的位置:中国建站之家 -> 网站开发设计技术教程 -> asp教程 -> 制作我们自己的Ebay(拍卖系统)(7)

制作我们自己的Ebay(拍卖系统)(7)

作者:未知  来源:转载  发布时间:2005-7-20 11:38:27  发布人:acx

减小字体 增大字体

Chris Payne

September 11, 2000

Well, now your auction can run for an indefinite time. People can keep placing bids until you decide to
stop them (good for the seller, but makes bidders kind of unhappy, to say the least). Let's discuss the
mechanisms for stopping an auction.

There are two easy ways to do it. The first, and easiest to perform, though requiring more manual
intervention in the long run, is to simply build in an "Active" bit field into your tblAuctions table.
When you decide to stop the auction, flip the bit, and the auction is over. (You'll also have to add some
code to make sure that the DoBids and ResolveBids functions don't operate on closed auctions.) Then simply
query the database, find out the winner(s), and let them and the seller know. Easy as pie.

The second method is to go by the end date the seller specifies (better business, believe me). To do this,
you can manually stop the auction (via the process above) when the appropriate date comes, or you can
schedule a task to turn an auction off at the appropriate times. There are a few ways to do this, via your
database program and the Windows NT Task Scheduler, so I won't go through each one. You could simply set
the &#115cript to run every midnight or so to stop the auction and determine the winners.

If you let the seller specify an exact time for the auction to end, then you're introducing a whole new
set of complications. One way to handle this is to programmatically set a scheduled task as soon as the
seller submits the auction, for the end date of the auction. This requires minimum intervention, but
requires you to know how to do that (for documentation on the Task Scheduler, read this MSDN article).
Another method is to create your own specific version of task scheduler; create a small program that will
run in the background and watch the times on auctions. When an auction end date passes, flip the bit.

Okay, so the auction is over. Now what?

Assuming that you would like minimal manual intervention, and you don't really care who wins (like the
head guys at Ebay care who wins every single auction), then you could create a function to send alerts to
the winner(s) and seller that will kick off when the auction is over. This function could also in turn
kick off some type of payment system, but that is beyond the scope of this article. Let's look at the
function:



Function SelectWinners(AuctionID, itemID)


'Set variables and create objects
dim totItems, intAvailable
totItems = 0
strConnectionString = "DSN=MyAuction;UID=username;PWD=password;Database=MyAuctionDB"
set rst = Server.CreateObject("ADODB.Recordset")


'Find the number of items available
strSQL = "SELECT Available FROM tblAuctionItems WHERE " & _
"IID = " & ItemID
rst.open strSQL, strConnectionString
intAvailable = rst(1)
rst.close


'find the winners
'If two customers bid the same amount, the customer requesting
more items will win. If still tied, the customer placing the
earliest bid will win
strSQL = "SELECT UID, WinPrice, WinItems FROM tblAuctionBids " & _
"WHERE IID = " & itemID & " ORDER BY WinItems DESC, Time"


rst.open strSQL, strConnectionString
if not rst.eof then
do until rst.eof OR totItems >= intAvailable
'Keep a running tally of items distributed
totItems = totItems + rst(2)
If totItems <= intAvailable then 'This buyer won
'Send an email alerting this buyer
call SendWinningEmail(rst(0))
End if
rst.movenext
loop
end if


End Function


This is a pretty simple function. Simply loop through the bids in the correct order (by number of items
won first, and then by date), and alert the buyers that they've won. Once the number of items bid for gets
higher than the number of items available, every one else loses, and you can stop the loop. I won't go
into the SendWinningEmail() function, but all it does is send the user specified by rst(0) an email that
says they've won and for how much and how many. (For an example using email, check out this WDVL article.)




将本文收藏到QQ书签与更多好友分享
[打 印]
[] [返回上一页] [收 藏]
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
精彩推荐
热门文章
· 注册码大全二
· 注册码大全四
· 注册码大全一
· 要10G免费网络硬盘的请进..
· 通过google 赶快来赚美金..
· 注册码大全十
· 头像-qq头像(qq新头像)4..
· 让你轻松架设FTP服务器1..
· 注册码大全三
· 梦幻背景图片7
· 卡通动物图片6
· 网页制作素材-按钮素材2..
· 让你轻松架设FTP服务器5..
· 风景图片8
· 注册码大全九
· 让你轻松架设FTP服务器2..
关注此文读者还看过
· 芙蓉姐姐自卖博客 已沦为..
· 博阅RSS阅读器快速入门
· 用PHP连接Oracle for NT..
· Global.asa 参考(三) - ..
· mysql获得系统权限
· 国内首例网银被盗案再审..
· 让你的WAP网站有更好的兼..
· Apache Reference Manua..
· 互联网发动春节攻势:节..
· 整体布局声明在css中应该..
· ASP实现简单的网页保护
· p-networkz.net/100-500..
· 分享:做网站月入7000的..
· SQL Server数据库技术(..
· 字符串操作符
· SQL Server中行转列问题..
相关文章
· 用Access2007解决支票打印的..
· 中国网民日均共计花费5.7亿..
· 《2007中国网络社区调研报告..
· 软银投资阿里巴巴8000万美元..
· 网易网站联盟2007年1..
· 07年域名交易价格公布下.仅..
· 从基础开始深入学Flash AS3..
· 2007年反垃圾邮件市场谁主沉..
· 2007年度中国电信A级IDC机房..
· 影响网站搜索引擎排名的17条..
· 瞄准Apache IIS7向开源张开..
· 17173第7届网游市场调查国庆..
· 网站运营可能失败的7种原因..
· 北京点石大会:2007年末最值..
· IE6,IE7中如果定义了绝对定..
· 中国域名市场将达7.2亿 域名..
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 人才招聘
网站合作、内容监督、商务咨询:QQ: 9576619
Copyright ? 2005--2008 中国建站之家版权所有
粤ICP备05092265号