示例#1
0
    def __init__(self):
        super().__init__("OrderState")
        # self.view = get_order_view()
        customer = Customer(objectids.CUSTOMER, 400, 400)
        customer2 = Customer(objectids.CUSTOMER, 700, 400)
        customer3 = Customer(objectids.CUSTOMER, 800, 400)

        self.add_game_object(PRETAKEORDERLINE, priority=1)
        self.add_game_object(POSTTAKEORDERLINE, priority=1)
        PRETAKEORDERLINE.add_customer(customer)
        PRETAKEORDERLINE.add_customer(customer2)
        PRETAKEORDERLINE.add_customer(customer3)

        self.add_game_object(TAKEORDERBUTTON)
示例#2
0
 def interact_mouse_up(self, state, mouse_x, mouse_y):
     next_state, obj = super().interact_mouse_down(state, mouse_x, mouse_y)
     if obj is not None:
         if isinstance(obj, JudgeOkButton):
             obj = None
             PRETAKEORDERLINE.add_customer(
                 Customer(objectids.CUSTOMER, 400, 400))
             next_state = ORDERSTATE  # Maybe change ?
             # do stuff
     return next_state, obj
def main():
    i = 0
    while i < 2:
        customer_input = int(input("""1. Create an account
2. Log into account
0. Exit
"""))
        print()

        if customer_input == 0:
            print('Bye!')
            return
        elif customer_input == 1:
            customer = Customer()
            print('Your card number:')
            print(customer.card_number)
            print('Your card PIN:')
            print(customer.card_pin)
            print()
        else:
            input_card_number = int(input("""Enter your card number:
"""))
            input_card_pin = int(input("""Enter your PIN:
"""))
            for k, v in Customer.customer_details.items():
                if v[0] == input_card_number and v[1] == input_card_pin:
                    print('You have successfully logged in!')

                    customer_input = int(input("""1. Balance
2. Log out
0. Exit
"""))
                    print()
                    if customer_input == 0:
                        print("""Bye!""")
                        return
                    elif customer_input == 1:
                        print('Balance: ', v[2])
                        return
                    else:
                        print('You have successfully logged out!')
                        return

                else:
                    print('Wrong card number or PIN!')
                    print()
示例#4
0
def insertcustomer():
    customer = Customer()
    typeSelection = int(
        input(
            'Are you a buyer or a seller? Enter 1 for buyer and 2 for seller >> '
        ))
    if typeSelection == 1:
        customerType = 'buyer'
    elif typeSelection == 2:
        customerType = 'seller'
    else:
        print('Invalid Customer Type Selection')
    customer.setCustomerType(customerType)
    fname = input('What is your first name? >> ')
    customer.setcustomer_firstname(fname)
    lname = input('What is your last name? >> ')
    customer.setcustomer_lastname(lname)
    age = int(input('What is your age? >> '))
    customer.setcustomer_age(age)
    phone = input('What is your phone? >> ')
    customer.setcustomer_phone(phone)
    print()
示例#5
0
文件: bank.py 项目: LeonJ142857/I2P
 def add_customer(self, f, l):
     self.__customers.append(Customer(f, l))
     self.__number_of_customers += 1
     return self.__customers[len(self.__customers) - 1]
示例#6
0
        total = 0.0
        for x in self.item_price:
            total += self.item_price[x]
            print(str(x) + ': ' + str(self.item_price[x]))
        TAX_RATE = total * TAX_RATE
        return ('Tax: {0:.2f}'.format(TAX_RATE))
        return ('Total: {0:.2f}'.format(total + TAX_RATE))

    def display(self):
        return (str(self.customer.customer_id) + "\n" +
                str(self.customer.first_name) + " " +
                str(self.customer.last_name) + "\n" +
                str(self.customer.address) + "\n" + self.customer.phone_number)

    def str(self):
        """returns a string of the Invoice object. same as repr()"""
        return self.customer.first_name + ' ' + self.customer.last_name + ', ' + self.customer.phone_number

    def repr(self):
        """returns a string of the Invoice object. same as str()"""
        return self.customer.first_name + ' ' + self.customer.last_name + ', ' + self.customer.phone_number


# Driver
captain_mal = Customer(1, 'Reynolds', 'Mel', 'No phones',
                       'Firefly, somewhere in the verse')
invoice = Invoice(1, captain_mal)
invoice.add_item({'iPad': 799.99})
invoice.add_item({'Surface': 999.99})
invoice.create_invoice()
def main():
    customer = Customer("A", "T", 36, "1 Main St", "Columbia", "MD", "21046")
    exporter = CustomerExporter("sample.xml",
                                CustomerConverterType.XMLConverterType)
    exporter.export_customer(customer)
示例#8
0
def SignUp():
    print('*' * 6 + 'Welcome user' + '*' * 6)
    # Inputs from User
    print("Choose your account type")
    print("1. Saving")
    print("2. Current")
    accType = selectOption(
        accountType)  #To call for check in accountType dictionary
    fname = validityCheck(0)
    lname = validityCheck(1)
    address = input("Enter your address, Line 1: ")
    address += " " + input("Line 2: ")
    city = validityCheck(inp=2)
    state = validityCheck(inp=3)
    pincode = validatePin()
    c = Customer(accType, fname, lname, address, city, state, pincode)
    c.enterPassword()
    # Registering user to create a customerid
    acctNo = c.registerUser()
    # If account type is saving then a default entry is inserted into transactioncount and transactions table
    if accType == 'Saving':
        rdate = date.today() + timedelta(days=30)
        rdate = rdate.strftime("%d-%m-%Y")
        stmt = "INSERT INTO transactioncount(accountid,renewaldate) values(:1,to_date(:2,'dd-mm-yyyy'))"
        cur.execute(stmt, {'1': acctNo, '2': rdate})
        stamt = "INSERT INTO transactions(accountid) values(:1)"
        cur.execute(stamt, {'1': acctNo})
        con.commit()
    # If account type is saving then forcing user to deposit 5000
    elif accType == 'Current':
        print("You need to deposit min. amount of Rs. 5000")
        amt = enterAmount()
        stmt = "INSERT INTO transactions(accountid,balance) values(:1,:2)"
        with open(
                "C:/Users/TushaR/eclipse-workspace/BankingSystem/src/BankingSystem/transactionid.txt"
        ) as f:
            file_str = f.read()
        file_int = int(file_str)
        file_int += 1

        cur.execute(stmt, {'1': acctNo, '2': amt})
        stamt = "INSERT INTO statementdetails(id,accountid,balance,transtype) values(:1,:2,:3,:4)"
        cur.execute(stamt, {
            '1': file_int,
            '2': acctNo,
            '3': amt,
            '4': 'Credited'
        })
        con.commit()

        with open(
                "C:/Users/TushaR/eclipse-workspace/BankingSystem/src/BankingSystem/transactionid.txt",
                'w') as f:
            f.write(str(file_int))
    if acctNo:
        print(
            "*" * 6 +
            "You are successfully registered with our bank, you must login now..!\n"
        )
    else:
        print("*" * 6 + "Error registering")
示例#9
0
    def get_distance(source: int, dest: int) -> float:
        global distances
        return distances.get_distance(source, dest)

    @staticmethod
    def get_node(index: int) -> Customer:
        global customers
        return customers[index]


populations.Chromosome = Chromosome

if len(sys.argv) < 2:
    print("No argument is set, using R101.txt data file as default")
    filename = 'RC205'
else:
    filename = sys.argv[1]
process_timer_start = datetime.now()
cust_data = read_data(filename)
customers = [Deport(**cust_data[0])]
customers += [Customer(**customer_dict) for customer_dict in cust_data]
distances = DistanceTable(customers)

ga_pop = populations.Population(chromosome_width=len(customers),
                                **populations.population)
best_chrome = ga_pop.evolve()
print("final solution is:", best_chrome.routes_with_timings)
process_time = datetime.now() - process_timer_start
print("Time elapsed:" + str(process_time))
write_output(filename, best_chrome.routes_with_timings)
示例#10
0
        opt = int(input())
        if opt == 1:
            service.list_customers()
        elif opt == 2:
            id = int(input("Enter customer id: "))
            service.get_customer(id)
        elif opt == 3:
            id = int(input("Enter customer id: "))
            service.list_orders(id)
        elif opt == 4:
            id = int(input("Enter customer id: "))
            name = raw_input("Enter customer name: ")
            age = int(input("Enter customer age: "))
            gender = raw_input("Enter customer's gender: ")

            customer = Customer(id, name, age, gender)
            service.create_customer(customer)
        elif opt == 5:
            id = int(input("Enter customer id: "))
            service.list_reviews(id)
        else:
            print("Please select one from the given options.")
    elif inp == 3:
        service = ReviewService(conn)

        print("1. See all reviews")
        print("2. Add review")

        opt = int(input())
        if opt == 1:
            service.list_reviews()
示例#11
0
文件: startApp.py 项目: palbbel/kurs
        win.title("О программе")
        win.minsize(width=450,height=300)
        win.grab_set()
        lab1 = Label(win, text = "Created: Pavel Belyakov", font="Arial 12 bold").place(x = 0, y = 0)

    def make(self, flag):
        if flag == 1:
            name = 'seller'
        elif flag == 2:
            name = 'customer'
        else:
            return
        info = Info(root,name)
        info.tableInfo()



if __name__ == '__main__':

    #loggerFactory = LoggerFactory()
    #logger = loggerFactory.getLoggers("MAIN")

    root = Tk()
    #dial = Dialog(root)
    seller = Seller(root)
    customer = Customer(root)
    basic = BasicWindows(seller,customer)
    basic.basicFrame()
    root.mainloop()

示例#12
0
def data_load(payload):
    customers = Customer(0, payload['first_name'], payload['last_name'],
                         payload['gender'], payload['age'], payload['email'],
                         payload['address_line1'], payload['address_line2'],
                         payload['phonenumber'], True)
    customers.save(redis)
示例#13
0
def create_customers():
    """
    Creates a Customer
    This endpoint will create a Customer based the data in the body that is posted
    ---
    tags:
      - Customers
    consumes:
      - application/json
    produces:
      - application/json
    parameters:
      - in: body
        name: body
        schema:
          id: data
          required:
            - address_line1
            - address_line2
            - age
            - email
            - first_name
            - last_name
            - gender
            - phonenumber
          properties:
            address_line1:
              type: string
              description: address line 1 of the customer
            address_line2:
              type: string
              description: address line 2 of the customer
            age:
              type: integer
              description: age of the customer
            email:
              type: string
              description: email address of the customer
            first_name:
              type: string
              description: first name of the customer
            last_name:
              type: string
              description: last name of the customer
            gender:
              type: string
              description: gender of the customer
            phonenumber:
              type: string
              description: phone number of the customer
    responses:
      201:
        description: Customer information
        schema:
          id: Customer
          properties:
            id:
              type: integer
              description: unique id assigned internally by service
            active:
              type: boolean
              description: the status of customer whether it is currently active (false in this case)
            address_line1:
              type: string
              description: address line 1 of the customer
            address_line2:
              type: string
              description: address line 2 of the customer
            age:
              type: integer
              description: age of the customer
            email:
              type: string
              description: email address of the customer
            first_name:
              type: string
              description: first name of the customer
            last_name:
              type: string
              description: last name of the customer
            gender:
              type: string
              description: gender of the customer
            phonenumber:
              type: string
              description: phone number of the customer
      400:
        description: Bad Request (the posted data was not valid)
    """
    id = 0
    payload = request.get_json()
    if Customer.validate(payload):
        customer = Customer(id, payload['first_name'], payload['last_name'],
                            payload['gender'], payload['age'],
                            payload['email'], payload['address_line1'],
                            payload['address_line2'], payload['phonenumber'],
                            True)
        customer.save(redis)
        id = customer.id
        cust = Customer.find(
            redis, id
        )  # added so that the response body of POST matches that of the GET and we compare the results in the TDD in the same format as the json returned by Redis
        #message = customer.serialize()
        message = cust.serialize()
        rc = HTTP_201_CREATED
    else:
        message = {'error': 'Data is not valid'}
        rc = HTTP_400_BAD_REQUEST

    response = make_response(jsonify(message), rc)
    if rc == HTTP_201_CREATED:
        response.headers['Location'] = url_for('get_customers', id=id)
    return response