Package com.centraview.marketing.promotion

Examples of com.centraview.marketing.promotion.PromotionVO


    try {
      PromotionDetailListForm promotionDetailListForm;
      promotionDetailListForm = (PromotionDetailListForm)form;
      promotionDetailListForm.convertItemLines();

      PromotionVO promotionVO = new PromotionVO();
      promotionVO.setName(promotionDetailListForm.getPname());
      promotionVO.setDescription(promotionDetailListForm.getPdescription());
      promotionVO.setStatus(promotionDetailListForm.getPstatus());
      promotionVO.setNotes(promotionDetailListForm.getNotes());
      promotionVO.setItemlines(promotionDetailListForm.getItemLines());
      promotionVO.setNotes(promotionDetailListForm.getNotes());

      if ((promotionDetailListForm.getStartmonth() != null)
          && (promotionDetailListForm.getStartday() != null)
          && (promotionDetailListForm.getStartyear() != null)) {
        String startmonth = promotionDetailListForm.getStartmonth();
        String startday = promotionDetailListForm.getStartday();
        String startyear = promotionDetailListForm.getStartyear();
        try {
          Timestamp start = DateUtility.createTimestamp(startyear, startmonth, startday);
          promotionVO.setStartdate(start);
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }

      if ((promotionDetailListForm.getEndmonth() != null)
          && (promotionDetailListForm.getEndday() != null)
          && (promotionDetailListForm.getEndyear() != null)) {
        String endmonth = promotionDetailListForm.getEndmonth();
        String endday = promotionDetailListForm.getEndday();
        String endyear = promotionDetailListForm.getEndyear();
        try {
          Timestamp end = DateUtility.createTimestamp(endyear, endmonth, endday);
          promotionVO.setEnddate(end);
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }

      Vector vec = new Vector();
      int total = 0;
      String Total = request.getParameter("TotalCustomFields");
      if (Total != null) {
        try {
          total = Integer.parseInt(Total);
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
          total = 0;
        }
      }

      for (int i = 1; i <= total; i++) // starting from 1...
      {
        String fieldid = request.getParameter("fieldid" + i);
        String fieldType = request.getParameter("fieldType" + i);
        String textValue = request.getParameter("text" + i);

        if (fieldid == null)
          fieldid = "0";
        int intfieldId = Integer.parseInt(fieldid);
        CustomFieldVO cfvo = new CustomFieldVO();
        cfvo.setFieldID(intfieldId);
        cfvo.setFieldType(fieldType);
        cfvo.setValue(textValue);

        if (intfieldId != 0)
          vec.add(cfvo);
      }

      promotionVO.setCustomfield(vec);

      HttpSession session = request.getSession();
      int individualId = ((UserObject)session.getAttribute("userobject")).getIndividualID();
      HashMap mapPromotion = new HashMap();
      String promotionid = "";

      if (request.getParameter("promotionid") != null) {
        promotionid = request.getParameter("promotionid");
        mapPromotion.put("PromotionID", promotionid);
      }

      MarketingFacadeHome mfh = (MarketingFacadeHome)CVUtility.getHomeObject(
          "com.centraview.marketing.marketingfacade.MarketingFacadeHome", "MarketingFacade");
      MarketingFacade remote = mfh.create();
      remote.setDataSource(dataSource);
      if (request.getParameter("operation") != null) {
        if (request.getParameter("operation").equals("Add")) {
          mapPromotion.put("PromotionVo", promotionVO);
          promotionid = remote.addPromotion(individualId, mapPromotion);
          promotionDetailListForm.setPromotionid(promotionid);
          request.setAttribute("promotionid", promotionid);
        } else if (request.getParameter("operation").equals("Edit")) {

          promotionVO.setPromotionid(Integer.parseInt(promotionid));
          mapPromotion.put("PromotionVo", promotionVO);
          remote.updatePromotion(individualId, mapPromotion);
        }
      }
View Full Code Here


        MarketingFacadeHome home = (MarketingFacadeHome)CVUtility.getHomeObject("com.centraview.marketing.marketingfacade.MarketingFacadeHome", "MarketingFacade");
        MarketingFacade remote = home.create();
        remote.setDataSource(dataSource);
        HashMap mapPromotion = new HashMap();
        mapPromotion.put("PromotionID", "" + promotionid);
        PromotionVO promotionVO = remote.getPromotion(individualId, mapPromotion);
        PromotionDetailListForm promotionDetailListForm = (PromotionDetailListForm)form;
        //promotionDetailListForm.convertItemLines();
        // wrong to call this method here as there will be no itemlines in existsing form
        // we have to take itemLines from VO and put it in form
        // that is done at bottom ...
        promotionDetailListForm.setPromotionid("" + promotionid);
        promotionDetailListForm.setPname(promotionVO.getName());
        promotionDetailListForm.setPdescription(promotionVO.getDescription());
        promotionDetailListForm.setPstatus(promotionVO.getStatus());
        promotionDetailListForm.setNotes(promotionVO.getNotes());

        if (promotionVO.getStartdate() != null)
        {
          Timestamp date = (Timestamp)promotionVO.getStartdate();
          String strMonth = "" + (date.getMonth() + 1);
          String strDay = "" + date.getDate();
          String strYear = "" + (date.getYear() + 1900);
          promotionDetailListForm.setStartmonth(strMonth);
          promotionDetailListForm.setStartday(strDay);
          promotionDetailListForm.setStartyear(strYear);
        }

        if (promotionVO.getEnddate() != null)
        {
          Timestamp date = (Timestamp)promotionVO.getEnddate();
          String strMonth = "" + (date.getMonth() + 1);
          String strDay = "" + date.getDate();
          String strYear = "" + (date.getYear() + 1900);
          promotionDetailListForm.setEndmonth(strMonth);
          promotionDetailListForm.setEndday(strDay);
          promotionDetailListForm.setEndyear(strYear);
        }

        ItemLines itemlines = promotionVO.getItemlines();
        promotionDetailListForm.setItemLines(itemlines);
        FORWARD_final = FORWARD_Promotion;
        request.setAttribute("TypeOfOperation", "Promotions");
      }
    }
View Full Code Here

      if (promotionid == 0)
        promotionid = Integer.parseInt(request.getParameter("promotionid").toString());

      HashMap mapPromotion = new HashMap();
      mapPromotion.put("PromotionID", "" + promotionid);
      PromotionVO promotionVO = remote.getPromotion(individualId, mapPromotion);

      PromotionDetailListForm promotionDetailListForm = (PromotionDetailListForm)form;
      promotionDetailListForm.convertItemLines();
      promotionDetailListForm.setPromotionid("" + promotionid);
      promotionDetailListForm.setPname(promotionVO.getName());
      promotionDetailListForm.setPdescription(promotionVO.getDescription());
      promotionDetailListForm.setPstatus(promotionVO.getStatus());
      promotionDetailListForm.setNotes(promotionVO.getNotes());

      if (promotionVO.getStartdate() != null)
      {
        Timestamp date = (Timestamp)promotionVO.getStartdate();
        String strMonth = "" + (date.getMonth() + 1);
        String strDay = "" + date.getDate();
        String strYear = "" + (date.getYear() + 1900);
        promotionDetailListForm.setStartmonth(strMonth);
        promotionDetailListForm.setStartday(strDay);
        promotionDetailListForm.setStartyear(strYear);
      }

      if (promotionVO.getEnddate() != null)
      {
        Timestamp date = (Timestamp)promotionVO.getEnddate();
        String strMonth = "" + (date.getMonth() + 1);
        String strDay = "" + date.getDate();
        String strYear = "" + (date.getYear() + 1900);
        promotionDetailListForm.setEndmonth(strMonth);
        promotionDetailListForm.setEndday(strDay);
        promotionDetailListForm.setEndyear(strYear);
      }

      ItemLines itemLines = promotionVO.getItemlines();
      promotionDetailListForm.setItemLines(itemLines);

   
      if (request.getParameter(MarketingConstantKeys.TYPEOFOPERATION) != null)
        if (request.getParameter(MarketingConstantKeys.TYPEOFOPERATION).equals("REMOVEITEM"))
View Full Code Here

  /**
   * This method returns String from local Bean
   */
  public PromotionVO getPromotion(int userId, HashMap data)
  {
    PromotionVO promotionVO = null;
    try {
      InitialContext ic = CVUtility.getInitialContext();
      PromotionLocalHome home = (PromotionLocalHome)ic.lookup("local/Promotion");
      PromotionLocal remote = home.create();
      remote.setDataSource(this.dataSource);
View Full Code Here

TOP

Related Classes of com.centraview.marketing.promotion.PromotionVO

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.