def select_by_name(name):
    sql = "SELECT * FROM manufacturers WHERE name = %s"
    values = [name]
    result = run_sql(sql, values)
    manufacturer = Manufacturer(result[0][1], result[0][2], result[0][3],
                                result[0][4], result[0][0])
    return manufacturer
def update_manufacturer(id):
    name = request.form['name']
    location = request.form['location']
    product_type = request.form['product_type']
    manufacturer = Manufacturer(name, location, product_type, id)
    manufacturer_repository.update(manufacturer)
    return redirect('/manufacturers')
def select(id):
    sql = "SELECT * FROM manufacturers WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)[0]
    manufacturer = Manufacturer(result["name"], result["country"],
                                result["id"])
    return manufacturer
def select(id):
    sql = "SELECT * FROM manufacturers WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)
    manufacturer = Manufacturer(result[0][1], result[0][2], result[0][3],
                                result[0][4], result[0][0])
    return manufacturer
Ejemplo n.º 5
0
def create_manufacturer():
    name = request.form["name"]
    description = request.form["description"]
    category = request.form["category"]
    new_manufacturer = Manufacturer(name, description, category)
    new_manufacturer.activate()
    manufacturer_repository.save(new_manufacturer)
    return redirect("/manufacturers")
Ejemplo n.º 6
0
def update_manufacturer(id):
    name = request.form["name"]
    address = request.form["address"]
    deactivated = request.form["deactivated"]

    manufacturer = Manufacturer(name, address, deactivated, id)
    manufacturer_repository.update(manufacturer)
    return redirect("/manufacturers")
Ejemplo n.º 7
0
def update_manufacturer(id):
    name = request.form['name']
    phone = request.form['phone']
    website = request.form['website']
    email = request.form['email']
    manufacturer = Manufacturer(name, phone, website, email, id)
    manufacturer_repository.update(manufacturer)
    return redirect('/manufacturers')
def select_all():
    manufacturers = []
    sql = "SELECT * FROM manufacturers"
    results = run_sql(sql)

    for row in results:
        manufacturer = Manufacturer(row['name'], row['contact'], row['id'])
        manufacturers.append(manufacturer)
    return manufacturers
def select_all():
    manufacturers = []
    sql = "SELECT * FROM manufacturers"
    results = run_sql(sql)
    for result in results:
        manufacturer = Manufacturer(result["name"], result["country"],
                                    result["id"])
        manufacturers.append(manufacturer)
    return manufacturers
Ejemplo n.º 10
0
 def setUp(self):
     self.manufacturer = Manufacturer(
         "Gorbruz' Gutspillaz",
         "Simple and Brutal. From an Orc's forge to your mate's face!",
         "Melee weapons")
     self.item = Item(
         "+1 Mace of Squishing",
         "A handy 1h weapon, enchanted for that extra *CRUNCH*", "Blunt 1h",
         2, 5, self.manufacturer)
def select(id):
    manufacturer = None
    sql = "SELECT * FROM manufacturers WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)[0]

    if result is not None:
        manufacturer = Manufacturer(result['name'], result['address'],
                                    result['deactivated'], result['id'])
    return manufacturer
Ejemplo n.º 12
0
def select(id):
    manufacturer = None
    sql = "SELECT * FROM manufacturers WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)[0]

    if result is not None:
        manufacturer = Manufacturer(result['name'], result['location'],
                                    result['product_type'], result['id'])
    return manufacturer
Ejemplo n.º 13
0
def select_all():
    manufacturer = []

    sql = "SELECT * FROM manufacturers"
    results = run_sql(sql)
    print(results)
    for row in results:
        manufacturer.append(
            Manufacturer(row[1], row[2], row[3], row[4], row[0]))
    return manufacturer
def select_all():
    manufacturer = []

    sql = "SELECT * FROM manufacturers"
    results = run_sql(sql)

    for row in results:
        new_manufacturer = Manufacturer(row['first_name'], row['last_name'],
                                        row['id'])
        manufacturer.append(new_manufacturer)
    return manufacturer
Ejemplo n.º 15
0
def select(id):
    print(id)
    manufacturer = None
    sql = "SELECT * FROM manufacturers WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)[0]
    print("Manufacturer:", result)
    if result is not None:
        manufacturer = Manufacturer(result[1], result[2], result[3], result[4],
                                    result[0])
    return manufacturer
Ejemplo n.º 16
0
def update_manufacturer(id):
    name = request.form["name"]
    description = request.form["description"]
    category = request.form["category"]
    active = request.form["active"]
    # pdb.set_trace()
    new_manufacturer = Manufacturer(name, description, category, active)
    if request.form["active"] == False:
        new_manufacturer.make_inactive()
    new_manufacturer.id = id
    manufacturer_repository.update(new_manufacturer)
    return redirect("/manufacturers")
Ejemplo n.º 17
0
def select_all():
    manufacturers = []

    sql = "SELECT * FROM manufacturers"
    results = run_sql(sql)
    for result in results:
        manufacturer = Manufacturer(result["name"], result["description"],
                                    result["category"], result["active"],
                                    result["id"])
        manufacturers.append(manufacturer)

    return manufacturers
Ejemplo n.º 18
0
def get_by_category(selected_filter):
    manufacturers = []

    sql = "SELECT * FROM manufacturers WHERE category = %s"
    values = [selected_filter]
    results = run_sql(sql, values)
    for result in results:
        manufacturer = Manufacturer(result["name"], result["description"],
                                    result["category"], result["active"],
                                    result["id"])
        manufacturers.append(manufacturer)

    return manufacturers
 def setUp(self):
     self.product = Product("Iphone SE", "5.5 inches", "Rose Gold", 299,
                            399, 50, "Apple")
     self.manufacturer = Manufacturer("Apple", "USA")
Ejemplo n.º 20
0
 def setUp(self):
     self.manufacturer_1 = Manufacturer(
         "Cadbury's", "PO Box 12, Bournville, Birmingham B30 2LU", True)
     self.product1 = Product("Dairy Milk", "bar of milk chocolate", 5, 0.2,
                             1, "chocolate bars", self.manufacturer_1)
Ejemplo n.º 21
0
 def setUp(self):
     self.manufacturer = Manufacturer(
         "Gorbruz' Gutspillaz",
         "Simple and Brutal. From an Orc's forge to your mate's face!",
         "Melee weapons")
def create_manufacturer():
    name = request.form["name"]
    country = request.form["country"]
    new_manufacturer = Manufacturer(name, country)
    manufacturer_repository.save(new_manufacturer)
    return redirect("/manufacturers")
Ejemplo n.º 23
0
 def setUp(self):
     self.manufactuer = Manufacturer("Chanel", "012345678")
Ejemplo n.º 24
0
 def setUp(self):
     self.manufacturer1 = Manufacturer(
         "Cadbury's", "PO Box 12, Bournville, Birmingham B30 2LU", True)
     self.manufacturer2 = Manufacturer("Rowntree's",
                                       "123, York Avenue, York, Y01 1AB",
                                       False)
def update_manufacturer(id):
    name = request.form["name"]
    country = request.form["country"]
    new_manufacturer = Manufacturer(name, country, id)
    manufacturer_repository.update(new_manufacturer)
    return redirect("/manufacturers")
Ejemplo n.º 26
0
import pdb
from models.item import Item
from models.manufacturer import Manufacturer

import repositories.item_repository as item_repository
import repositories.manufacturer_repository as manufacturer_repository

item_repository.delete_all()
manufacturer_repository.delete_all()

man_1 = Manufacturer("Lonely Mountain's Lost Halls",
                     "Treasures raised from the roots of Lonely Mountain",
                     "Gemstones")
manufacturer_repository.save(man_1)

man_2 = Manufacturer(
    "Iron Hills Forge",
    "The finest Dwarven armours, sealed with Dain Ironfoot's personal mark of approval",
    "Armour")
manufacturer_repository.save(man_2)

man_3 = Manufacturer("Murkwood's Ironbark Armoury",
                     "The finest Elven steel and woodland weaponry", "Weapons")
manufacturer_repository.save(man_3)

man_4 = Manufacturer(
    "Nasty Bitza Kit",
    "Stabbas, choppas, cuttas! Nocked togevva by da Goblins ov Misty Mountain.",
    "Weapons")
manufacturer_repository.save(man_4)
Ejemplo n.º 27
0
def update_manufacturer(id):
    name = request.form['name']
    contact = request.form['contact']
    manufacturer = Manufacturer(name, contact, id)
    manufacturer_repository.update(manufacturer)
    return redirect('/manufacturers')
Ejemplo n.º 28
0
def create_manufacturer():
    name = request.form['name']
    contact = request.form['contact']
    manufacturer = Manufacturer(name, contact)
    manufacturer_repository.save(manufacturer)
    return redirect('/manufacturers')
from models.manufacturer import Manufacturer
from models.product import Product

import repositories.manufacturer_repository as manufacturer_repository
import repositories.product_repository as product_repository

product_repository.delete_all()
manufacturer_repository.delete_all()

manufacturer1 = Manufacturer("Chanel", "012345678")
manufacturer_repository.save(manufacturer1)

manufacturer2 = Manufacturer("Dior", "012345679")
manufacturer_repository.save(manufacturer2)

manufacturer3 = Manufacturer("Prada", "01568799")
manufacturer_repository.save(manufacturer3)

manufacturer4 = Manufacturer("Tom Ford", "0145682229")
manufacturer_repository.save(manufacturer4)

manufacturer5 = Manufacturer("Marc Jacobs", "0145684445")
manufacturer_repository.save(manufacturer5)

manufacturer6 = Manufacturer("Jo Malone", "0132684225")
manufacturer_repository.save(manufacturer6)

manufacturer7 = Manufacturer("Elizabeth Arden", "0152685635")
manufacturer_repository.save(manufacturer7)

product1 = Product("Chance", "Fresh", 20, 60, 70, manufacturer1)
Ejemplo n.º 30
0
 def setup(self):
     self.manufacturer_1 = Manufacturer('Pioneer', '8380 4944',
                                        'www.pioneer.com',
                                        '*****@*****.**')
     self.manufacturer_2 = Manufacturer('Juno', '6680 3344', 'www.juno.com',
                                        '*****@*****.**')