Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void addEntrySubmitButtonClick(View view) {
- Intent addEntryIntent = getIntent();
- int currentRaffleID = addEntryIntent.getIntExtra("raffleIndexInList", 0);
- Raffle currentRaffle = Raffle.raffleArrayList.get(currentRaffleID);
- String newEntryForename = String.valueOf(addEntryForename.getText());
- String newEntrySurname = String.valueOf(addEntrySurname.getText());
- + int newEntryTelephoneNo = Integer.parseInt(String.valueOf(addEntryTelephoneNo.getText()));
- int newEntryTicketCount = Integer.parseInt(String.valueOf(addEntryTicketCount.getText()));
- int newEntryRaffleId = currentRaffle.getId();
- if ((newEntryForename.equals(null)) || (newEntrySurname.equals(null)) || (String.valueOf(addEntryTelephoneNo).equals(null)) || (String.valueOf(addEntryTicketCount).equals(null))){
- Intent failIntent = new Intent();
- } else {
- Entry newEntry = new Entry(newEntryForename, newEntrySurname, newEntryTelephoneNo, newEntryTicketCount, newEntryRaffleId);
- // Get the list of raffles
- for(Raffle currentEntryRaffle : Raffle.raffleArrayList) {
- if((currentEntryRaffle.getId() == newEntryRaffleId) && ((currentEntryRaffle.getEntryArrayList().size()) < (currentEntryRaffle.getMaxTickets()))) {
- int counter=0;
- do {
- currentEntryRaffle.getEntryArrayList().add(newEntry);
- counter++;
- } while(counter < newEntryTicketCount);
- }
- }
- Intent returnIntent = new Intent();
- setResult(RESULT_CANCELED, returnIntent);
- finish();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement