Beispiel #1
0
  public void deleteCustAccts(Account account) throws CustomerException {
    if (getId() <= 0) {
      throw new CustomerException(
          "addCustAccts", "Please specify a customer to add an account mapping.");
    }
    if (account == null || account.getAccountno() <= 0) {
      throw new CustomerException(
          "addCustAccts", "Please specify an account to add to customer " + getId());
    }

    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    CustAcctMapDAO custacctmap = new CustAcctMapDAO();
    custacctmap.setCust_id(getId());
    custacctmap.setAccount_no(account.getAccountno());
    Query q = session.getNamedQuery("del_cust_acct_map");
    q.setParameter("cust_id", custacctmap.getCust_id());
    q.setParameter("account_no", custacctmap.getAccount_no());
    List<GeneralSPResponse> spresponse = q.list();

    if (spresponse != null) {
      for (GeneralSPResponse response : spresponse) {
        System.out.println(
            "STATUS :: "
                + response.getStatus()
                + " :: MVNEMSGCODE :: "
                + response.getMvnemsgcode()
                + " :: MVNEMSG :: "
                + response.getMvnemsg());
        if (!response.getStatus().equals("Y")) {
          throw new CustomerException(
              "addCustAccts",
              "Error deleting Customer Acct Map:: "
                  + response.getMvnemsgcode()
                  + "::"
                  + response.getMvnemsg());
        }
      }
    } else {
      throw new CustomerException(
          "addCustAccts", "No response returned from the db when calling ins_cust_acct_map");
    }

    session.getTransaction().commit();
  }
Beispiel #2
0
 public CustTopUp setTopupAmount(Account account, String topupAmount) throws CustomerException {
   if (getId() == 0) {
     throw new CustomerException("setTopupAmount", "Customer.id must be set");
   }
   CustTopUp custTopUp = new CustTopUp();
   custTopUp.setCustid(getId());
   custTopUp.setTopupAmount(topupAmount);
   custTopUp.setAccountNo(account.getAccountno());
   custTopUp.save();
   return getTopupAmount(account);
 }
Beispiel #3
0
  public CustTopUp getTopupAmount(Account account) throws CustomerException {
    if (getId() == 0) {
      throw new CustomerException("getTopupAmount", "Customer.id must be set...");
    }
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    String query = "fetch_cust_topup_amt";

    Query q = session.getNamedQuery(query);
    q.setParameter("in_cust_id", getId());
    q.setParameter("in_account_no", account.getAccountno());
    CustTopUp topupAmount = new CustTopUp();
    List<CustTopUp> topupAmountList = q.list();
    for (CustTopUp custTopUp : topupAmountList) {
      topupAmount = custTopUp;
    }
    session.getTransaction().commit();
    return topupAmount;
  }