示例#1
0
        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);
        }
示例#2
0
        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);
        }