毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

电子商务毕业论文 第9页

更新时间:2009-3-9:  来源:毕业论文

CD在线商店销售系统设计|电子商务网站毕业设计|电子商务毕业论文 第9页|免费论文
 if (purchaselist == null) { //第一次购买
        purchaselist = new Vector();
        purchaselist.addElement(iList);
      }

      else { // 不是第一次购买
        for (int i = 0; i < purchaselist.size(); i++) {
          allorder itList = (allorder) purchaselist.elementAt(i);
          if (iList.getcdNo() == itList.getcdNo()) {
            itList.setAmount(itList.getAmount() + iList.getAmount());
            purchaselist.setElementAt(itList, i);
            match = true;
            break;
          } //if name matches结束
        } // for循环结束
        if (!match)
          purchaselist.addElement(iList);
      }
      session.setAttribute("shopcar", purchaselist);
      return true;
    }
    /**
     * 修改已经放进购物车的数据
     * @param newrequest
     * @return
     */
    public boolean modiShoper(HttpServletRequest newrequest) {
      request = newrequest;
      String ID = request.getParameter("cdid");
      String Amount = request.getParameter("amount");
      long cdid = 0;
      int amount = 0;
      try {
        cdid = Long.parseLong(ID);
        amount = Integer.parseInt(Amount);
      }
      catch (Exception e) {
        return false;
      }
      if (amount < 1)
        return false;
      session = request.getSession(false);
      if (session == null) {
        return false;
      }
      purchaselist = (Vector) session.getAttribute("shopcar");
      if (purchaselist == null) {
        return false;
      }
      sqlStr = "select leav_number from cd where id=" + cdid;
      try {
        DataBase db = new DataBase();
                  db.connect();
                  stmt = db.conn.createStatement ();

        rs = stmt.executeQuery(sqlStr);
        if (rs.next()) {
          if (amount > rs.getInt(1)) {
            leavecd = rs.getInt(1);
            isEmpty = true;
            return false;
          }
        }
        close();
      }
      catch (SQLException e) {
        return false;
      }
      for (int i = 0; i < purchaselist.size(); i++) {
        allorder itList = (allorder) purchaselist.elementAt(i);
        if (cdid == itList.getcdNo()) {
          itList.setAmount(amount);
          purchaselist.setElementAt(itList, i);
          break;
        } //if name matches结束
      } // for循环结束
      return true;
    }
    /**
     *删除购物车中数据
     * @param newrequest
     * @return
     */
    public boolean delShoper(HttpServletRequest newrequest) {
      request = newrequest;
      String ID = request.getParameter("cdid");
      long cdid = 0;
      try {
        cdid = Long.parseLong(ID);
      }
      catch (Exception e) {
        return false;
      }
      session = request.getSession(false);
      if (session == null) {
        return false;
      }
      purchaselist = (Vector) session.getAttribute("shopcar");
      if (purchaselist == null) {
        return false;
      }

      for (int i = 0; i < purchaselist.size(); i++) {
        allorder itList = (allorder) purchaselist.elementAt(i);
        if (cdid == itList.getcdNo()) {
          purchaselist.removeElementAt(i);
          break;
        } //if name matches结束
      } // for循环结束
      return true;
    }
    /**
     * 提交购物车
     * @param newrequest
     * @return
     * @throws java.lang.Exception
     */
    public boolean payout(HttpServletRequest newrequest) throws Exception {
      op_user opUser=new op_user();
      request = newrequest;
      session = request.getSession(false);
    // System.out.print("f1");
      if (session == null) {
        return false;
      }
      String Userid = (String) session.getAttribute("userid"); //取得用户ID号
      long userid = 0;
      if (Userid == null || Userid.equals("")) {
        isLogin = false;
        return false;
      }
      else {
        try {
          userid = Long.parseLong(Userid);
        }
        catch (NumberFormatException e) {
        //  System.out.print(e.getMessage());
          return false;
        }
      }
751com.cn
      String TotalPrice = request.getParameter("totalprice");
      float payPrice=(Float.parseFloat(TotalPrice))*opUser.getUserRate(Userid);
      long timeInMillis = System.currentTimeMillis();
  //System.out.println("f4");
      sqlStr = "insert into orders (orderId,UserId,SubmitTime,ConsignmentTime,TotalPrice,content,IPAddress,IsPayoff,IsSales) values (";
      orderId=""+timeInMillis;//以系统时间产生位移的订单编号
      sqlStr = sqlStr  + orderId + ",'";
      sqlStr = sqlStr + userid + "',GETDATE(),GETDATE()+7,'";
      sqlStr = sqlStr + payPrice + "','";
      sqlStr = sqlStr + dataFormat.toSql(Content) + "','";
      sqlStr = sqlStr + IP + "',1,1)";
    //  System.out.print(sqlStr);
    //String setIdSql="udate orders set orderid=orderid+id where UserId = " + userid;
      try {
        stmt.execute(sqlStr);
        //stmt.execute(setIdSql);
       // sqlStr = "select max(id) from orders where UserId = " + userid;
       // rs = stmt.executeQuery(sqlStr);

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

电子商务毕业论文 第9页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。