Package business

Examples of business.ShoppingCartEntry


    protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
        doPost( request, response );
    }

    private boolean addToCart( HttpServletRequest request ) {
        ShoppingCartEntry entry = new ShoppingCartEntry();
        entry.init( bzb.getDriver() );
        entry.setListId( RequestHelper.getInt( "listId", request ) );
        entry.setUserId( bzb.getAuthenticatedUser( request ).getUserId() );

        return entry.save();
    }
View Full Code Here


        return entry.save();
    }

    private boolean removeFromCart( HttpServletRequest request ) {
        ShoppingCartEntry entry;
        String where = "listId = " + RequestHelper.getInt( "listId", request );
        ResultSet result = bzb.getDriver().select( "shoppingcartentry", null, where );

        try {
            if( result.next() ) {
                entry = new ShoppingCartEntry();
                entry.init( bzb.getDriver() );
                entry.populate( result );

                return entry.remove();
            }
        } catch( SQLException e ) {

        }
View Full Code Here

        return false;
    }

    private ArrayList<BookListing> getListings( HttpServletRequest request ) {
        ArrayList<BookListing> listings = new ArrayList<BookListing>();
        ShoppingCartEntry entry;
        String[] fields = { "l.*", "b.*", "u.*" };
        String where = "e.userId = " + bzb.getAuthenticatedUser( request ).getUserId();
        String[] join = { "INNER JOIN bzb.booklisting l ON l.listId = e.listId",
                        "INNER JOIN bzb.book b ON b.isbn = l.isbn",
                        "INNER JOIN bzb.user u ON u.userId = l.userId" };
        ResultSet result = bzb.getDriver().select( "shoppingcartentry e", fields, where, join, null, null, null, 0, 0 );

        try {
            while( result.next() ) {
                entry = new ShoppingCartEntry();
                entry.init( bzb.getDriver() );
                entry.populate( result );
                listings.add( entry.getListing() );
            }
        } catch( SQLException e ) {

        }

View Full Code Here

TOP

Related Classes of business.ShoppingCartEntry

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.