示例#1
0
 public void orderTest3() {
   Customer customer = customerDAO.getCustomerById(2);
   List list = orderService.getOrdersByUsername(customer.getUsername());
   System.out.println("List size :" + list.size());
   for (Object obj : list) {
     System.out.println(obj);
   }
 }
  public void onClick(View v) {
    if (v.getId() == R.id.confirm) {
      // add code to remove the reservation

      dateFormat = new SimpleDateFormat("MM/dd/yyyy h:mm a", Locale.US);

      DateFormat transDateFormat = new SimpleDateFormat("MM/dd/yyyy");
      DateFormat transTimeFormat = new SimpleDateFormat("h:mm a");

      Long checkDate = null;
      Long returnDate = null;
      Date date = new Date();

      String resNum = "";

      for (Reservation temp : otterLibrary.reservations) {
        if (myBook.equals(temp.getReservedBook())) {
          System.out.println("they are equal");
          otterLibrary.availableBooks.add(
              myBook); // this should let the book be available for a hold again
          checkDate = temp.getCheckoutDate();
          returnDate = temp.getReturnDate();
          resNum = Integer.toString(temp.getReservationNumber());
        }
      }

      otterLibrary.addToLogs("----------------", "---------------");
      otterLibrary.addToLogs("Transaction Type: ", "Cancel Hold");
      otterLibrary.addToLogs("Customer's Username: "******"Book Title: ", myBook.getTitle());
      otterLibrary.addToLogs("Pickup Date: ", dateFormat.format(checkDate));
      otterLibrary.addToLogs("Return Date: ", dateFormat.format(returnDate));
      otterLibrary.addToLogs("Reservation Number: ", resNum);
      otterLibrary.addToLogs(
          "Transaction Date: ", transDateFormat.format(date)); // double check this
      otterLibrary.addToLogs("Transaction Time: ", transTimeFormat.format(date));
      otterLibrary.addToLogs("----------------", "---------------");

      Intent i = new Intent(this, MainActivity.class);
      startActivity(i);
    }
  }
 public void setCustomerID(int customerID) {
   CustomerID = customerID;
   lblAddCustomer.setText("Edit Customer");
   Customer customer = CustomerBL.GetCustomer(GetPU(), customerID);
   if (customer != null) {
     txtFirstName.setText(customer.getFirstName());
     txtLastName.setText(customer.getLastName());
     txtUsername.setText(customer.getUsername());
     txtUsername.setEditable(false);
     txtPassword.setText("");
     txtEmail.setText(customer.getEmail());
     txtPhone.setText(customer.getPhone());
     txtStreet1.setText(customer.getAddr_Street1());
     txtStreet2.setText(customer.getAddr_Street2());
     txtCity.setText(customer.getAddr_City());
     txtState.setText(customer.getAddr_State());
     txtZipcode.setText(customer.getAddr_Zipcode());
     txtCountry.setText(customer.getAddr_Country());
     chkActive.setSelected(customer.isIsActive());
   }
 }
示例#4
0
 public void testGetCustomerById() {
   List list = (List) customerDAO.getCustomerById(1);
   Customer cus = (Customer) list.get(0);
   assertEquals("赵小明", cus.getUsername());
 }