-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
107 lines (85 loc) · 2.5 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
from service.ProductService import ProductService
from model.Category import Category
from model.Product import Product
from db_context. QueryContext import QueryContext
from helper.CommonHelper import CommonHelper
from service.CustomerService import CustomerService
from model.Customer import Customer
from model.Sale import Sale
from service.CartService import CartService
from model.Cart import Cart
def add_category():
name = input("Category name: ")
level = input("level: ")
parent_id = input("parent_id: ")
service = ProductService()
category = Category()
category.name = name
category.level = int(level)
category.parent_id = parent_id
service.add_category(category)
print(service.get_categories(0, None))
def add_products():
category_id = input('category id: ')
name = input("name: ")
unit = input('unit: ')
mrp = input('mrp: ')
price = input('price: ')
tag = input('tag: ')
service = ProductService()
product = Product()
product.category_id = category_id
product.name = name
product.unit = unit
product.mrp = mrp
product.price = price
product.tag = tag
service.add_product(product)
def update_products():
return
def get_product():
id = input('id: ')
service = ProductService()
print(service.get_product(id).__dict__)
def add_customer():
name = input('name: ')
email = input('email: ')
password = input('password: ')
service = CustomerService()
customer = Customer()
customer.name = name
customer.email = email
customer.password = password
service.add_customer(customer)
def update_customer():
id = input('id: ')
name = input('name:')
email = input('email: ')
password = input('password: ')
service = CustomerService()
customer = Customer()
customer._id = id
customer.name = name
customer.email = email
customer.password = password
service.update_customer(customer)
def get_all_customers():
service = CustomerService()
print(CommonHelper.objlist_to_dict(service.get_customers()))
def delete_customer():
id = input('Id: ')
service = CustomerService()
customer = Customer()
customer._id = id
service.delete_customer(customer)
def get_customer():
id = input('id: ')
service = CustomerService()
print(service.get_customer(id).__dict__)
# service = CartService()
# cart = Cart()
# sale = Sale()
# sale.customer_id = 'a3ca102a-8190-4d97-a2e8-63fb72264304'
# service.create_cart(sale)
#
get_product()