def main():
    print("### Testing Products ###")
    p1 = Product("1238223", "Sword", 1899.99, 10)

    print("Id: {}".format(p1.id))
    print("Name: {}".format(p1.name))
    print("Price: {}".format(p1.price))
    print("Quantity: {}".format(p1.quantity))

    p1.display()

    print()

    p2 = Product("838ab883", "Shield", 989.75, 6)
    print("Id: {}".format(p2.id))
    print("Name: {}".format(p2.name))
    print("Price: {}".format(p2.price))
    print("Quantity: {}".format(p2.quantity))

    p2.display()

    print("\n### Testing Orders ###")
    # Now test Orders
    order1 = Order()
    order1.id = "1138"
    order1.add_product(p1)
    order1.add_product(p2)

    order1.display_receipt()

    print("\n### Testing Customers ###")
    # Now test customers
    c = Customer()
    c.id = "aa32"
    c.name = "Gandalf"
    c.add_order(order1)

    c.display_summary()

    print()
    c.display_receipts()

    # Add another product and order and display again

    p3 = Product("2387127", "The Ring", 1000000, 1)
    p4 = Product("1828191", "Wizard Staff", 199.99, 3)

    order2 = Order()
    order2.id = "1277182"
    order2.add_product(p3)
    order2.add_product(p4)

    c.add_order(order2)

    print()
    c.display_summary()

    print()
    c.display_receipts()
Ejemplo n.º 2
0
order1 = Order(cust1, item1)
order2 = Order(cust1, item2)
order3 = Order(cust2, item4)

print cust1
print cust2

order2.add_item(item5)
order3.add_item(item2)
order3.add_item(item3)

print order3
order3.remove_item(item3)
print order3

print Category.get_all_categories()
print Item.get_all_items()
print categ1
print categ2
item3.change_category(categ1)
print categ1
print categ2
print categ3
categ3.remove(item6)
print categ3
cust2.add_order(item1)
print cust2
print item1
print Order.get_all_orders()
Ejemplo n.º 3
0
product3 = Product("Chhapal")
product4 = Product("light")

seller1.add_product_and_quanity(product1, 20)
seller1.add_product_and_quanity(product2, 12)
seller2.add_product_and_quanity(product2, 10)
seller2.add_product_and_quanity(product3, 43)
seller2.add_product_and_quanity(product4, 3)
seller1.add_product_and_quanity(product4, 5)

flip.add_product_into_category(product1, Product_Categories.ELECTRONICS)
flip.add_product_into_category(product2, Product_Categories.CLOTHING)
flip.add_product_into_category(product3, Product_Categories.FOOTWEAR)
flip.add_product_into_category(product4, Product_Categories.DECORATIONS)

c1 = Customer("Meena")
c1.add_product(product3)
c1.add_product(product2)
c1.add_product(product1)
flip.add_customer(c1)

t1 = datetime(year=2019, month=10, day=19, hour=22, minute=30, second=12)
o1 = Order("Chappal", "Meena", t1)
c1.add_order(o1)

###########################################
products = flip.get_products_by_category(Product_Categories.CLOTHING)
print(products[0].get_title())
sellers = flip.get_sellers()
print(sellers.keys())