Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. public void addEntrySubmitButtonClick(View view) {
  2.  
  3.  
  4. Intent addEntryIntent = getIntent();
  5. int currentRaffleID = addEntryIntent.getIntExtra("raffleIndexInList", 0);
  6. Raffle currentRaffle = Raffle.raffleArrayList.get(currentRaffleID);
  7. String newEntryForename = String.valueOf(addEntryForename.getText());
  8. String newEntrySurname = String.valueOf(addEntrySurname.getText());
  9. + int newEntryTelephoneNo = Integer.parseInt(String.valueOf(addEntryTelephoneNo.getText()));
  10. int newEntryTicketCount = Integer.parseInt(String.valueOf(addEntryTicketCount.getText()));
  11. int newEntryRaffleId = currentRaffle.getId();
  12.  
  13. if ((newEntryForename.equals(null)) || (newEntrySurname.equals(null)) || (String.valueOf(addEntryTelephoneNo).equals(null)) || (String.valueOf(addEntryTicketCount).equals(null))){
  14. Intent failIntent = new Intent();
  15. } else {
  16. Entry newEntry = new Entry(newEntryForename, newEntrySurname, newEntryTelephoneNo, newEntryTicketCount, newEntryRaffleId);
  17.  
  18.  
  19. // Get the list of raffles
  20. for(Raffle currentEntryRaffle : Raffle.raffleArrayList) {
  21. if((currentEntryRaffle.getId() == newEntryRaffleId) && ((currentEntryRaffle.getEntryArrayList().size()) < (currentEntryRaffle.getMaxTickets()))) {
  22. int counter=0;
  23. do {
  24. currentEntryRaffle.getEntryArrayList().add(newEntry);
  25. counter++;
  26. } while(counter < newEntryTicketCount);
  27. }
  28. }
  29.  
  30. Intent returnIntent = new Intent();
  31. setResult(RESULT_CANCELED, returnIntent);
  32. finish();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement