Package models

Examples of models.Auction


                else if(servletPath.equals("/admin/auctions/edit")) {
      if(session.getAttribute("admin") != null && session.getAttribute("admin").equals("true")) {
        page += "_edit";

        String[] tokens = request.getRequestURI().split("/");
        Auction auction = Auction.getById(new Integer(tokens[tokens.length - 1]));

        request.setAttribute("auction", auction);
      }
    }
                else if(servletPath.equals("/admin/auctions/delete")) {
View Full Code Here


    PrintWriter p = response.getWriter();

    if(servletPath.equals("/admin/auctions/save")) {
      if(session.getAttribute("admin") != null && session.getAttribute("admin").equals("true")) {

                            Auction auction = new Auction();

        MultipartRequest multi = new MultipartRequest(request, "/home/buzz/NetBeansProjects/bweb/web/images/");

                                auction.setProduct(multi.getParameter("newProduct"));
       
                                auction.setCatId(new Integer(multi.getParameter("newCat")));

                                File f = multi.getFile("newImage");

                                String fileName = multi.getFilesystemName("newImage");

        auction.setPhoto(fileName);
       
                                auction.setStartingPrice(new Float (multi.getParameter("newStartingPrice")));
        auction.setLastPrice(new Float (multi.getParameter("newStartingPrice")));
                                auction.setMinPrice( new Float (multi.getParameter("newMinPrice")));

                                Integer duration,i = new Integer(multi.getParameter("newDuration"));
                                if(i == 1) duration = 4;
                                else if(i == 2) duration = 6;
                                else duration = 10;

                                Calendar cal = Calendar.getInstance();
                                cal.add(Calendar.DAY_OF_YEAR, duration );
                                Long e = (cal.getTimeInMillis());
                                java.sql.Date expire = new java.sql.Date(e);
                                auction.setExpire(expire);
                               
                                auction.setShipping(multi.getParameter("newShip"));
                               
                                auction.setUserId(new Integer(multi.getParameter("newCat")));
                                auction.setLastPrice(null);
                                auction.setLastUserId(null);
                                auction.setDescription(multi.getParameter("newDesc"));
                               
                                auction.save();
      }
          }
        else if(servletPath.equals("/admin/auctions/update")) {
      if(session.getAttribute("admin") != null && session.getAttribute("admin").equals("true")) {

                            Auction auction = new Auction();

        MultipartRequest multi = new MultipartRequest(request, "/home/buzz/NetBeansProjects/bweb/web/images/");
                                auction.setId(new Integer(multi.getParameter("editId")));
                                auction.setProduct(multi.getParameter("editProduct"));
       
                                auction.setCatId(new Integer(multi.getParameter("editCat")));

                                String fileName = multi.getFilesystemName("editImage");

        File f = null;

        if(fileName == null || fileName.equals("")) {
          fileName = multi.getParameter("oldImage");
        }
        else {
          f = multi.getFile("editImage");
        }

        auction.setPhoto(fileName);
        //auction.setStartingPrice(new Float (multi.getParameter("editStartingPrice")));
                                //auction.setMinPrice( new Float (multi.getParameter("editMinPrice")));
                                auction.setShipping(multi.getParameter("editShip"));
                                auction.setUserId(new Integer(multi.getParameter("editCat")));
                                auction.setDescription(multi.getParameter("editDesc"));
                                auction.update();
      }
          }

                response.sendRedirect(request.getContextPath() + "/admin/auctions");
View Full Code Here

             if(servletPath.equals("/auctions/show")) {

            page += "_show";

            String[] tokens = request.getRequestURI().split("/");
            Auction auction = Auction.getById(new Integer(tokens[tokens.length - 1]));

    request.setAttribute("auction", auction);
            
         }
            if(servletPath.equals("/auctions/new")) {
View Full Code Here

        if(servletPath.equals("/auctions/bid")) {

            User u = (User) session.getAttribute("user");
            String bid = request.getParameter("bid");
            Integer id = new Integer(request.getParameter("id"));
            Auction a = Auction.getById(id);
            a.setLastPrice(new Float(bid));
            a.setLastUserId(u.getId());
            a.update();

            response.sendRedirect(request.getContextPath());
       
        }
        else if(servletPath.equals("/auctions/save"))
        {
     
                            User u = (User) session.getAttribute("user");
                            Auction auction = new Auction();

        MultipartRequest multi = new MultipartRequest(request, "/home/buzz/NetBeansProjects/bweb/web/images/");

                                auction.setProduct(multi.getParameter("newProduct"));

                                auction.setCatId(new Integer(multi.getParameter("newCat")));

                                File f = multi.getFile("newImage");

                                String fileName = multi.getFilesystemName("newImage");

        auction.setPhoto(fileName);

                                auction.setStartingPrice(new Float (multi.getParameter("newStartingPrice")));
        auction.setLastPrice(new Float (multi.getParameter("newStartingPrice")));
                                auction.setMinPrice( new Float (multi.getParameter("newMinPrice")));

                                Integer duration,i = new Integer(multi.getParameter("newDuration"));
                                if(i == 1) duration = 4;
                                else if(i == 2) duration = 6;
                                else duration = 10;

                                Calendar cal = Calendar.getInstance();
                                cal.add(Calendar.DAY_OF_YEAR, duration );
                                Long e = (cal.getTimeInMillis());
                                java.sql.Date expire = new java.sql.Date(e);
                                auction.setExpire(expire);

                                auction.setShipping(multi.getParameter("newShip"));

                                auction.setUserId(u.getId());
                                auction.setLastPrice(null);
                                auction.setLastUserId(null);
                                auction.setDescription(multi.getParameter("newDesc"));

                                auction.save();
                                response.sendRedirect(request.getContextPath());
          }
}
View Full Code Here

TOP

Related Classes of models.Auction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.