def get_all_info_customer(id):
    sql = "select * from customers where customer_id = :id"
    cur.execute(sql, {"id": id})
    res = cur.fetchall()
    if len(res) == 0:
        return None
    customer = Customer()
    status = res[0][3]
    att = res[0][4]
    customer.set_customer_id(id)
    return customer
Beispiel #2
0
def load_problem(path):
    global depots, customers
    depots = []
    customers = []

    with open(path) as f:
        max_vehicles, num_customers, num_depots = tuple(
            map(lambda z: int(z),
                f.readline().strip().split()))

        for i in range(num_depots):
            max_duration, max_load = tuple(
                map(lambda z: int(z),
                    f.readline().strip().split()))
            depots.append(Depot(max_vehicles, max_duration, max_load))

        for i in range(num_customers):
            vals = tuple(map(lambda z: int(z), f.readline().strip().split()))
            cid, x, y, service_duration, demand = (vals[j] for j in range(5))
            customers.append(Customer(cid, x, y, service_duration, demand))

        for i in range(num_depots):
            vals = tuple(map(lambda z: int(z), f.readline().strip().split()))
            cid, x, y = (vals[j] for j in range(3))
            depots[i].pos = (x, y)
def sign_up():

    customer = Customer()
    first_name = input("Enter First Name\n")
    last_name = input("Enter Last Name\n")
    address = input("Enter Address\n")
    password = input("Enter password (min 8 char and max 20 char)\n")
    while len(password) < 8 or len(password) > 20:
        print("Please Enter password in given range\n")
        password = input()

    customer.set_first_name(first_name)
    customer.set_last_name(last_name)
    customer.set_password(password)
    customer.set_address(address)
    database.sign_up_customer(customer)
Beispiel #4
0
def modCustomer():
    error = False
    id = request.json['id']
    dni = request.json['dni']
    name = request.json['name']
    surname = request.json['surname']
    genre = request.json['genre']
    c_size = request.json['c_size']
    shoe_size = request.json['shoe_size']
    phone_no = request.json['phone_no']
    new = Customer(dni, name, surname, genre, c_size, shoe_size, phone_no,
                   None, id)
    try:
        new.mod()
    except (Exception) as err:
        error = True
        return handleError(err)
    finally:
        if not (error):
            return jsonify({'result': 'success'})
Beispiel #5
0
def addCustomer():
    error = False
    dni = request.json['dni']
    name = request.json['name']
    surname = request.json['surname']
    genre = request.json['genre']
    c_size = request.json['c_size']
    shoe_size = request.json['shoe_size']
    phone_no = request.json['phone_no']
    id_user = request.json['id_user']
    new = Customer(dni, name, surname, genre, c_size, shoe_size, phone_no,
                   id_user)
    user = User()
    user.id = id_user
    try:
        new.add()
        info = user.getCustomer()
    except (Exception) as err:
        error = True
        return handleError(err)
    finally:
        if not (error):
            return jsonify({'result': 'success', 'id': info[0]['id']})
Beispiel #6
0
def to_checkout(start_coord, vv):
    customer = Customer(start_coord, vv)
    if customer.x == 770:  # fruit
        move_to(customer, 450, customer.x)
        move_to(customer, customer.y, 500)
        move_to(customer, 600, customer.x)
    elif customer.x == 550:  # spices
        move_to(customer, 450, customer.x)
        move_to(customer, customer.y, 355)
        move_to(customer, 600, customer.x)
    elif customer.x == 315:  #dairy
        move_to(customer, 450, customer.x)
        move_to(customer, customer.y, 218)
        move_to(customer, 600, customer.x)
    else:  # drinks
        move_to(customer, 600, customer.x)
Beispiel #7
0
def getCustomer():
    error = False
    id = request.json['id']
    new = Customer()
    new.id = id
    try:
        new.get()
    except (Exception) as err:
        error = True
        return handleError(err)
    finally:
        if not (error):
            result = new.json()
            return jsonify({'result': 'success', 'data': result})
def guestOperations(guest):
    choice = 10
    while choice != '3':
        clear()
        print("---------WELCOME GUEST----------")
        print("---------GUEST PANEL----------")
        print(Operations.Guest)
        printdash()
        print("Make a choice: "),
        choice = raw_input()
        try:
            if choice == '1':
                clear()
                print("------REGISTER-------")
                print("Enter userId")
                id = raw_input()
                print("Enter your Name")
                name = raw_input()
                print("Enter your Address")
                add = raw_input()
                print("Enter your phoneno")
                phNo = raw_input()
                if not (id and name and add and phNo):
                    print("please enter all information")
                    printdash()
                    print("Press Enter to go back")
                    raw_input()
                    continue
                asCustomer = Customer(id, name, add, phNo)
                if (guest.getRegistered(asCustomer)):
                    raw_input()
                    #succesfully register now login
                    break
                printdash()
                print("Press Enter to go back")
                raw_input()
            if choice == '2':
                viewProducts(guest)
                print("Press Enter to go back")
                raw_input()
        except Exception as e:
            print(e)
Beispiel #9
0
def getUserInfo():
    error = False
    result = {}
    id = request.json['id']
    user = User()
    user.id = id
    try:
        user.get()
        result['user'] = user.json()
        cust = Customer()
        cust.id_user = id
        cust.getUser()
        if (cust.id != None):
            result['customer'] = cust.json()
    except (Exception) as err:
        error = True
        return handleError(err)
    finally:
        if not (error):
            return jsonify({'result': 'success', 'data': result})
Beispiel #10
0
# import class declared in another file
# import classes from python package
from types import SimpleNamespace

# import class declared in another file in another directory
from cart.ShoppingCart import ShoppingCart
from classes import Customer

customer = Customer("Rodel", "Gladsaxe, Denmark", 12345678)
print("Welcome " + customer.name + " from " + customer.address)

shoppingCart = ShoppingCart("SESSION-12345678")
print("Your cart number is " + shoppingCart.session_id)

discount = SimpleNamespace(discount_code="PROMO-1234", discount_percent=25.50)
print("Your discount is {0} percent".format(discount.discount_percent))
Beispiel #11
0
def sign_up():
    print("\n\t-- SIGN UP --\n")
    customer = Customer()
    first_name = input("First Name: ")
    last_name = input("Last Name: ")
    add_line1 = input("Address Line 1: ")
    add_line2 = input("Address Line 2(optional): ")
    if not add_line2:
        add_line2 = ' '
    city = input("City: ")
    state = input("State: ")
    try:
        pincode = int(input("Pincode: "))
        while pincode < 100000 or pincode > 999999:
            print("ERROR: Invalid Pincode")
            pincode = int(input("Pincode: "))

    except:
        print("ERROR: Pincode only contains Numbers")
        pincode = int(input("Pincode: "))

    password = input("Choose a password (min 8 char and max 20 char): ")
    while len(password) < 8 or len(password) > 20:
        print("ERROR: Password should be in the given range\n")
        password = input()

    customer.set_first_name(first_name)
    customer.set_last_name(last_name)
    customer.set_password(password)
    customer.set_status("open")
    customer.set_login_attempts(3)

    addr = Address()
    addr.set_line_1(add_line1)
    addr.set_line_2(add_line2)
    addr.set_city(city)
    addr.set_state(state)
    addr.set_pincode(pincode)

    customer.set_address(addr)
    database.sign_up_customer(customer)
    print("\nNOTE: Keep this ID and Dont share it with anyone!")
    input("Press any key to continue ...")
    system('CLS')
    print("\n##### Welcome To ONLINE BANKING TERMINAL #####\n")
Beispiel #12
0
def fruit_drinks(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # f to fu
    move_to(customer, customer.y, 85)  # du to ru
    move_to(customer, 250, customer.x)  # ru to r
Beispiel #13
0
def spices_fruit(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # s to su
    move_to(customer, customer.y, 770)  # su to fu
    move_to(customer, 250, customer.x)  # fu to f
Beispiel #14
0
def fruit_spices(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # f to fu
    move_to(customer, customer.y, 550)  # fu to su
    move_to(customer, 250, customer.x)  #  su to s
Beispiel #15
0
def fruit_dairy(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # f to fu
    move_to(customer, customer.y, 315)  # su to du
    move_to(customer, 250, customer.x)  # du to d
Beispiel #16
0
def spices_drinks(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # s to su
    move_to(customer, customer.y, 85)  # du to ru
    move_to(customer, 250, customer.x)  # ru to r
Beispiel #17
0
def entrance_drinks(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # e to fu
    move_to(customer, customer.y, 85)  # fu to ru
    move_to(customer, 250, customer.x)  # ru to r
Beispiel #18
0
def entrance_fruit(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 250, customer.x)  # e to fu
Beispiel #19
0
def dairy_fruit(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # d to du
    move_to(customer, customer.y, 770)  # su to fu
    move_to(customer, 250, customer.x)  # fu to f
Beispiel #20
0
def dairy_spices(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # d to du
    move_to(customer, customer.x, 550)  # du to su
    move_to(customer, 250, customer.x)  #  su to s
Beispiel #21
0
def drinks_dairy(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # r to ru
    move_to(customer, customer.y, 315)  # ru to du
    move_to(customer, 250, customer.x)  # du to d
Beispiel #22
0
def drinks_spices(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # r to ru
    move_to(customer, customer.y, 550)  # ru to su
    move_to(customer, 250, customer.x)  # su to s
Beispiel #23
0
def drinks_fruit(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # r to ru
    move_to(customer, customer.y, 770)  # ru to fu
    move_to(customer, 250, customer.x)  # fu to
Beispiel #24
0
def dairy_drinks(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # d to du
    move_to(customer, customer.y, 85)  # du to ru
    move_to(customer, 250, customer.x)  # ru to
Beispiel #25
0
def addCustomer(session):
    person = addPerson(session)
    customer = Customer(person=person)
    session.add(customer)
    session.commit()
Beispiel #26
0
def spices_dairy(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # s to su
    move_to(customer, customer.y, 315)  # su to du
    move_to(customer, 250, customer.x)  # du to d
Beispiel #27
0
def entrance_spices(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # e to fu
    move_to(customer, customer.y, 550)  # fu to su
    move_to(customer, 250, customer.x)  #  su to s
Beispiel #28
0
def sign_up():

    customer = Customer()
    first_name = input("Enter First Name\n")
    if len(first_name) == 0:
        print("Field can't be blank")
        return
    last_name = input("Enter Last Name\n")
    if len(last_name) == 0:
        print("Field can't be blank")
        return
    add_line1 = input("Enter Address Line 1\n")
    if len(add_line1) == 0:
        print("Field can't be blank")
        return
    add_line2 = input("Enter Address Line 2\n")
    if len(add_line2) == 0:
        print("Field can't be blank")
        return
    city = input("Enter City\n")
    if len(city) == 0:
        print("Field can't be blank")
        return
    state = input("Enter State\n")
    if len(state) == 0:
        print("Field can't be blank")
        return
    try:
        pincode = int(input("Enter Pincode\n"))
        if pincode < 100000 or pincode > 999999:
            print("Invalid Pincode")
            return
    except:
        print("Invalid Pincode")
        return

    password = input("Enter password (min 8 char and max 20 char)\n")
    while len(password) < 8 or len(password) > 20:
        print("Please Enter password in given range\n")
        password = input()

    customer.set_first_name(first_name)
    customer.set_last_name(last_name)
    customer.set_password(password)
    customer.set_status("open")
    customer.set_login_attempts(3)

    addr = Address()
    addr.set_line_1(add_line1)
    addr.set_line_2(add_line2)
    addr.set_city(city)
    addr.set_state(state)
    addr.set_pincode(pincode)

    customer.set_address(addr)
    try:
        database.sign_up_customer(customer)
    except cx_Oracle.DatabaseError as e:
        print("Sorry something went Wrong")
        print(e)
        con.rollback()
        return
def sign_up():

    customer = Customer()
    first_name = input("Enter First Name\n")
    last_name = input("Enter Last Name\n")
    add_line1 = input("Enter Address Line 1\n")
    add_line2 = input("Enter Address Line 2\n")
    city = input("Enter City\n")
    state = input("Enter State\n")
    try:
        pincode = int(input("Enter Pincode\n"))
        if pincode < 100000 or pincode > 999999:
            print("Invalid Pincode")
            return
    except:
        print("Invalid Pincode")
        return

    password = input("Enter password (min 8 char and max 20 char)\n")
    while len(password) < 8 or len(password) > 20:
        print("Please Enter password in given range\n")
        password = input();

    customer.set_first_name(first_name)
    customer.set_last_name(last_name)
    customer.set_password(password)
    customer.set_status("open")
    customer.set_login_attempts(3)

    addr = Address()
    addr.set_line_1(add_line1)
    addr.set_line_2(add_line2)
    addr.set_city(city)
    addr.set_state(state)
    addr.set_pincode(pincode)

    customer.set_address(addr)

    database.sign_up_customer(customer)
Beispiel #30
0
def entrance_dairy(start_coord, vv):
    customer = Customer(start_coord, vv)
    move_to(customer, 60, customer.x)  # e to fu
    move_to(customer, customer.y, 315)  # su to du
    move_to(customer, 250, customer.x)  # du to d