Example #1
0
    def message_member(self, user_input):
        if (int(user_input) in self.requests_dict.keys()):
            handler = Message(self.cursor)
            self.cursor.execute("SELECT email FROM requests WHERE rid = :user_input", {'user_input': user_input})
            email = self.cursor.fetchone()[0]

            message_body = input("Please enter the message you want to send " + email + "\n")
            
            handler.new(self.email, email, message_body, user_input)

            print("Successfully sent " + email + " with message: \n" + message_body)
            self.find_requests_by_location(self.location)
        else:
            user_input = input("Invalid entry. Please enter a valid request number: ")
            self.message_member(user_input)
    def message_member(self, user_input):
        if (user_input.isdigit() and int(user_input) in self.rides_dict):
            handler = Message(self.cursor)
            self.cursor.execute(
                "SELECT driver FROM rides WHERE rno = :user_input",
                {'user_input': user_input})
            email = self.cursor.fetchone()[0]

            message_body = input("Please enter the message you want to send " +
                                 email + "\n")

            print("Successfully sent " + email + " with message: \n" +
                  message_body)
            handler.new(self.email, email, message_body, user_input)
            print('')
        else:
            error = input(
                "Invalid entry. To message the poster of a ride, please enter the ride number: "
            )
            self.message_member(error)