buy.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import="java.util.*"%>
  3. <%@ page import="cn.js.fan.util.*"%>
  4. <%@ page import="cn.js.fan.db.*"%>
  5. <%@ page import="cn.js.fan.web.*"%>
  6. <%@ page import="com.redmoon.forum.plugin.auction.*"%>
  7. <%@ page import="com.redmoon.forum.person.*"%>
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11. <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
  12. <meta name="ProgId" content="FrontPage.Editor.Document">
  13. <LINK href="../../../common.css" type=text/css rel=stylesheet>
  14. <title>出价</title>
  15. <style type="text/css">
  16. <!--
  17. body {
  18. margin-top: 0px;
  19. margin-left: 0px;
  20. margin-right: 0px;
  21. }
  22. .style1 {
  23. color: #525252;
  24. font-weight: bold;
  25. }
  26. -->
  27. </style></head>
  28. <body>
  29. <%@ include file="../../inc/header.jsp"%>
  30. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  31. <jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
  32. <%
  33. if (!privilege.isUserLogin(request)) {
  34. out.print(StrUtil.Alert_Back("请先登录!"));
  35. return;
  36. }
  37. int worthId = 0;
  38. int count = 0;
  39. try {
  40. worthId = ParamUtil.getInt(request, "worthId");
  41. count = ParamUtil.getInt(request, "count");
  42. if (count<=0)
  43. throw new ErrMsgException("数量必须大于0!");
  44. }
  45. catch (ErrMsgException e) {
  46. out.print(StrUtil.Alert_Back("数据格式错误!")); // StrUtil.Alert_Back(e.getMessage()));
  47. return;
  48. }
  49. AuctionWorthDb aw = new AuctionWorthDb();
  50. aw = aw.getAuctionWorthDb(worthId);
  51. AuctionDb ad = new AuctionDb();
  52. ad = ad.getAuctionDb(aw.getMsgRootId());
  53. if (ad.getCount()<count) {
  54. out.print(SkinUtil.makeErrMsg(request, "对不起,你要买的数量超过了销售数量!"));
  55. return;
  56. }
  57. if (ad.getUserName().equals(privilege.getUser(request))) {
  58. out.print(StrUtil.Alert_Back("对不起,您自己不能购买!"));
  59. return;
  60. }
  61. boolean re = false;
  62. AuctionOrderDb ao = new AuctionOrderDb();
  63. try {
  64. re = ao.makeOrderForSell(aw, privilege.getUser(request), count);
  65. }
  66. catch (ErrMsgException e) {
  67. out.print(StrUtil.Alert_Back(e.getMessage()));
  68. }
  69. catch (ResKeyException e1) {
  70. out.print(StrUtil.Alert_Back(e1.getMessage(request)));
  71. }
  72. if (re)
  73. out.print(StrUtil.Alert_Redirect("购买完成,点击查看生成的订单!", "showorder.jsp?orderId=" + ao.getId()));
  74. %>
  75. </body>
  76. </html>