Examples of Coupon


Examples of com.jada.jpa.entity.Coupon

      throws Throwable {
    CouponMaintActionForm form = (CouponMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    String siteId = adminBean.getSite().getSiteId();
   
    Coupon coupon = CouponDAO.load(siteId, Format.getLong(form.getCouponId()));
    Vector<Category> removeList = new Vector<Category>();
    if (form.getCatIds() != null) {
      for (Category category : coupon.getCategories()) {
        for (String catId : form.getCatIds()) {
          if (category.getCatId().toString().equals(catId)) {
            removeList.add(category);
          }
        }
      }
    }
    Iterator<?> iterator = removeList.iterator();
    while (iterator.hasNext()) {
      Category category = (Category) iterator.next();
      coupon.getCategories().remove(category);
    }
    String result = getJSONCategoryList(coupon);
    streamWebService(response, result);
    return null;
  }
View Full Code Here

Examples of com.jada.jpa.entity.Coupon

    CouponMaintActionForm form = (CouponMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    String siteId = adminBean.getSite().getSiteId();
   
    MessageResources resources = this.getResources(request);
    Coupon coupon = CouponDAO.load(siteId, Format.getLong(form.getCouponId()));
    boolean found = false;
    java.util.Iterator<Item> iterator = coupon.getItems().iterator();
    while (iterator.hasNext()) {
      Item item = (Item) iterator.next();
      if (item.getItemId().equals(Format.getLong(form.getItemId()))) {
        found = true;
        break;
      }
    }
    if (found) {
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
      jsonResult.put("message", resources.getMessage("error.item.exist"));
      streamWebService(response, jsonResult.toHtmlString());
    }
    Item item = ItemDAO.load(siteId, Format.getLong(form.getItemId()));
    if (item == null) {
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
      jsonResult.put("message", resources.getMessage("error.item.notexist"));
      streamWebService(response, jsonResult.toHtmlString());
    }
    coupon.getItems().add(item);
    em.persist(coupon);
    String result = getJSONItemList(coupon, form);
    streamWebService(response, result);
    return null;
  }
View Full Code Here

Examples of com.jada.jpa.entity.Coupon

    CouponMaintActionForm form = (CouponMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    String siteId = adminBean.getSite().getSiteId();
   
    MessageResources resources = this.getResources(request);
    Coupon coupon = CouponDAO.load(siteId, Format.getLong(form.getCouponId()));
    boolean found = false;
    java.util.Iterator<Category> iterator = coupon.getCategories().iterator();
    while (iterator.hasNext()) {
      Category category = (Category) iterator.next();
      if (category.getCatId().equals(Format.getLong(form.getCatId()))) {
        found = true;
        break;
      }
    }
    if (found) {
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
      jsonResult.put("message", resources.getMessage("error.record.duplicate"));
      streamWebService(response, jsonResult.toHtmlString());
    }
    Category category = CategoryDAO.load(siteId, Format.getLong(form.getCatId()));
    if (category == null) {
      JSONEscapeObject jsonResult = new JSONEscapeObject();
      jsonResult.put("status", Constants.WEBSERVICE_STATUS_FAILED);
      jsonResult.put("message", resources.getMessage("error.category.notexist"));
      streamWebService(response, jsonResult.toHtmlString());
    }
    coupon.getCategories().add(category);
    String result = getJSONCategoryList(coupon);
    streamWebService(response, result);
    return null;
  }
View Full Code Here

Examples of com.jada.jpa.entity.Coupon

        calcPage(adminBean, form, list, pageNo);
        Vector<CouponDisplayForm> vector = new Vector<CouponDisplayForm>();
        int startRecord = (form.getPageNo() - 1) * adminBean.getListingPageSize();
        int endRecord = startRecord + adminBean.getListingPageSize();
        for (int i = startRecord; i < list.size() && i < endRecord; i++) {
          Coupon coupon = (Coupon) list.get(i);
          CouponLanguage couponLanguage = null;
          for (CouponLanguage language : coupon.getCouponLanguages()) {
            if (language.getSiteProfileClass().getSiteProfileClassId().equals(form.getSiteProfileClassDefaultId())) {
              couponLanguage = language;
            }
          }
          CouponDisplayForm couponDisplay = new CouponDisplayForm();
          couponDisplay.setCouponCode(coupon.getCouponCode());
          couponDisplay.setCouponName(couponLanguage.getCouponName());
          couponDisplay.setCouponId(Format.getLong(coupon.getCouponId()));
          couponDisplay.setCouponStartDate(Format.getFullDate(coupon.getCouponStartDate()));
          couponDisplay.setCouponEndDate(Format.getFullDate(coupon.getCouponEndDate()));
          couponDisplay.setPublished(String.valueOf(coupon.getPublished()));
            vector.add(couponDisplay);
        }
        CouponDisplayForm coupons[] = new CouponDisplayForm[vector.size()];
        vector.copyInto(coupons);
        form.setCoupons(coupons);
View Full Code Here

Examples of com.jada.jpa.entity.Coupon

                continue;
              }
              if (!coupons[i].getRemove().equals("Y")) {
                continue;
              }
                Coupon coupon = new Coupon();
                coupon = CouponDAO.load(getAdminBean(request).getSite().getSiteId(), Format.getLong(coupons[i].getCouponId()));
                em.remove(coupon);
            }
            em.getTransaction().commit();
          }
View Full Code Here

Examples of com.jada.jpa.entity.Coupon

     
      Vector<ShoppingCartCouponBean> couponVector = new Vector<ShoppingCartCouponBean>();
      iterator = shoppingCart.getShoppingCartCoupons().iterator();
      while (iterator.hasNext()) {
        ShoppingCartCoupon shoppingCartCoupon = (ShoppingCartCoupon) iterator.next();
        Coupon coupon = shoppingCartCoupon.getCoupon();
        ShoppingCartCouponBean bean = new ShoppingCartCouponBean();
        bean.setCouponId(Format.getLong(coupon.getCouponId()));
        bean.setCouponCode(coupon.getCouponCode());
        bean.setCouponName(coupon.getCouponLanguage().getCouponName());
        if (!contentBean.getContentSessionBean().isSiteProfileClassDefault()) {
          for (CouponLanguage language : coupon.getCouponLanguages()) {
            if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
              if (language.getCouponName() != null) {
                bean.setCouponName(language.getCouponName());
              }
              break;
View Full Code Here

Examples of com.jada.jpa.entity.Coupon

       
      Vector<ShoppingCartCouponBean> couponVector = new Vector<ShoppingCartCouponBean>();
      iterator = orderHeader.getOrderOtherDetails().iterator();
       while (iterator.hasNext()) {
        OrderOtherDetail orderOtherDetail = (OrderOtherDetail) iterator.next();
        Coupon coupon = orderOtherDetail.getCoupon();
        ShoppingCartCouponBean bean = new ShoppingCartCouponBean();
        bean.setCouponCode(coupon.getCouponCode());
        bean.setCouponName(coupon.getCouponLanguage().getCouponName());
        if (!contentBean.getContentSessionKey().isSiteProfileClassDefault()) {
          for (CouponLanguage language : coupon.getCouponLanguages()) {
            if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentBean.getContentSessionKey().getSiteProfileClassId())) {
              if (language.getCouponName() != null) {
                bean.setCouponName(language.getCouponName());
              }
              break;
View Full Code Here

Examples of com.jada.jpa.entity.Coupon

    Iterator<?> shoppingCartCoupons = shoppingCart.getShoppingCartCoupons().iterator();
    seqNum = 0;
    while (shoppingCartCoupons.hasNext()) {
      ShoppingCartCoupon shoppingCartCoupon = (ShoppingCartCoupon) shoppingCartCoupons.next();
      OrderOtherDetail orderOtherDetail = new OrderOtherDetail();
      Coupon coupon = shoppingCartCoupon.getCoupon();
      orderOtherDetail.setCoupon(coupon);
      orderOtherDetail.setSeqNum(seqNum++);
      orderOtherDetail.setOrderOtherDetailNum(coupon.getCouponCode());
      orderOtherDetail.setOrderOtherDetailDesc(coupon.getCouponLanguage().getCouponName());
      if (!contentSessionKey.isSiteProfileClassDefault()) {
        for (CouponLanguage language : coupon.getCouponLanguages()) {
          if (language.getSiteProfileClass().getSiteProfileClassId().equals(contentSessionKey.getSiteProfileClassId())) {
            if (language.getCouponName() != null) {
              orderOtherDetail.setOrderOtherDetailDesc(language.getCouponName());
            }
            break;
View Full Code Here

Examples of com.jada.jpa.entity.Coupon

public class CouponDAO extends Currency {
  private static final long serialVersionUID = -7835776219193942800L;
  public static Coupon load(String siteId, Long couponId) throws SecurityException, Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Coupon coupon = (Coupon) em.find(Coupon.class, couponId);
    if (coupon == null) {
      return null;
    }
    if (!coupon.getSite().getSiteId().equals(siteId)) {
      throw new SecurityException();
    }
    return coupon;
  }
View Full Code Here

Examples of com.jada.jpa.entity.Coupon

      saveMessages(request, messages);
            ActionForward actionForward = actionMapping.findForward("error");
            return actionForward;
      }
     
        Coupon coupon = CouponDAO.loadByCouponCode(site.getSiteId(), couponCode);
        if (coupon == null) {
          this.initCartInfo(form, site, shoppingCart, request, messages);
        messages.add("couponCode", new ActionMessage("content.error.coupon.invalid"));
      saveMessages(request, messages);
            ActionForward actionForward = actionMapping.findForward("error");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.