Esempio n. 1
0
    def initdb(self):
        select = 'SELECT  `商品名称`,`商品编号` FROM item_inf  order by `评价` DESC LIMIT 5'
        my = PyMySQL(select)
        self.list = my.select_data2(self.list)
        #print(self.list)

        select2 = 'SELECT  `店铺名称`,`店铺编号` FROM shop_info   LIMIT 5'
        my2 = PyMySQL(select2)
        self.list2 = my2.select_data2(self.list2)
Esempio n. 2
0
    def OnClick(self, event):
        # create_table = 'create table stu(id int not null primary key auto_increment,name varchar(255) not null,age int, sex varchar(255))default charset=utf8'
        select = 'select * from user_inf where 用户账号=\'' + self.GetUsername(
        ) + '\''
        # update = 'update stu set name="明明" where id=2'
        # delete = 'delete from stu where id=9'
        # insert = 'insert into stu(name,age,sex) values("%s","%d","%s")' % ('小明', 2, "男")
        # #print(select)

        my = PyMySQL(select)
        #my.create_table_func()
        #my.insert_date()
        #my.update_data()
        #my.delete_data()
        str = [
            '',
        ]
        str = my.select_data2(str)
        self.m_staticText4.SetLabel("")
        self.m_staticText3.SetLabel("")
        if str == ['']:
            self.m_staticText3.SetLabel(u"未输入或账号不存在")
            self.m_staticText3.SetForegroundColour("red")
        elif str[0][1] == self.GetPassword(
        ) and str[0][2] == self.m_choice1Choices[self.m_choice1.Selection]:
            self.m_staticText3.SetLabel(u"欢迎" + self.GetUsername())
            userone.username = self.GetUsername()
            userone.usertype = self.m_choice1Choices[self.m_choice1.Selection]
            self.Close(True)
            self.Destroy()
        else:
            self.m_staticText3.SetLabel(u"密码错误或者身份错误")
            self.m_staticText3.SetForegroundColour("red")
Esempio n. 3
0
 def initdb(self):
     select = 'select `所属店铺`,item_inf.`价格`,item_inf.`评价`,shop_info.`店铺名称`,shop_info.`地址`,item_inf.`数量`,item_inf.`销量`' \
              'FROM shop_info,item_inf ' \
              'where shop_info.`店铺编号`=item_inf.`所属店铺` AND ' \
              'item_inf.`商品编号`=\''+self.value+'\''
     my = PyMySQL(select)
     self.list = my.select_data2(self.list)
Esempio n. 4
0
 def initdb(self):
     select = 'SELECT * FROM item_inf WHERE `商品名称`=\'' + self.value0 + '\''
     my = PyMySQL(select)
     self.list = my.select_data2(self.list)
     #  print(self.list)
     self.list2[0] = self.list[0][0]
     self.list2[1] = self.list[1][0]
     self.list2[2] = self.list[2][0]
     self.list2[3] = self.list[3][0]
     self.list2[4] = self.list[4][0]
Esempio n. 5
0
 def initdb(self):
     select = 'SELECT item_inf.`商品编号`,shop_info.`店铺编号` FROM shop_info,item_inf ' \
              'WHERE shop_info.`店铺编号`=item_inf.`所属店铺` ' \
              'AND shop_info.`所属用户`=\''+userone.username+'\''
     my = PyMySQL(select)
     self.list = my.select_data2(self.list)
     print(self.list)
     select = 'SELECT shop_info.`店铺编号` FROM shop_info ' \
              'WHERE  shop_info.`所属用户`=\'' + userone.username + '\''
     my = PyMySQL(select)
     self.str = ""
     self.str = my.select_data(self.str)
Esempio n. 6
0
    def connect(self, value):
        select = 'SELECT purchase_inf.`商品编号`,user_inf.`收货地址`,purchase_inf.`评价`,purchase_inf.`时间` ' \
                 'FROM purchase_inf,user_inf ' \
                 'WHERE purchase_inf.`用户账号`=user_inf.`用户账号` and user_inf.`用户账号`=\''+value+'\'' \
                 'GROUP BY purchase_inf.`时间` order by purchase_inf.`时间` desc '
        my = PyMySQL(select)
        self.list = [('', '', '', ''), ('', '', '', ''), ('', '', '', ''),
                     ('', '', '', ''), ('', '', '', ''), ('', '', '', '')]
        self.list = my.select_data2(self.list)

        self.total = 0
        select1 = 'SELECT COUNT(*) FROM purchase_inf WHERE purchase_inf.`用户账号`=\'' + value + '\''
        my1 = PyMySQL(select1)
        self.total = my1.select_data(self.total)

        self.str1 = ""
        select2 = 'SELECT `收货地址` FROM user_inf WHERE user_inf.`用户账号`=\'' + value + '\''
        my2 = PyMySQL(select2)
        self.str1 = my2.select_data(self.str1)

        if len(self.list) >= 1:
            self.m_button11.SetLabel('购买商品编号:' + self.list[0][0] + "购买时间:" +
                                     str(self.list[0][3]))
            if len(self.list) >= 2:
                self.m_button12.SetLabel('购买商品编号:' + self.list[1][0] +
                                         "购买时间:" + str(self.list[1][3]))
                if len(self.list) >= 3:
                    self.m_button13.SetLabel('购买商品编号:' + self.list[2][0] +
                                             "购买时间:" + str(self.list[2][3]))
                    if len(self.list) >= 4:
                        self.m_button14.SetLabel('购买商品编号:' + self.list[3][0] +
                                                 "购买时间:" +
                                                 str(self.list[3][3]))
                        if len(self.list) >= 5:
                            self.m_button15.SetLabel('购买商品编号:' +
                                                     self.list[4][0] +
                                                     "购买时间:" +
                                                     str(self.list[4][3]))
                            if len(self.list) >= 6:
                                self.m_button16.SetLabel('购买商品编号:' +
                                                         self.list[5][0] +
                                                         "购买时间:" +
                                                         str(self.list[5][3]))
        self.m_button1.SetLabel('收货地址:' + self.str1)
        #print(self.list[0][1])
        self.m_button3.SetLabel('购买统计:' + str(self.total))
Esempio n. 7
0
    def OnClick(self, event):
        self.list = [("", "", "", "", "", ""), ("", "", "", "", "", ""),
                     ("", "", "", "", "", ""), ("", "", "", "", "", ""),
                     ("", "", "", "", "", "")]
        if self.GetValue1() != "":
            self.value0 = self.GetValue1()
        if event.GetEventObject() == self.m_button1:
            select = 'SELECT * FROM item_inf WHERE `商品名称`=\'' + self.value0 + '\''
            my = PyMySQL(select)
            self.list = my.select_data2(self.list)
            # print(self.list)
            self.m_button23.SetLabel("编号:" + self.list[0][0] + ",名称:" +
                                     self.list[0][1] + ",所属店铺:" +
                                     self.list[0][2] + ",价格:" +
                                     self.list[0][3] + ",评价:" +
                                     self.list[0][4] + ",销量:" +
                                     self.list[0][5])
            self.list2[0] = self.list[0][0]
            self.list2[1] = self.list[1][0]
            self.list2[2] = self.list[2][0]
            self.list2[3] = self.list[3][0]
            self.list2[4] = self.list[4][0]
            self.m_button24.SetLabel("编号:" + self.list[1][0] + ",名称:" +
                                     self.list[1][1] + ",所属店铺:" +
                                     self.list[1][2] + ",价格:" +
                                     self.list[1][3] + ",评价:" +
                                     self.list[1][4] + ",销量:" +
                                     self.list[1][5])
            self.m_button25.SetLabel("编号:" + self.list[2][0] + ",名称:" +
                                     self.list[2][1] + ",所属店铺:" +
                                     self.list[2][2] + ",价格:" +
                                     self.list[2][3] + ",评价:" +
                                     self.list[2][4] + ",销量:" +
                                     self.list[2][5])
            self.m_button26.SetLabel("编号:" + self.list[3][0] + ",名称:" +
                                     self.list[3][1] + ",所属店铺:" +
                                     self.list[3][2] + ",价格:" +
                                     self.list[3][3] + ",评价:" +
                                     self.list[3][4] + ",销量:" +
                                     self.list[3][5])
            self.m_button27.SetLabel("编号:" + self.list[4][0] + ",名称:" +
                                     self.list[4][1] + ",所属店铺:" +
                                     self.list[4][2] + ",价格:" +
                                     self.list[4][3] + ",评价:" +
                                     self.list[4][4] + ",销量:" +
                                     self.list[4][5])
        elif event.GetEventObject() == self.m_button12:
            select = 'SELECT * FROM item_inf WHERE `商品名称`=\'' + self.value0 + '\'ORDER BY `价格` DESC'
            my = PyMySQL(select)
            self.list = my.select_data2(self.list)
            #print(self.list)
            self.list2[0] = self.list[0][0]
            self.list2[1] = self.list[1][0]
            self.list2[2] = self.list[2][0]
            self.list2[3] = self.list[3][0]
            self.list2[4] = self.list[4][0]
            self.m_button23.SetLabel("编号:" + self.list[0][0] + ",名称:" +
                                     self.list[0][1] + ",所属店铺:" +
                                     self.list[0][2] + ",价格:" +
                                     self.list[0][3] + ",评价:" +
                                     self.list[0][4] + ",销量:" +
                                     self.list[0][5])
            self.m_button24.SetLabel("编号:" + self.list[1][0] + ",名称:" +
                                     self.list[1][1] + ",所属店铺:" +
                                     self.list[1][2] + ",价格:" +
                                     self.list[1][3] + ",评价:" +
                                     self.list[1][4] + ",销量:" +
                                     self.list[1][5])
            self.m_button25.SetLabel("编号:" + self.list[2][0] + ",名称:" +
                                     self.list[2][1] + ",所属店铺:" +
                                     self.list[2][2] + ",价格:" +
                                     self.list[2][3] + ",评价:" +
                                     self.list[2][4] + ",销量:" +
                                     self.list[2][5])
            self.m_button26.SetLabel("编号:" + self.list[3][0] + ",名称:" +
                                     self.list[3][1] + ",所属店铺:" +
                                     self.list[3][2] + ",价格:" +
                                     self.list[3][3] + ",评价:" +
                                     self.list[3][4] + ",销量:" +
                                     self.list[3][5])
            self.m_button27.SetLabel("编号:" + self.list[4][0] + ",名称:" +
                                     self.list[4][1] + ",所属店铺:" +
                                     self.list[4][2] + ",价格:" +
                                     self.list[4][3] + ",评价:" +
                                     self.list[4][4] + ",销量:" +
                                     self.list[4][5])
        elif event.GetEventObject() == self.m_button13:
            select = 'SELECT * FROM item_inf WHERE `商品名称`=\'' + self.value0 + '\'ORDER BY `销量` DESC'
            my = PyMySQL(select)
            self.list = my.select_data2(self.list)
            #  print(self.list)
            self.list2[0] = self.list[0][0]
            self.list2[1] = self.list[1][0]
            self.list2[2] = self.list[2][0]
            self.list2[3] = self.list[3][0]
            self.list2[4] = self.list[4][0]
            self.m_button23.SetLabel("编号:" + self.list[0][0] + ",名称:" +
                                     self.list[0][1] + ",所属店铺:" +
                                     self.list[0][2] + ",价格:" +
                                     self.list[0][3] + ",评价:" +
                                     self.list[0][4] + ",销量:" +
                                     self.list[0][5])
            self.m_button24.SetLabel("编号:" + self.list[1][0] + ",名称:" +
                                     self.list[1][1] + ",所属店铺:" +
                                     self.list[1][2] + ",价格:" +
                                     self.list[1][3] + ",评价:" +
                                     self.list[1][4] + ",销量:" +
                                     self.list[1][5])
            self.m_button25.SetLabel("编号:" + self.list[2][0] + ",名称:" +
                                     self.list[2][1] + ",所属店铺:" +
                                     self.list[2][2] + ",价格:" +
                                     self.list[2][3] + ",评价:" +
                                     self.list[2][4] + ",销量:" +
                                     self.list[2][5])
            self.m_button26.SetLabel("编号:" + self.list[3][0] + ",名称:" +
                                     self.list[3][1] + ",所属店铺:" +
                                     self.list[3][2] + ",价格:" +
                                     self.list[3][3] + ",评价:" +
                                     self.list[3][4] + ",销量:" +
                                     self.list[3][5])
            self.m_button27.SetLabel("编号:" + self.list[4][0] + ",名称:" +
                                     self.list[4][1] + ",所属店铺:" +
                                     self.list[4][2] + ",价格:" +
                                     self.list[4][3] + ",评价:" +
                                     self.list[4][4] + ",销量:" +
                                     self.list[4][5])
        elif event.GetEventObject() == self.m_button14:
            select = 'SELECT * FROM item_inf WHERE `商品名称`=\'' + self.value0 + '\'ORDER BY `评价` DESC'
            my = PyMySQL(select)
            self.list = my.select_data2(self.list)
            # print(self.list)
            self.list2[0] = self.list[0][0]
            self.list2[1] = self.list[1][0]
            self.list2[2] = self.list[2][0]
            self.list2[3] = self.list[3][0]
            self.list2[4] = self.list[4][0]
            self.m_button23.SetLabel("编号:" + self.list[0][0] + ",名称:" +
                                     self.list[0][1] + ",所属店铺:" +
                                     self.list[0][2] + ",价格:" +
                                     self.list[0][3] + ",评价:" +
                                     self.list[0][4] + ",销量:" +
                                     self.list[0][5])
            self.m_button24.SetLabel("编号:" + self.list[1][0] + ",名称:" +
                                     self.list[1][1] + ",所属店铺:" +
                                     self.list[1][2] + ",价格:" +
                                     self.list[1][3] + ",评价:" +
                                     self.list[1][4] + ",销量:" +
                                     self.list[1][5])
            self.m_button25.SetLabel("编号:" + self.list[2][0] + ",名称:" +
                                     self.list[2][1] + ",所属店铺:" +
                                     self.list[2][2] + ",价格:" +
                                     self.list[2][3] + ",评价:" +
                                     self.list[2][4] + ",销量:" +
                                     self.list[2][5])
            self.m_button26.SetLabel("编号:" + self.list[3][0] + ",名称:" +
                                     self.list[3][1] + ",所属店铺:" +
                                     self.list[3][2] + ",价格:" +
                                     self.list[3][3] + ",评价:" +
                                     self.list[3][4] + ",销量:" +
                                     self.list[3][5])
            self.m_button27.SetLabel("编号:" + self.list[4][0] + ",名称:" +
                                     self.list[4][1] + ",所属店铺:" +
                                     self.list[4][2] + ",价格:" +
                                     self.list[4][3] + ",评价:" +
                                     self.list[4][4] + ",销量:" +
                                     self.list[4][5])
        elif event.GetEventObject() == self.m_button15:
            select = 'SELECT * FROM item_inf WHERE `商品名称`=\'' + self.value0 + '\''
            my = PyMySQL(select)
            self.list = my.select_data2(self.list)
            # print(self.list)
            self.list2[0] = self.list[0][0]
            self.list2[1] = self.list[1][0]
            self.list2[2] = self.list[2][0]
            self.list2[3] = self.list[3][0]
            self.list2[4] = self.list[4][0]
            self.m_button23.SetLabel("编号:" + self.list[0][0] + ",名称:" +
                                     self.list[0][1] + ",所属店铺:" +
                                     self.list[0][2] + ",价格:" +
                                     self.list[0][3] + ",评价:" +
                                     self.list[0][4] + ",销量:" +
                                     self.list[0][5])
            self.m_button24.SetLabel("编号:" + self.list[1][0] + ",名称:" +
                                     self.list[1][1] + ",所属店铺:" +
                                     self.list[1][2] + ",价格:" +
                                     self.list[1][3] + ",评价:" +
                                     self.list[1][4] + ",销量:" +
                                     self.list[1][5])
            self.m_button25.SetLabel("编号:" + self.list[2][0] + ",名称:" +
                                     self.list[2][1] + ",所属店铺:" +
                                     self.list[2][2] + ",价格:" +
                                     self.list[2][3] + ",评价:" +
                                     self.list[2][4] + ",销量:" +
                                     self.list[2][5])
            self.m_button26.SetLabel("编号:" + self.list[3][0] + ",名称:" +
                                     self.list[3][1] + ",所属店铺:" +
                                     self.list[3][2] + ",价格:" +
                                     self.list[3][3] + ",评价:" +
                                     self.list[3][4] + ",销量:" +
                                     self.list[3][5])
            self.m_button27.SetLabel("编号:" + self.list[4][0] + ",名称:" +
                                     self.list[4][1] + ",所属店铺:" +
                                     self.list[4][2] + ",价格:" +
                                     self.list[4][3] + ",评价:" +
                                     self.list[4][4] + ",销量:" +
                                     self.list[4][5])

        elif event.GetEventObject() == self.m_button23:
            if self.list2[0] != "":
                item = ITDialog(None, -1, "商品信息", self.list2[0])
                item.ShowModal()
                item.Destroy()

        elif event.GetEventObject() == self.m_button24:
            if self.list2[1] != "":
                item = ITDialog(None, -1, "商品信息", self.list2[1])
                item.ShowModal()
                item.Destroy()
        elif event.GetEventObject() == self.m_button25:
            if self.list2[2] != "":
                item = ITDialog(None, -1, "商品信息", self.list2[2])
                item.ShowModal()
                item.Destroy()
        elif event.GetEventObject() == self.m_button26:
            if self.list2[3] != "":
                item = ITDialog(None, -1, "商品信息", self.list2[3])
                item.ShowModal()
                item.Destroy()
        elif event.GetEventObject() == self.m_button27:
            if self.list2[4] != "":
                item = ITDialog(None, -1, "商品信息", self.list2[4])
                item.ShowModal()
                item.Destroy()
        else:
            print("No Button is clicked")
 def initdb(self):
     select = 'SELECT  `商品编号`,`商品名称` FROM item_inf  WHERE `所属店铺`=\'' + self.value + '\''
     my = PyMySQL(select)
     self.list = my.select_data2(self.list)
Esempio n. 9
0
 def initdb(self):
     select = 'SELECT `商品编号`,`商品名称`,item_inf.数量,`价格`,item_inf.`评价` FROM item_inf WHERE `商品编号`=\''+self.value+'\''
     my = PyMySQL(select)
     self.list = my.select_data2(self.list)
     #print(self.list)