Пример #1
0
    def populate(self):
        product = Product(pid=1,
                          brand='Dr. Martens',
                          gender='unisex',
                          type='boots',
                          price=189,
                          image='dr_martens.jpg',
                          in_cart=0,
                          quantity=0)
        self.repository.data.append(product)

        product = Product(pid=2,
                          brand='Christian Louboutin',
                          gender='women\'s',
                          type='high heels',
                          price=699,
                          image='louboutin.png',
                          in_cart=0,
                          quantity=0)
        self.repository.data.append(product)

        product = Product(pid=3,
                          brand='Valentino Garavani',
                          gender='women\'s',
                          type='high heels',
                          price=749,
                          image='valentino.jpg',
                          in_cart=0,
                          quantity=0)
        self.repository.data.append(product)
Пример #2
0
    def add_list_event(self):
        # param : name, yongdo, yang, dec, price, time
        pprice = util.check_input(self.lineCost.text())
        pyang = util.check_input(self.lineAmount.text())
        if (pprice is 0) or (pyang is 0):
            QMessageBox.question(self, "입력오류", "입력형식 오류", QMessageBox.Yes)
            return
        pname = self.comboKind.currentText()
        pyongdo = self.comboBuySell.currentText()
        pdec = self.textDesc.toPlainText()
        # 기존 값 체크가 안 되어 있는 경우

        date = datetime.datetime.now()
        preDate = date.strftime('%y%m%d')

        if self.checkDefault.checkState() == 0:
            pTime = self.editTime.dateTime().toString('hhmm')
        elif self.checkDefault.checkState() == 2:
            pTime = date.strftime('%H%M')
        rTime = preDate + pTime

        p = Product(name=pname,
                    yongdo=pyongdo,
                    yang=pyang,
                    dec=pdec,
                    price=pprice,
                    time=rTime)
        global_list_product.append(p)
        view = self.listProduct
        item = QListWidgetItem(view)
        item.setText('(' + str(pTime)[:2] + ':' + str(pTime)[2:] + ') ' +
                     str(p.name) + '/' + str(p.yongdo))
Пример #3
0
    def find(self, product_name):
        query = "SELECT * FROM Products WHERE name='{}'".format( product_name )
        row = self.execute_query( query )

        if row:
            p = Product(row[0][0], row[0][1], row[0][2], row[0][3])
            return p

        return None
Пример #4
0
    def readAll(self):
        products = []
        query = "SELECT * FROM Products"
        rows = self.execute_query( query )

        for row in rows:
            p = Product(row[0], row[1], row[2], row[3])
            products.append( p )

        return products
Пример #5
0
 def index(self):
     user_model = User()
     category_model = Category()
     product_model = Product()
     users = user_model.get_total_users()
     categories = category_model.get_total_categories()
     products = product_model.get_total_products()
     last_products = product_model.get_last_products()
     return self.render('home_admin.html',
                        report={
                            'users': users[0],
                            'categories': categories[0],
                            'products': products[0]
                        },
                        last_products=last_products)
Пример #6
0
    def index(self):
        #return self.render('home_admin.html', data={'username':'******'})
        user_model = User()
        category_model = Category()
        product_model = Product()

        users = user_model.get_total_users()
        categories = category_model.get_total_categories()
        products =  product_model.get_total_products()
        last_products = product_model.get_last_products()

        return self.render('home_admin.html', report={
            'users': 0 if not users else users[0],
            'categories': 0 if not categories else categories[0],
            'products': 0 if not products else products[0]
        }, last_products=last_products)
Пример #7
0
    def index(self):
        user_model = User()
        category_model = Category()
        product_model = Product()

        users = user_model.get_total_users()
        categories = category_model.get_total_categories()
        products = product_model.get_total_products()
        last_products = product_model.get_last_products()

        return self.render(
            "home_admin.html",
            report={
                "users": 0 if not users else users[0],
                "categories": 0 if not categories else categories[0],
                "products": 0 if not products else products[0]
            },
            last_products=last_products
        )
Пример #8
0
 def __init__(self):
     self.product_model = Product()
Пример #9
0
    finFilePath = "s3a://" + app_conf["s3_conf"]["s3_bucket"] + "/finances-small"
    financeDf = spark.read.parquet(finFilePath)
    financeDf.printSchema()

    accNumPrev4WindowSpec = Window.partitionBy("AccountNumber")\
        .orderBy("Date")\
        .rowsBetween(-4, 0)  # takes the first first 5 rows to window aggregation

    financeDf\
        .withColumn("Date", to_date(from_unixtime(unix_timestamp("Date", "MM/dd/yyyy"))))\
        .withColumn("RollingAvg", avg("Amount").over(accNumPrev4WindowSpec))\
        .show(5, False)

    productList = [
        Product("Thin", "Cell phone", 6000),
        Product("Normal", "Tablet", 1500),
        Product("Mini", "Tablet", 5500),
        Product("Ultra Thin", "Cell phone", 5000),
        Product("Very Thin", "Cell phone", 6000),
        Product("Big", "Tablet", 2500),
        Product("Bendable", "Cell phone", 3000),
        Product("Foldable", "Cell phone", 3000),
        Product("Pro", "Tablet", 4500),
        Product("Pro2", "Tablet", 6500)
    ]

    products = spark.createDataFrame(productList)
    products.printSchema()

    catRevenueWindowSpec = Window.partitionBy("category")\
Пример #10
0
    productTypeSneakers = ProductType(name="Кроссовки",
                                      parent_type=productTypeShoes)
    productTypeBoots = ProductType(name="Ботинки",
                                   parent_type=productTypeShoes)

    productTypeTShirtMen = ProductType(name="Мужская футболка",
                                       parent_type=productTypeTShirt)
    productTypeTShirtWoman = ProductType(name="Женская футболка",
                                         parent_type=productTypeTShirt)

    # Продукты

    Sneakers = Product(size=42,
                       color="Red",
                       price=4500,
                       quantity=10,
                       product_type=productTypeSneakers)
    Sneakers1 = Product(size=44,
                        color="Black",
                        price=4500,
                        quantity=10,
                        product_type=productTypeSneakers)

    Boots = Product(size=40,
                    color="Brown",
                    price=5500,
                    quantity=2,
                    product_type=productTypeBoots)
    Boots1 = Product(size=45,
                     color="Green",