示例#1
0
  public HashMap<String, String> validate() {
    HashMap<String, String> errors = new HashMap<String, String>();
    if ("".equals(this.carPlate) || this.carPlate == null) {
      errors.put("Car Plate", "should not be empty");
    }
    if ("".equals(this.referenceCode) || this.referenceCode == null) {
      errors.put("Reference Code", "should not be empty");
    }
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    try {

      if (Utility.dateDifference(df.parse(this.startDatetime), df.parse(this.endDateTime)) < 0) {
        errors.put("Start and End Date", "should not be Conflicting");
      }
    } catch (Exception e) {
      errors.put("Start and End Date", "should be valid date");
    }
    if (this.customerid <= 0) {
      errors.put("Customer ID", "should not be Null/Empty");
    }
    return errors;
  }
示例#2
0
 /** @return */
 @Override
 public boolean update() {
   HashMap<String, String> record = Utility.convertToHashMap(this);
   return super.updateBy(record, "rentalId", this.rentalId + "");
 }
示例#3
0
 @Override
 public boolean add() {
   HashMap<String, String> record = Utility.convertToHashMap(this);
   return super.add(record);
 }