def MenuCustomer(): while True: print("\t\t\t Customer Management\n") print( "=================================================================" ) print("1. Insert Customer Record") print("2. Search Customer Record") print("3. Delete Customer Record") print("4. Update Customer Record") print("5. Show All Customer Records") print("6. Return to Main Menu") print( "=================================================================" ) options = int(input("Enter between 1 to 5 -------> : ")) if options == 1: Customer.insertCustomer() elif options == 2: Customer.searchCustomer() elif options == 3: Customer.deleteCustomer() elif options == 4: Customer.updateCustomer() elif options == 5: Customer.showCustomerTable() elif options == 6: print('\n' * 5) return else: print("Wrong Choice.....Enter your options again") x = input("Enter any key to continue")
def purchases_for_month(request, pk): print(pk) month = int(request.GET.get('month')) res = Customer(apikey).getAllAccounts() id = res[0]['_id'] cust_id = res[0]['customer_id'] print("id", id, cust_id) res = Customer(apikey).getAllCustPurchases(id) print("purchases", res) print("res 0", res[0]) #res.get('merchant_id') data = {} transList = [] for item in res: transaction = {} print("item", item['merchant_id'], item['purchase_date']) mer = Customer(apikey).getMerchantDetByID(item['merchant_id']) print("mer: ", mer) print("mer details:", mer['category'], mer['name']) # print(res['purchase_date'], res['amount']) transaction['category'] = mer['category'] transaction['name'] = mer['name'] transaction['purchase_date'] = item['purchase_date'] transaction['amount'] = item['amount'] # send 'customer id, puchase date, amount , category, name' transList.append(transaction) data['monthly_transaction'] = transList logger.info('dsfdsffd') logger.info(json.dumps(data)) return HttpResponse(json.dumps(data))
def table(self): run = Customer(self.user) result = run.GetHistory() for row_number, row_data in enumerate(result): self.tableWidget.insertRow(row_number) for colum_number, data in enumerate(row_data): self.tableWidget.setItem(row_number, colum_number, QtWidgets.QTableWidgetItem(str(data)))
def has_raw_material(customer: Customer, raw_material_cost: float)->bool: """ check whether the shop has enough raw material for the customer's ice-cream order We assume that 1 small ice-cream unit costs $1 of raw material, 1 medium ice-cream costs $1.5 of raw material, and 1 large ice-cream costs $2 of raw material. :param customer: Customer :param raw_material_cost: the remaining raw material the shop has currently :return: bool """ return customer.s_icecream_num() + customer.m_icecream_num()*1.5 + customer.l_icecream_num()*2 <= raw_material_cost
def test_putAll(self): name1 = "abc" id1 = 93 c1 = Customer(name1, id1) name = "abc" id = 94 c2 = Customer(name, id) item = {93: c1, 94: c2} self.assertEqual(self.myRegion.put_all(item), True) self.assertEqual(self.myRegion.delete(93, 94), True)
def test_compare_And_Set(self): name1 = "abc" id1 = 94 c1 = Customer(name1, id1) name = "abc" id = 96 c2 = Customer(name, id) self.assertEqual(self.myRegion.put(94, c1), True) self.assertEqual(self.myRegion.compare_and_set(94, c1, c2), True) self.assertEqual(self.myRegion.delete(94), True)
def test_find(self): name = "abc" id = 02 self.myRepo.save(Customer(name, id)) name1 = "abc" id1 = 03 c1 = Customer(name1, id1) c2 = Customer(name, id) self.myRepo.save([c1, c2]) self.myRepo.find([03, 02])
def test_save_listofobject(self): name = "abc" id = 002 name1 = "abc" id1 = 107 c1 = Customer(name1, id1) c2 = Customer(name, id) c3 = [c1, c2] result = self.myRepo.save(c3) self.assertEqual(result, True) self.myRepo.delete(c3)
def main(): print("Welcome to Wake-Mart. Please register. ") print("\n") name = input("Enter your name: ") cust = Customer(name) cust.inputCardsInfo() print("Registration completed") totalPrc = scanPrices() totalCoup = scanCoupons() netAmt = totalPrc - totalCoup print("Please pay this amount: ", netAmt) print("\n") print("\n") makePayment(cust,netAmt)
def test_update(self): name1 = "abc" id1 = 93 c1 = Customer(name1, id1) name = "abc" id = 94 c2 = Customer(name, id) item = {93: c1, 94: c2} self.assertEqual(self.myRegion.put_all(item), True) name3 = "abc" id3 = 95 c3 = Customer(name3, id3) updt = self.myRegion.update(94, c3) self.assertEqual(updt, True) self.assertEqual(self.myRegion.delete(93, 94), True)
def put(self, num): self.warmup() start = time.clock() for x in range(0, num): self.myRegion.put(x, Customer("John Doe", 42)) end = time.clock() return (end - start)
def __init__(self, N_items, N_recommended, behaviour="random", rewardType='Similarity', rewardParameters=[1, 1], proba_p=0.7, specific_items=None, name='envi_01'): #proba_p for ramdom choice (customer) self.items = Items(N_items) self.recommendation = Recommendation(self.items, N_recommended) self.customer = Customer(self.items, self.recommendation, behaviour, proba_p, specific_items) self.name = name self.rewardType = rewardType self.rewardParameters = rewardParameters
def test_create(self): name1 = "abc" id1 = 13 c1 = Customer(name1, id1) result = self.myRegion.create(13, c1) self.assertEqual(result, True) self.myRegion.delete(13)
def addCustomer(): name = raw_input("Name of customer: ") username = raw_input("\nUsername of customer: ") password = raw_input("\nPassword for customer: ") cust = Customer.Customer(name, username, password) server.addCustomer(cust) return cust
def book_car(self, car, name, age, licence, email, date, period, pickup, dropoff): customer = Customer(name, age, email, licence) loan = Loan(car, customer, date, period, pickup, dropoff) self._loans.append(loan) print(loan)
def _populate(x): """ Populate a list of Customers based on a csv file. """ result = [] try: f = open(x) except FileNotFoundError: print("File could not be found.") quit() count = 0 for row in csv.reader(f): if count == 0: count += 1 continue deliveryDate = row[0].strip() name = row[1].strip() classYear = int(row[2].strip()) if row[2].strip() != "N/A" else None phone = row[3].strip() email = row[4].strip() #list comprehension to remove whitespace of each element in list beverages = [juice.strip() for juice in row[5].split(",")] quantity = [int(amount.strip()) for amount in row[6].split(",")] price = row[7].strip() customer = Customer(name, classYear, phone, email, deliveryDate, beverages, quantity, price) result.append(customer) f.close() return result
def startingprocess(input_data): ids = list() CustomerClass = list() Branchclass = list() branchlist = list() customerList = list() # make a Branch class for each input data for i in input_data: if i["type"] == "branch": bclass = Branch.Branch(i["id"], i["balance"], ids) Branchclass.append(bclass) ids.append(bclass.id) # make a Customer class for each input data for s in input_data: if s["type"] == "customer": cclass = Customer.Customer(s["id"], s["events"]) CustomerClass.append(cclass) # working branch/customer processes in parallel branchlist = multiprocessor.multibranch(Branchclass) customerList = multiprocessor.multicustomer(CustomerClass) for c in customerList: # Waiting to complete customer process c.join() for b in branchlist: # Terminate each of Branch processes b.terminate()
def read_file(self, file_input): # Разделяем данные с файла по , data_file = [ string.replace(' ', '').split(',') for string in file_input ] product = None customers = list() sellers = list() auctions = list() """ Проверем какого типа данные, создаем нужные и заполняем списки, тк у одного аукциона может быть неограниченное число продавцов и товаров """ for data in data_file: for value in data: if value == 'product': product = Product(data[1], data[2], data[3], data[4], data[5]) elif value == 'customer': customers.append(Customer(data[1], data[2], product)) elif value == 'seller': sellers.append(Seller(data[1], data[2], product)) elif value == 'auction': auctions.append( Auction(data[1], data[2], data[3], data[4], customers, sellers)) sellers = list() customers = list() else: continue return auctions
def customer_login(admin_id): f = 0 name = '' file = open('customer', 'rb') while True: try: d = pickle.load(file) if d['id'] == admin_id: f = 1 name = d['name'] llist = [] cart1 = Cart(llist, 0) payment = Payment() c = Customer(admin_id, name, d['address'], d['phone'], cart1, payment) break except EOFError: break file.close() if f == 1: customer_menu(name, c) else: print("Wrong ID") admin_id = input("Give User id or Press A for Menu: ") if admin_id == 'A': main() else: customer_login(admin_id)
def main(): c1 = Customer([ "207633439", "Israel", "Hamsa", "Male", "Final Space", "055-555-1555" ]) p1 = Product("Track", 1, 10000, "Ford") sale1 = Sale(c1.id, p1.id, p1.price, "31/03/2020") print(sale1)
def test_exists(self): name = "abc" id = 10 self.myRepo.save(Customer(name, id)) result = self.myRepo.exists(10) self.assertEqual(result, True) self.myRepo.delete(10)
def test_dirget(self): name1 = "abc" id1 = 15 c1 = Customer(name1, id1) self.assertEqual(self.myRegion.put(15, c1), True) result = self.myRegion[15] #self.assertEqual(result, object) self.assertEqual(self.myRegion.delete(15), True)
def test_keys(self): name1 = "abc" id1 = 78 c1 = Customer(name1, id1) result = self.myRegion.create(78, c1) self.assertEqual(result, True) self.myRegion.keys() self.myRegion.delete(78)
def get_customer_details(self, mobile_number): customer_json = self.db.customer.find_one( {'mobile_number': mobile_number}) if customer_json == None: return None else: return Customer(mobile_number, customer_json['customer_name'], int(customer_json['reward_points']))
def add_customer(self): print("Customer Information") name = input("enter customer name : ") amount = int(input("enter a amount : ")) no_Of_Share = int(input("Enter the Number Of Share : ")) customer_obj = Customer(name, amount, no_Of_Share) customer_obj.set_customer_name(name) customer_obj.set_amount(amount) customer_obj.set_noOfShare(no_Of_Share) save(customer_obj)
def test_adhoc_query(self): name1 = "abc" id1 = 13 c1 = Customer(name1, id1) result = self.myRegion.create(13, c1) self.assertEqual(result, True) newquery = self.client.adhoc_query("SELECT * FROM /orders") result = self.myRegion.delete(13) self.assertEqual(result, True)
def put_all(self, num): self.warmup() item = {} for x in range(0, num): item[x] = Customer("New Person", 1) start = time.clock() self.myRegion.put_all(item) end = time.clock() return (end - start)
def startApp(): print("*****WELCOME*****") print("\n\t1:Customer\n\t2:Driver\n\t3:Exit") ch = int(input("\nEnter your choice:")) if (ch == 1): Customer.displayChoice() input() startApp() elif (ch == 2): Driver.displayChoice() input() startApp() elif (ch == 3): print("Thank you....\n") exit() else: print("Wrong input...!\nPlease Select a valid choice") startApp()
def verify_customer(self, cust_id, cust_pin): file = open(self.filename, 'r') for customer in file: uuid, pin, check_bal, sav_bal = customer.split(" ") check_bal = int(check_bal) sav_bal = int(sav_bal) if uuid == str(cust_id) and pin == str(cust_pin): return Customer(uuid, pin, check_bal, sav_bal) file.close()
def testLargeCar(sys): fee = 150 carC = largeCar(fee, False, "Large", "LargeRego") location = Location("kellyville", "blacktown") customerC = Customer(20, "Robert largeCarbooker", "LicenseNum", "*****@*****.**") sys.addCar(carC) sys.makeBooking(carC, customerC, location, 4, True) booking = sys.getBookings()[-1] assert (booking.getPrice() == 600)
def generate_flow(self,menu): i=0 while (self.env.now < G.maxTime): time_now = self.env.now #generate a semi-random arrivalrate arrival_rate = 10 + 1 * math.sin(math.pi * time_now/12.0) #produce a random number that follows an expotential distribution with parameter arrivalrate*2 t = random.expovariate(arrival_rate*2) #check whether we need to stop while waiting to create another customer #Added a check before every yeild report to make sure the weeklyreport doesn't happen during the yield if (self.env.now + t) %7 < t : yield self.env.timeout(t-(self.env.now + t) %7) yield self.env.process(menu.WeeklyReport()) yield self.env.timeout((self.env.now + t) %7) else : yield self.env.timeout(t) #after a random time, generate a new customer c = Customer(self.env,"Customer%02d" % (i)) #the customer stays for a random long time period time_staying = random.expovariate(1.0/G.staytime) #call the customer "visit()"method that takes in two arguements self.env.process(c.visit_hotel(time_staying,self,self.player,menu)) i += 1
from Customer import * c1 = Customer("Robert FH Groeneveld", "0641129837", "*****@*****.**") c2 = Customer("Rienk van der Ploeg", "088-4818277", "*****@*****.**") ##print (c1, c2) print(c1.check_telephone_number()) print c1.id print c2.id c1.reset_password() print c1.password print c1, c2
from flask import Flask, url_for from flask.ext.cors import CORS import Customer, Admin, Product app = Flask(__name__) app.config['SECRET_KEY'] = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT' app.config['UPLOAD_FOLDER'] = '.' app.config['MAX_CONTENT_LENGTH'] = 18 * 1024 * 1024 CORS(app) @app.route("/") def home(): try: return app.send_static_file("index.html") except Exception as e: return str(e) Admin.add_routes(app) Customer.add_routes(app) Product.add_routes(app) if __name__ == "__main__": app.run(host='0.0.0.0')