Exemple #1
0
def srch_art_one_artist(self):
    name = input('What is the name of the artist? ')
    name = validate_name(name)
    isFound = search_artist(self, name)

    # Verifying that the artist exists in the database
    if isFound.exists() == None:
        print(f"{name} isn't in the system yet, maybe try again.")
        return
    data = self.view_model.search_art_one(name)
    display(data)
Exemple #2
0
def add_new_artist(self, name=''):
    # Input Validation

    isFound = ''
    if name == '':
        name = input('What is the name of the artist? ')
        name = validate_name(name)
        isFound = search_artist(self, name, first=True)

    if isFound == None:
        email = input(f"What is {name}'s email? ")
        email = validate_Email(email)
        self.view_model.insert(name, email)
        data = self.view_model.search_artist(name)
        display(data, first=True)
    else:
        print(f"{name} is already in the system.\n")
Exemple #3
0
def update_available(self):
    name = input(
        'What is the name of the artwork whos availability has changed? ')
    data = self.view_model.search_art_name(name)

    if data.exists() == False:
        print('Sorry that artwork does not exist')
        return
    for dat in data:
        available = dat.available

    rows_updated = self.view_model.update(name, available)

    if rows_updated == 0:
        print('There was an error. Your request was not updated')
        return

    data = self.view_model.search_art_name(name)
    display(data)
Exemple #4
0
def delete_art(self):
    name = input('What is the name of the artwork you would like to delete? ')
    name = validate_name(name)
    isFound = self.view_model.search_art_name(name)
    # Verifying that the art exists in the database
    if isFound.exists() == None:
        print(f"{name} isn't in the system yet, maybe try again.")
        return
    display(isFound)
    confirm = input('Are you sure you want to delete this art? (Yes er no?) ')
    while True:
        if confirm.upper() == 'YES':
            rows_updated = self.view_model.delete(name)
            if rows_updated == 0:
                print('There was an error. Your request was not deleted\n')
            else:
                print('Your entry was deleted.\n')
            break
        elif confirm.upper() == 'NO':
            print('Fair enough')
            break
        else:
            confirm = input("That's not an actual choice. Try again.")
Exemple #5
0
def add_new_art(self):
    artist = input('What is the name of the artist? ')
    name = validate_name(artist)
    isFound = search_artist(self, artist, first=True)

    # Verifying that the artist exists in the database before adding art to their name
    if isFound == None:
        print(f"{artist} isn't in the system yet please add them first.")
        add_new_artist(self)

    name = input('What is the name of the piece? ')
    data = self.view_model.search_art_name(name)
    if data.exists() != False:
        print(
            f"There is already a piece with the name of {name} in the system")
        return
    price = input('What is the price of the piece? ')
    available = input('Is this piece sold? ')

    name, price, available = validate_Art(name, price, available)

    self.view_model.insert_art(name, artist, price, available)
    data = self.view_model.search_art_name(name)
    display(data)
Exemple #6
0
def srch_art_all_artist(self):
    data = self.view_model.search_art_all()
    display(data)