Package burhan.bean

Examples of burhan.bean.NotificationBean


    }*/
  }
 
  private void addTransaction(HttpServletRequest request, HttpServletResponse response) throws IOException
  {
    NotificationBean notificationBean =  new NotificationBean();
    if(isPost){
      // recive post data
      String type = request.getParameter("type");
      String dateStr = request.getParameter("date");
      String amountStr = request.getParameter("amount");
      String description = request.getParameter("description");
     
      // valiadation
      Date date = null;
      float amount = 0;     
      type = "EARNING".equals(type) ? "EARNING" : "EXPENSE";
      try {
        DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
        date = formatter.parse(dateStr);
      } catch (ParseException e) {
        // do nothing
      }
      try
      {
        amount = Float.valueOf(amountStr).floatValue();
      } catch (Exception e) {
        // do nothing
      }
     
      // set notifications
      if(date == null){
        notificationBean.addError("Please enter a valid date");
      }
      if(amount == 0){
        notificationBean.addError("Please enter an valid amount");
      }
     
      // store data
      if(notificationBean.getErrorCount() == 0 ){
       
            Key transactionKey = KeyFactory.createKey("UserTransactions", user.getUserId());

            Entity t = new Entity("Transaction", transactionKey);
            t.setProperty("type", type);
View Full Code Here

TOP

Related Classes of burhan.bean.NotificationBean

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.