Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Coupon


   
      Vector<OrderDetailDisplayForm> otherVector = new Vector<OrderDetailDisplayForm>();
      iterator = header.getOrderOtherDetails().iterator();
       while (iterator.hasNext()) {
        OrderOtherDetail orderOtherDetail = (OrderOtherDetail) iterator.next();
        Coupon coupon = orderOtherDetail.getCoupon();
        OrderDetailDisplayForm bean = new OrderDetailDisplayForm();
        bean.setItemShortDesc(coupon.getCouponCode() + " " + 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.setItemShortDesc(coupon.getCouponCode() + " " + language.getCouponName());
              }
              break;
            }
          }
        }
View Full Code Here


    }
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
   
    Coupon coupon = (Coupon) em.find(Coupon.class, Format.getLong(form.getCouponId()));
    copyProperties(form, coupon);
   
      GoogleTranslate translator = new GoogleTranslate(form.getFromLocale(), form.getToLocale());
      form.setCouponNameLangFlag(true);
      form.setCouponNameLang(translator.translate(coupon.getCouponLanguage().getCouponName()));
 
    FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    ActionForward actionForward = actionMapping.findForward("success");
    return actionForward;
  }
View Full Code Here

    }
   
    Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
   
    Coupon coupon = (Coupon) em.find(Coupon.class, Format.getLong(form.getCouponId()));
    copyProperties(form, coupon);
   
    FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    ActionForward actionForward = actionMapping.findForward("success");
    return actionForward;
View Full Code Here

    initSiteProfiles(form, site);
        if (form == null) {
            form = new CouponMaintActionForm();
        }
    String couponId = request.getParameter("couponId");
        Coupon coupon = new Coupon();
        coupon = CouponDAO.load(getAdminBean(request).getSite().getSiteId(), Format.getLong(couponId));
        form.setMode("U");
        copyProperties(form, coupon);
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
        ActionForward actionForward = actionMapping.findForward("success");
View Full Code Here

    CouponMaintActionForm form = (CouponMaintActionForm) actionForm;
        Site site = getAdminBean(request).getSite();
    initSiteProfiles(form, site);
 
    try {
      Coupon coupon = CouponDAO.load(getAdminBean(request).getSite().getSiteId(), Format.getLong(form.getCouponId()));
      em.remove(coupon);
      em.getTransaction().commit();
    }
    catch (Exception e) {
      if (Utility.isConstraintViolation(e)) {
View Full Code Here

    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    String siteId = site.getSiteId();
     initSiteProfiles(form, site);

    Coupon coupon = CouponDAO.load(siteId, Format.getLong(form.getCouponId()));

    form.setCouponCode(form.getCouponCode().toUpperCase());
    ActionMessages errors = validate(form, insertMode, site.getSiteId());
    if (errors.size() != 0) {
      saveMessages(request, errors);
      return mapping.findForward("error");
    }

    if (insertMode) {
      coupon = new Coupon();
      coupon.setSite(site);
      coupon.setCouponTotalUsed(Integer.valueOf(0));
      coupon.setRecCreateBy(adminBean.getUser().getUserId());
      coupon.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    if (form.isSiteProfileClassDefault() && form.isSiteCurrencyClassDefault()) {
      saveDefault(coupon, form, adminBean);
    }
    else {
      if (!form.isSiteProfileClassDefault()) {
        saveLanguage(coupon, form, adminBean);
      }
      if (!form.isSiteCurrencyClassDefault()) {
        saveCurrency(coupon, form, adminBean);
      }
    }
    if (insertMode) {
      em.persist(coupon);
    }
    form.setCouponTotalUsed(Format.getInt(coupon.getCouponTotalUsed()));
    form.setMode("U");
    form.setCouponId(coupon.getCouponId().toString());
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    return mapping.findForward("success");
  }
View Full Code Here

  }

    public ActionMessages validate(CouponMaintActionForm form, boolean insertMode, String siteId) throws SecurityException, Exception {
      ActionMessages errors = new ActionMessages();
     
      Coupon coupon = CouponDAO.loadByCouponCode(siteId, form.getCouponCode());
      if (coupon != null) {
        if (!form.getCouponId().equals(coupon.getCouponId().toString())) {
          errors.add("couponCode", new ActionMessage("error.record.duplicate"));
        }
      }
      if (Format.isNullOrEmpty(form.getCouponCode())) {
        errors.add("couponCode", new ActionMessage("error.string.required"));
View Full Code Here

      throws Throwable {
    CouponMaintActionForm form = (CouponMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    String siteId = adminBean.getSite().getSiteId();
   
    Coupon coupon = CouponDAO.load(siteId, Format.getLong(form.getCouponId()));
    String result = getJSONItemList(coupon, form);
    streamWebService(response, result);
    return null;
  }
View Full Code Here

      throws Throwable {
    CouponMaintActionForm form = (CouponMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    String siteId = adminBean.getSite().getSiteId();
   
    Coupon coupon = CouponDAO.load(siteId, Format.getLong(form.getCouponId()));
    String result = getJSONCategoryList(coupon);
    streamWebService(response, result);
    return null;
  }
View Full Code Here

      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<Item> removeList = new Vector<Item>();
    if (form.getItemIds() != null) {
      for (Item item : coupon.getItems()) {
        for (String itemId : form.getItemIds()) {
          if (item.getItemId().toString().equals(itemId)) {
            removeList.add(item);
          }
        }
      }
    }
    Iterator<?> iterator = removeList.iterator();
    while (iterator.hasNext()) {
      Item item = (Item) iterator.next();
      coupon.getItems().remove(item);
    }
    String result = getJSONItemList(coupon, form);
    streamWebService(response, result);
    return null;
  }
View Full Code Here

TOP

Related Classes of com.jada.jpa.entity.Coupon

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.