public int PurchaseMoreTickets(string roomID, int eventID, int moreTickets) { // if the room already has tickets for this event, add more to it int rows = 0; int currentTicketAmount = 0; try { // get the current amount of tickets there are currentTicketAmount = RoomAccessor.FindNumberOfTickets(roomID, eventID); } catch (Exception) { throw; } // the new amount of tickets that needs to be stored int newTicketAmount = currentTicketAmount + moreTickets; try { rows = RoomAccessor.UpdateRoomEventWithTicket(roomID, eventID, currentTicketAmount, newTicketAmount); } catch (Exception) { throw; } return(rows); }
public Guest VerifyGuest(string roomID, string PIN) { // check if the guest entered a proper room number and PIN Guest guest = null; try { if (1 == RoomAccessor.VerifyRoomAndPIN(roomID, UserManager.HashSHA256(PIN))) { // the login was successfull PIN = null; guest = GuestAccessor.RetrieveGuestByRoomID(roomID); if (null == guest) { throw new ApplicationException("Could not find guest associated with that room!"); } } else { throw new ApplicationException("Incorrect Login, please try again."); } } catch (Exception) { throw; } return(guest); }
public int PurchaseTickets(string roomID, int eventID, int tickets) { // use if the room doesn't already have tickets for the event int rows = 0; try { rows = RoomAccessor.InsertNewPurchase(roomID, eventID, tickets); } catch (Exception) { throw; } return(rows); }
public bool RemoveReservedTickets(Guest guest, Event selectedEvent) { // Cancel tickets for the event bool isValid = false; try { if (1 == RoomAccessor.DeleteRoomEvent(guest.RoomID, selectedEvent.EventID)) { isValid = true; } } catch (Exception) { throw; } return(isValid); }
public bool CheckIfPurchasedAlready(string RoomID, int EventID) { // see if the event is already associated with this room bool purchased = false; try { if (RoomAccessor.CheckIfAlreadyHaveTicket(RoomID, EventID) == 1) { purchased = true; } } catch (Exception) { throw; } return(purchased); }
public bool VerifyPIN(Guest guest, string PIN) { // lets the user check the guest PIN without returning a Guest bool isValid = false; try { if (1 == RoomAccessor.VerifyRoomAndPIN(guest.RoomID, UserManager.HashSHA256(PIN))) { isValid = true; } } catch (Exception) { throw; } return(isValid); }
public bool UpdatePIN(string roomID, string oldPassword, string newPassword) { // Update a guest's PIN for their room var result = false; try { if (1 == RoomAccessor.UpdatePIN(roomID, UserManager.HashSHA256(oldPassword), UserManager.HashSHA256(newPassword))) { result = true; } else { result = false; } } catch (Exception) { throw; } return(result); }