Package org.jayasoft.woj.portal.data.dao.product

Examples of org.jayasoft.woj.portal.data.dao.product.ProductPointDao


    public void buy(User buyer, Product p, int years, int subscribedUsers) {
        if (buyer instanceof UserImpl) {
            try {
                UserImpl godson = (UserImpl)buyer;
                UserDao uDao = DaoFactory.getUserDao();
                ProductPointDao ppDao = DaoFactory.getProductPointDao();
                UserPointDao upDao = DaoFactory.getUserPointDao();
               
                UserImpl godfather = (UserImpl)uDao.findUser(godson.getGodfather());
                if (godfather != null) {
                    ProductPoint pp = ppDao.get(p, years, ProductPoint.GODSON);
                    if (pp.getPoints()!=0) {
                        UserPoint oldGFUP = getUserPoint(godfather);
                        UserPoint gfUP = UserPointFactory.godson(godfather, oldGFUP, godson, p, subscribedUsers, pp);
                        upDao.save(gfUP);
                        ServiceFactory.getRegistrationService().sendFidelityAccountPointEarnedByGodSonBuyMail(godfather, godson, p, subscribedUsers, years, gfUP.getEarnedPoints(), gfUP.getPoints());
                        LOGGER.info("adding " + pp.getPoints() + " to user: " + godfather.getId() + ", his godson: " + godson.getId() + " bought " + p.getCode() + " for " + years + " years");
                    }
                } else {
                    LOGGER.info("user: " + buyer.getId() + " does not have a godfather");
                }
                ProductPoint pp = ppDao.get(p, years, ProductPoint.PURCHASE);
                if (pp != null && pp.getPoints()!=0) {
                    UserPoint oldGSUP = getUserPoint(godson);
                    UserPoint gsUP = UserPointFactory.purchase(godson, oldGSUP, p, subscribedUsers, pp);
                    upDao.save(gsUP);
                    ServiceFactory.getRegistrationService().sendFidelityAccountPointEarnedBySelfPurchaseMail(godson, p, subscribedUsers, years, gsUP.getEarnedPoints(),  gsUP.getPoints());
View Full Code Here


    public void renew(User buyer, Product p, int years) {
        if (buyer instanceof UserImpl) {
            try {
                UserImpl godson = (UserImpl)buyer;
                UserPointDao upDao = DaoFactory.getUserPointDao();
                ProductPointDao ppDao = DaoFactory.getProductPointDao();
               
                ProductPoint pp = ppDao.get(p, years, ProductPoint.RENEWAL);
                if (pp.getPoints()!=0) {
                    UserPoint oldGSUP = getUserPoint(godson);
                    UserPoint gsUP = UserPointFactory.renew(godson, oldGSUP, p, pp);
                    upDao.save(gsUP);
                    ServiceFactory.getRegistrationService().sendFidelityAccountPointEarnedBySelfRenewMail(godson, p, years, gsUP.getEarnedPoints(), gsUP.getPoints());
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.portal.data.dao.product.ProductPointDao

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.