예제 #1
0
  @RequestMapping(value = "/changeCustomerUserData", method = RequestMethod.POST)
  public ModelAndView changeCustomer(
      ModelAndView mav,
      @RequestParam("uid") UserIdentifier uid,
      @RequestParam("vname") String vname,
      @RequestParam("nname") String nname,
      @RequestParam("email") String email,
      @RequestParam("street") String street,
      @RequestParam("hNumber") String hNumber,
      @RequestParam("plz") String plz,
      @RequestParam("city") String city) {

    Customer currentUser = (Customer) GmbPersistenceManager.get(uid);

    boolean changeTest = false;
    if (!vname.equals(currentUser.getMemberData().getFirstName())) {
      changeTest = true;
    }
    if (!nname.equals(currentUser.getMemberData().getLastName())) {
      changeTest = true;
    }
    if (!email.equals(currentUser.getMemberData().getEMail())) {
      changeTest = true;
    }
    if (!street.equals(currentUser.getMemberData().getAdress().getStreetName())) {
      changeTest = true;
    }
    if (!hNumber.equals(currentUser.getMemberData().getAdress().getHouseNumber())) {
      changeTest = true;
    }
    if (!plz.equals(currentUser.getMemberData().getAdress().getPostCode())) {
      changeTest = true;
    }
    if (!city.equals(currentUser.getMemberData().getAdress().getTownName())) {
      changeTest = true;
    }

    if (changeTest) {
      Adress newAdress = GmbFactory.new_Adress(street, hNumber, plz, city);
      MemberData newMemberData =
          GmbFactory.new_MemberData(
              vname,
              nname,
              currentUser.getMemberData().getBirthDate(),
              currentUser.getMemberData().getPhoneNumber(),
              email,
              newAdress);
      currentUser
          .sendDataUpdateRequest(newMemberData, "Hello, please accept my update. Thanks.")
          .accept();
      mav.addObject("comment", "Ihr Änderungswunsch wird von einem Mitarbeiter bearbeitet.");
    } else {
      mav.addObject("comment", "Sie haben keine Änderungen vorgenommen.");
    }

    mav.addObject("currentUser", currentUser);
    mav.setViewName("customer/accountStuff/editCustomerUserData");
    return mav;
  }
예제 #2
0
  @RequestMapping(value = "/customerTips", method = RequestMethod.GET)
  public ModelAndView customerTips(@RequestParam("uid") UserIdentifier uid) {
    ModelAndView mav = new ModelAndView();
    Customer currentCustomer = (Customer) GmbPersistenceManager.get(uid);
    mav.setViewName("customer/tips/tip_customerTips");

    LinkedList<WeeklyLottoSTT> weeklySTTList = new LinkedList<WeeklyLottoSTT>();
    LinkedList<TotoSTT> totoSTTList = new LinkedList<TotoSTT>();
    LinkedList<DailyLottoSTT> dailyLottoSTTList = new LinkedList<DailyLottoSTT>();
    for (TotoSTT tSTT : currentCustomer.getTotoSTTs()) {
      if (!tSTT.getTip().getDraw().getEvaluated()) totoSTTList.add(tSTT);
    }
    for (DailyLottoSTT dLSTT : currentCustomer.getDailyLottoSTTs()) {
      if (!dLSTT.getTip().getDraw().getEvaluated()) dailyLottoSTTList.add(dLSTT);
    }
    for (WeeklyLottoSTT wLSTT : currentCustomer.getWeeklyLottoSTTs()) {
      if (!wLSTT.getTip().getDraw().getEvaluated()) weeklySTTList.add(wLSTT);
    }
    mav.addObject("weeklySTTList", (weeklySTTList.size() > 0) ? weeklySTTList : null);
    mav.addObject("totoSTTList", (totoSTTList.size() > 0) ? totoSTTList : null);
    mav.addObject("dailySTTList", (dailyLottoSTTList.size() > 0) ? dailyLottoSTTList : null);
    mav.addObject(
        "weeklyPTTList",
        (currentCustomer.getWeeklyLottoPTTs().size() > 0)
            ? currentCustomer.getWeeklyLottoPTTs()
            : null);
    mav.addObject(
        "dailyPTTList",
        (currentCustomer.getDailyLottoPTTs().size() > 0)
            ? currentCustomer.getDailyLottoPTTs()
            : null);
    mav.addObject("currentUser", currentCustomer);
    return mav;
  }
예제 #3
0
 @RequestMapping(value = "/chargingBankAccount", method = RequestMethod.POST)
 public ModelAndView chargingBankAccount(
     ModelAndView mav,
     @RequestParam("uid") UserIdentifier uid,
     @RequestParam("load") String load) {
   System.out.println("----loadingBankAccount----");
   Customer currentUser = (Customer) GmbPersistenceManager.get(uid);
   ExternalTransactionRequest currentRequest =
       currentUser
           .getBankAccount()
           .sendExternalTransactionRequest(new CDecimal("-" + load), "druff")
           .var2;
   currentRequest.accept();
   mav.setViewName("bankingCustomer");
   mav.addObject("currentUser", GmbPersistenceManager.get(uid));
   return mav;
 }
예제 #4
0
  @RequestMapping(value = "/changeCustomerPassword", method = RequestMethod.POST)
  public ModelAndView changeCustomerPassword(
      ModelAndView mav,
      @RequestParam("uid") UserIdentifier uid,
      @RequestParam("oldPassword") String oldPassword,
      @RequestParam("newPassword") String newPassword) {

    Customer currentUser = (Customer) GmbPersistenceManager.get(uid);

    if ((oldPassword == "" || newPassword == "")) {
      mav.addObject("comment", "Sie müssen alle Felder Füllen !");
    } else if (currentUser.verifyPassword(oldPassword)) {
      currentUser.changePassword(newPassword);
      GmbPersistenceManager.update(currentUser);
      mav.addObject("comment", "Ihr Passwort wurde geändert.");
    } else {
      mav.addObject("comment", "Sie haben ein falsches Passwort eingegeben !");
    }

    mav.addObject("currentUser", currentUser);
    mav.setViewName("customer/accountStuff/editCustomerPassword");
    return mav;
  }
예제 #5
0
  @RequestMapping(value = "/changeCustomerRealAccount", method = RequestMethod.POST)
  public ModelAndView changeCustomerRealAccount(
      ModelAndView mav,
      @RequestParam("uid") UserIdentifier uid,
      @RequestParam("newBankCode") String newBankCode,
      @RequestParam("newAccountNumber") String newAccountNumber) {
    Customer currentUser = (Customer) GmbPersistenceManager.get(uid);

    boolean changeTest = false;
    if (!newBankCode.equals(currentUser.getBankAccount().getRealAccountData().getBankCode())) {
      changeTest = true;
    }
    if (!newAccountNumber.equals(
        currentUser.getBankAccount().getRealAccountData().getAccountNumber())) {
      changeTest = true;
    }
    System.out.println(changeTest);

    if ((newBankCode == "" || newAccountNumber == "")) {
      mav.addObject("comment", "Sie müssen alle Felder ausüllen !");
    } else if (changeTest) {
      RealAccountData rad = GmbFactory.new_RealAccountData(newBankCode, newAccountNumber);
      currentUser
          .getBankAccount()
          .sendDataUpdateRequest(
              GmbFactory.new_RealAccountData(newBankCode, newAccountNumber), "Bitte aendern.")
          .accept();
      mav.addObject("comment", "Ihr Änderungswunsch wird von einem Mitarbeiter bearbeitet.");
    } else if (!changeTest) {
      mav.addObject("comment", "Sie haben keine Änderungen vorgenommen.");
    }

    mav.addObject("currentUser", currentUser);
    mav.setViewName("customer/accountStuff/editCustomerRealAccount");
    return mav;
  }
예제 #6
0
 @RequestMapping(value = "/createUser", method = RequestMethod.POST)
 public ModelAndView createUser(
     ModelAndView mav,
     @RequestParam("vname") String vname,
     @RequestParam("nname") String nname,
     @RequestParam("uid") UserIdentifier uid,
     @RequestParam("password") String password,
     @RequestParam("email") String email,
     @RequestParam("street") String street,
     @RequestParam("hNumber") String hNumber,
     @RequestParam("plz") String plz,
     @RequestParam("city") String city,
     @RequestParam("accountNumber") String accountNumber,
     @RequestParam("bankCode") String bankCode,
     @RequestParam("age") String age) {
   if (age.equals(new String("false"))) {
     mav.setViewName("register");
     mav.addObject("vorname", vname);
     mav.addObject("nachname", nname);
     mav.addObject("password", password);
     mav.addObject("uid", uid);
     mav.addObject("email", email);
     mav.addObject("street", street);
     mav.addObject("hNumber", hNumber);
     mav.addObject("plz", plz);
     mav.addObject("city", city);
     mav.addObject("accountNumber", accountNumber);
     mav.addObject("bankCode", bankCode);
     mav.addObject("fail", "- Fehler");
     mav.addObject(
         "comment",
         new String(
             "Sie müssen mindestens 18 Jahre alt sein um an Gewinnspielen teilnehmen zu können!"));
     return mav;
   }
   // Username schon vorhanden
   if (GmbPersistenceManager.get(uid) != null) {
     mav.setViewName("register");
     mav.addObject("vorname", vname);
     mav.addObject("nachname", nname);
     mav.addObject("password", password);
     mav.addObject("uid", "");
     mav.addObject("email", email);
     mav.addObject("street", street);
     mav.addObject("hNumber", hNumber);
     mav.addObject("plz", plz);
     mav.addObject("city", city);
     mav.addObject("accountNumber", accountNumber);
     mav.addObject("bankCode", bankCode);
     mav.addObject("uidFail", "fail");
     mav.addObject("fail", "- Fehler");
     mav.addObject("comment", new String("Die UID wird schon verwendet !"));
   } else if (this.testeEingabeFehler(
       vname,
       nname,
       uid.getIdentifier(),
       password,
       email,
       street,
       hNumber,
       plz,
       city,
       accountNumber,
       bankCode)) {
     mav.setViewName("register");
     mav.addObject("vorname", vname);
     mav.addObject("nachname", nname);
     mav.addObject("password", password);
     mav.addObject("uid", uid.toString());
     mav.addObject("email", email);
     mav.addObject("street", street);
     mav.addObject("hNumber", hNumber);
     mav.addObject("plz", plz);
     mav.addObject("city", city);
     mav.addObject("accountNumber", accountNumber);
     mav.addObject("bankCode", bankCode);
     mav.addObject("fail", "- Fehler");
     mav.addObject("comment", new String("Alle Felder fuellen !!!"));
   } else {
     Adress adress = GmbFactory.new_Adress(street, hNumber, plz, city);
     MemberData memberData =
         GmbFactory.new_MemberData(
             vname, nname, new DateTime(1970, 10, 16, 0, 0), "0735643", email, adress);
     RealAccountData rad = GmbFactory.new_RealAccountData(bankCode, accountNumber);
     LotteryBankAccount lba = GmbFactory.new_LotteryBankAccount(rad);
     Customer user = new Customer(uid.toString(), password, memberData, lba);
     Lottery.getInstance().getMemberManagement().addMember(user);
     lba.setOwner(user);
     user.getBankAccount().setCredit(new CDecimal(5000));
     user.activateAccount();
     mav.setViewName("redirect:/");
   }
   return mav;
 }