Example #1
0
 public void removePkgItem(ActionEvent event) {
   BuyPkgItem pkgItem = (BuyPkgItem) event.getComponent().getAttributes().get("pkgRsv");
   getPkgItems().remove(pkgItem);
   bimbl.removeBuyPkgItem(pkgItem);
   FacesMessage msg = new FacesMessage("Your item is deleted! ");
   FacesContext.getCurrentInstance().addMessage(null, msg);
 }
Example #2
0
  public void createBuyShowItem(ActionEvent event) throws IOException {
    System.err.println("test show item shopping cart!");
    setMemberAccount(
        (MemberAccount)
            FacesContext.getCurrentInstance()
                .getExternalContext()
                .getSessionMap()
                .get("currentMember"));
    System.err.println("select section num" + getTicketmanager().getSelectSectionNum());
    System.err.println("Show name : " + getTicketmanager().getSelectShowInfo().getName());
    System.err.println("section ticket : " + getTicketmanager().getSelectSectionTicket());

    String orderName =
        getTicketmanager().getSelectShowInfo().getName()
            + " ( section : "
            + getTicketmanager().getSelectSectionTicket().getSeatSection().getNum()
            + " )";
    System.err.println("Order Name : " + orderName);
    int quantity = getTicketmanager().getSelectSeats().size();
    System.err.println("ticket quantity : " + quantity);
    float price = getTicketmanager().getSelectSectionTicket().getPrice();
    System.err.println("ticket unit price : " + price);
    this.setShowItem(bimbl.addBuyShowItem(getMemberAccount(), orderName, quantity, (double) price));
    FacesMessage msg = new FacesMessage("Your ticket order is succesfully added to Shopping Cart!");
    FacesContext.getCurrentInstance().addMessage(null, msg);
    FacesContext fc = FacesContext.getCurrentInstance();
    ExternalContext ec = fc.getExternalContext();
    ec.redirect("../CRM/Payment/cart.xhtml");
  }
Example #3
0
 public double getTotalAmount() {
   setMemberAccount(
       (MemberAccount)
           FacesContext.getCurrentInstance()
               .getExternalContext()
               .getSessionMap()
               .get("currentMember"));
   double amount = bimbl.calculateTotalCardValue(getMemberAccount());
   FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("amount", amount);
   return amount;
 }
Example #4
0
 public void removeShowTicketItem(ActionEvent event) {
   System.err.println("start to delete show ticket");
   BuyShowTicketItem showTicket =
       (BuyShowTicketItem) event.getComponent().getAttributes().get("showticket");
   System.err.println("show ticket " + showTicket.getTicketName());
   this.getShowItems().remove(showTicket);
   FacesMessage msg = new FacesMessage("Your item is deleted! ");
   bimbl.removeBuyShowItem(showTicket);
   System.err.println("delete done");
   FacesContext.getCurrentInstance().addMessage(null, msg);
 }
Example #5
0
 /** @return the pkgItems */
 public List<BuyPkgItem> getPkgItems() {
   setMemberAccount(
       (MemberAccount)
           FacesContext.getCurrentInstance()
               .getExternalContext()
               .getSessionMap()
               .get("currentMember"));
   if ((pkgItems == null) || pkgItems.isEmpty()) {
     pkgItems = bimbl.getAllPkgItems(getMemberAccount());
   }
   return pkgItems;
 }
Example #6
0
 /** @return the hoteItems */
 public List<BuyHotelItem> getHoteItems() {
   setMemberAccount(
       (MemberAccount)
           FacesContext.getCurrentInstance()
               .getExternalContext()
               .getSessionMap()
               .get("currentMember"));
   if ((hoteItems == null) || hoteItems.isEmpty()) {
     hoteItems = bimbl.getAllHotelItems(getMemberAccount());
   }
   return hoteItems;
 }
Example #7
0
 public List<BuyCardValue> getCardItems() {
   setMemberAccount(
       (MemberAccount)
           FacesContext.getCurrentInstance()
               .getExternalContext()
               .getSessionMap()
               .get("currentMember"));
   if (cardItems == null || cardItems.isEmpty()) {
     cardItems = bimbl.getAllCardItems(getMemberAccount());
   }
   return cardItems;
 }
Example #8
0
  public void createBuyCardItem(ActionEvent event) {
    System.err.println("TEST");
    FacesMessage msg = new FacesMessage("Your Transaction is succesfully added to Shopping Cart!");
    setMemberAccount(
        (MemberAccount)
            FacesContext.getCurrentInstance()
                .getExternalContext()
                .getSessionMap()
                .get("currentMember"));
    System.err.println("Get memberID = " + getMemberAccount().getId());
    String valuePackage = getBuyCardValue().getTopupType();
    System.err.println(valuePackage);

    if (valuePackage.equals("1000")) {
      this.setBuyCardValue(bimbl.addCardBuyItem(getMemberAccount(), valuePackage, 1000));
      System.err.println("ValueCardValue ID = " + getBuyCardValue());
    } else if (valuePackage.equals("2000")) {
      this.setBuyCardValue(bimbl.addCardBuyItem(getMemberAccount(), valuePackage, 1960));
    } else if (valuePackage.equals("3000")) {
      this.setBuyCardValue(bimbl.addCardBuyItem(getMemberAccount(), valuePackage, 2850));
    } else if (valuePackage.equals("5000")) {
      this.setBuyCardValue(bimbl.addCardBuyItem(getMemberAccount(), valuePackage, 4600));
    } else if (valuePackage.equals("8000")) {
      this.setBuyCardValue(bimbl.addCardBuyItem(getMemberAccount(), valuePackage, 7200));
    } else if (valuePackage.equals("10000")) {
      this.setBuyCardValue(bimbl.addCardBuyItem(getMemberAccount(), valuePackage, 8800));
    }

    FacesContext.getCurrentInstance().addMessage(null, msg);
  }
Example #9
0
 /** @return the showItems */
 public List<BuyShowTicketItem> getShowItems() {
   setMemberAccount(
       (MemberAccount)
           FacesContext.getCurrentInstance()
               .getExternalContext()
               .getSessionMap()
               .get("currentMember"));
   if ((showItems == null) || showItems.isEmpty()) ;
   {
     showItems = bimbl.getAllShowItems(getMemberAccount());
   }
   return showItems;
 }
Example #10
0
  public void createHotelItem(ActionEvent event) throws IOException, NoSuchAlgorithmException {
    getReservationmanager().addReservation2();
    setMemberAccount(
        (MemberAccount)
            FacesContext.getCurrentInstance()
                .getExternalContext()
                .getSessionMap()
                .get("currentMember"));
    System.err.println("  hahah  ");

    System.err.println(
        "test 1 " + getReservationmanager().getRtreservation().getRoomtype().getHotel().getName());
    String orderName =
        getReservationmanager().getRtreservation().getRoomtype().getHotel().getName()
            + " : "
            + getReservationmanager().getRtreservation().getRoomtype().getType();
    System.err.println("Order Name : " + orderName);
    Date start = getReservationmanager().getRtreservation().getDateFrom();
    Date end = getReservationmanager().getRtreservation().getDateTo();
    String description = "reservation period: " + start + " to " + end;
    System.err.println(description);
    System.err.println("duration " + getReservationmanager().getDuration());
    System.err.println("quantity " + getReservationmanager().getRoomQuantity());
    int quantity =
        getReservationmanager().getRtreservation().getDuration()
            * getReservationmanager().getRtreservation().getRoomQuantity();
    System.err.println(quantity);
    //        double price =
    // (double)reservationmanager.getRtreservation().getRoomtype().getPrice_l();

    String str = "" + getReservationmanager().getRtreservation().getRoomtype().getPrice_l();
    double price = Double.parseDouble(str);
    System.out.println("price " + price);

    System.err.println(price);
    this.setHotelItem(
        bimbl.addHotelItem(getMemberAccount(), orderName, quantity, price, description));
    System.err.println("add successfully!");
    FacesMessage msg = new FacesMessage("Your hotel order is succesfully added to Shopping Cart!");
    FacesContext.getCurrentInstance().addMessage(null, msg);
    FacesContext fc = FacesContext.getCurrentInstance();
    ExternalContext ec = fc.getExternalContext();
    ec.redirect("../CRM/Payment/cart.xhtml");
  }
Example #11
0
 public void removeBuyCardValue(BuyCardValue buyCardValue) {
   getCardItems().remove(buyCardValue);
   FacesMessage msg = new FacesMessage("Your item is deleted! ");
   bimbl.removeCardValueItem(buyCardValue);
   FacesContext.getCurrentInstance().addMessage(null, msg);
 }