Example #1
0
def validate_restaurant_name(restaurant):
    global list_of_category
    global list_numbers
    '''
    Validate the user input
    '''
    #Empty the list_numbers
    del list_numbers[:]

    list_of_category = Validate.validate_view_category(restaurant)
    for i in range(1, len(list_of_category) + 1):
        list_numbers.append(i)

    #Using Zip Functionality for zipping two lists
    print("Index ", "Category")
    for index, category in zip(list_numbers, list_of_category):
        print(index, "   ", category)

    print()
Example #2
0
def view_category():
    try:
        restaurant=input("Enter a category: ")
        print()
        
        '''
        Validate the user input
        '''
        list_of_category=Validate.validate_view_category(restaurant)
        
        '''
        Print the details
        '''
        for index , category in list_of_category:
            print(index ," ", category)
            
        print()   
        
        
        
        choice=input("Please Select The Category. Enter Corresponding Number ")
        
        if(choice=="1"):
            category_id=input("Enter the Category ID")
            '''
            Here we are invoking a dummy function and passing the data to it.
            This dummy function has to be completed by another programmer.
            '''
        elif(choice=="2"):
            category_id=input("Enter the Category ID")
            '''
            Here we are invoking a dummy function and passing the data to it.
            This dummy function has to be completed by another programmer.
            '''
        elif(choice=="3"):
            category_id=input("Enter the Category ID")
            '''
            Here we are invoking a dummy function and passing the data to it.
            This dummy function has to be completed by another programmer.
            '''
        
        elif(choice=="4"):
            category_id=input("Enter the Category ID")
            '''
            Here we are invoking a dummy function and passing the data to it.
            This dummy function has to be completed by another programmer.
            '''
        
        elif(choice=="5"):
            category_id=input("Enter the Category ID")
            '''
            Here we are invoking a dummy function and passing the data to it.
            This dummy function has to be completed by another programmer.
            '''
        
        elif(choice=="6"):
            category_id=input("Enter the Category ID")
            '''
            Here we are invoking a dummy function and passing the data to it.
            This dummy function has to be completed by another programmer.
            '''
            
            
        Checkout.checkout(category_id)
            
        '''
        Handle all the exceptions that can occur
        '''   
    except InvalidCategoryException as e:
        print(e)
    except Exception as e:
        print("Sorry. Some system error occurred")
        print(e)
    print()
Example #3
0
def view_category():
    try:
        global category_item_name
        restaurant=input("Enter a Restaurant Name: ")
        print()
        list_numbers = []
        #list_of_category_str = []
        FoodModule.Food.restaurant_name = restaurant
        
        '''
        Validate the user input
        '''
        
        list_of_category=Validate.validate_view_category(restaurant)
        
        length_categories = len(list_of_category)
        
        for i in range(1,length_categories+1) :
            
            list_numbers.append(i)
        
        #Using Zip Functionality for zipping two lists
        print("Index ","Category")
        for index , category in zip(list_numbers,list_of_category) :
            print(index,"   " ,category)
           
        print()   
        
        choice=input("Please Select The Category with its Corresponding Number ")
        
        if(choice=="1"):
            #Converting to int for easy manipulation
            category_item = int(choice)
            #Storing the name from displayed items for specific category
            category_item_name = list_of_category[category_item-1]
            print("Choice Selected :" , choice , ":" , category_item_name)
            FoodModule.Food.category = category_item_name

            
        elif(choice=="2"):
            #Converting to int for easy manipulation
            category_item = int(choice)
            #Storing the name from displayed items for specific category
            category_item_name = list_of_category[category_item-1]
            print("Choice Selected :" , choice , ":" , category_item_name)
            FoodModule.Food.category = category_item_name
            
        elif(choice=="3"):
            #Converting to int for easy manipulation
            category_item = int(choice)
            #Storing the name from displayed items for specific category
            category_item_name = list_of_category[category_item-1]
            print("Choice Selected :" , choice , ":" , category_item_name)
            FoodModule.Food.category = category_item_name

        
        elif(choice=="4"):
            #Converting to int for easy manipulation
            category_item = int(choice)
            #Storing the name from displayed items for specific category
            category_item_name = list_of_category[category_item-1]
            print("Choice Selected :" , choice , ":" , category_item_name)
            FoodModule.Food.category = category_item_name


        elif(choice=="5"):
            #Converting to int for easy manipulation
            category_item = int(choice)
            #Storing the name from displayed items for specific category
            category_item_name = list_of_category[category_item-1]
            print("Choice Selected :" , choice , ":" , category_item_name)
            FoodModule.Food.category = category_item_name
            
            
        elif(choice=="6"):
            #Converting to int for easy manipulation
            category_item = int(choice)
            #Storing the name from displayed items for specific category
            category_item_name = list_of_category[category_item-1]
            print("Choice Selected :" , choice ,":", category_item_name)
            FoodModule.Food.category = category_item_name
            
        
        print()
        #Calling def view_category_items(category): with parameter
        view_category_items(category_item_name)    
        
        '''
        Handle all the exceptions that can occur
        '''
        
    except InvalidCategoryException as e:
        print(e)
    except Exception as e:
        print("Sorry. Some system error occurred")
        print(e)
    print()