Ejemplo n.º 1
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")
Ejemplo n.º 2
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)
Ejemplo n.º 3
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]
Ejemplo n.º 4
0
 def Onclick(self, event):
     if event.GetEventObject() == self.button1:
         if self._address.GetValue() != "":
             update1 = 'UPDATE user_inf SET `收货地址`=\'' + self._address.GetValue(
             ) + '\' WHERE `用户账号`=\'' + self.value + '\''
             my = PyMySQL(update1)
             my.update_data()
             self.value2 = 1
             self.Close(True)
         else:
             self.m_staticText.SetLabel(u"有信息未填完")
             self.m_staticText.SetForegroundColour("red")
Ejemplo n.º 5
0
 def initdb4(self):
     insert = 'INSERT INTO item_inf VALUES (\''+self.m_textCtrl3.GetValue()+'\',\''+self.m_textCtrl6.GetValue()\
              +'\',\''+self.str+'\',\''+self.m_textCtrl5.GetValue()+'\',\'0\',\''+self.m_textCtrl4.GetValue()\
                 +'\',\'0\')'
     my = PyMySQL(insert)
     i = 0
     i = my.insert_date()
     if i == 1:
         self.m_staticText35.SetLabel(u"商品编号已存在!")
         self.m_staticText35.SetForegroundColour("red")
     else:
         self.m_staticText35.SetLabel(u"添加成功!")
         self.m_staticText35.SetForegroundColour("green")
         self.list = [("", ""), ("", ""), ("", ""), ("", ""), ("", ""),
                      ("", ""), ("", ""), ("", "")]
         self.initdb()
Ejemplo n.º 6
0
 def initdb3(self):
     i = 0
     for x in range(0, len(self.list)):
         if self.list[x][0] == self.m_textCtrl3.GetValue():
             update = 'UPDATE item_inf set `数量` =\'' + self.m_textCtrl4.GetValue() + '\',`价格`=\'' \
                      + self.m_textCtrl5.GetValue() + '\' WHERE `商品编号`=\'' + self.m_textCtrl3.GetValue() + '\''
             my = PyMySQL(update)
             my.update_data()
             self.m_staticText35.SetLabel(u"修改成功!")
             self.m_staticText35.SetForegroundColour("green")
             self.list = [("", ""), ("", ""), ("", ""), ("", ""), ("", ""),
                          ("", ""), ("", ""), ("", "")]
             self.initdb()
             i = 1
             break
     if i == 0:
         self.m_staticText35.SetLabel(u"没有该商品!")
         self.m_staticText35.SetForegroundColour("red")
Ejemplo n.º 7
0
 def initdb2(self):
     i = 0
     for x in range(0, len(self.list)):
         if self.list[x][0] == self.m_textCtrl3.GetValue():
             delete = 'DELETE FROM item_inf WHERE 商品编号 =\'' + self.m_textCtrl3.GetValue(
             ) + '\''
             my = PyMySQL(delete)
             my.delete_data()
             self.m_staticText35.SetLabel(u"删除成功!")
             self.m_staticText35.SetForegroundColour("green")
             self.list = [("", ""), ("", ""), ("", ""), ("", ""), ("", ""),
                          ("", ""), ("", ""), ("", "")]
             self.initdb()
             i = 1
             break
     if i == 0:
         self.m_staticText35.SetLabel(u"没有该商品!")
         self.m_staticText35.SetForegroundColour("red")
Ejemplo n.º 8
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))
Ejemplo n.º 9
0
    def initdb1(self):
        insert = 'insert into purchase_inf ' \
                 'values(SYSDATE(),\''+userone.username+'\',\''+self.value+'\',\''+str(self.m_spinCtrl1.GetValue())+'\',\'0\')'
        my = PyMySQL(insert)
        my.insert_date()
        self.value1 = int(self.list[0][5]) - self.m_spinCtrl1.GetValue()
        self.value2 = int(self.list[0][6]) + self.m_spinCtrl1.GetValue()
        update = 'UPDATE item_inf SET `数量`=\''+str(self.value1)+'\', `销量`=\''+str(self.value2)+'\' WHERE `商品编号`=\''\
                 +self.value+'\''
        #

        #print(update)
        my1 = PyMySQL(update)
        my1.update_data()
Ejemplo n.º 10
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)
Ejemplo n.º 11
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)
Ejemplo n.º 12
0
    def OnClick2(self, event):
        self.m_staticText3.SetLabel("")
        self.m_staticText4.SetLabel("")
        if self.GetUsername() != "" and self.GetPassword() != "":
            test_i = 0
            if self.m_choice1Choices[self.m_choice1.Selection] == "一般用户":
                insert = 'INSERT INTO user_inf VALUES(\'' + self.GetUsername(
                ) + '\',\'' + self.GetPassword(
                ) + '\',\'' + self.m_choice1Choices[
                    self.m_choice1.Selection] + '\',\'\')'
                my = PyMySQL(insert)
                test_i = my.insert_date()
                if test_i == 0:
                    test_2 = 0
                    while test_2 == 0:
                        dlg = InfoDialog(None, -1, self.GetUsername(), test_2)
                        dlg.ShowModal()
                        test_2 = dlg.set()
                        dlg.Destroy()
                    self.m_staticText4.SetLabel(u"注册成功" + self.GetUsername())
                    self.m_staticText4.SetForegroundColour("red")
                else:
                    self.m_staticText4.SetLabel("用户已存在!")
                    self.m_staticText4.SetForegroundColour("red")
                pass
            else:
                insert = 'INSERT INTO user_inf VALUES(\'' + self.GetUsername() + '\',\'' + self.GetPassword() + '\',\'' + \
                         self.m_choice1Choices[self.m_choice1.Selection] + '\',\'\')'
                my = PyMySQL(insert)
                test_i = my.insert_date()
                if test_i == 0:
                    test_2 = 0
                    while test_2 == 0:
                        dlg = InfoDialog1(None, -1, self.GetUsername(), test_2)
                        dlg.ShowModal()
                        test_2 = dlg.set()
                        dlg.Destroy()
                    self.m_staticText4.SetLabel(u"注册成功" + self.GetUsername())
                    self.m_staticText4.SetForegroundColour("red")
                else:
                    self.m_staticText4.SetLabel("用户已存在!")
                    self.m_staticText4.SetForegroundColour("red")
                pass

        else:
            self.m_staticText4.SetLabel(u"输入有误" + self.GetUsername())
            self.m_staticText4.SetForegroundColour("red")
Ejemplo n.º 13
0
    def Onclick(self, event):
        test_2 = 0
        if self._address.GetValue()!="" and self._shopid.GetValue()!="" and self._shopname.GetValue()!=""and\
                self._shopaddress.GetValue()!="":
            update1 = 'UPDATE user_inf SET `收货地址`=\'' + self._address.GetValue(
            ) + '\' WHERE `用户账号`=\'' + self.value + '\''
            my = PyMySQL(update1)
            my.update_data()
            insert = 'INSERT INTO shop_info  VALUES(\'' + self._shopid.GetValue() \
                     + '\',\'' + self._shopname.GetValue() + '\',\'' + self.value + '\',\'' \
                     + self._shopaddress.GetValue() + '\')'

            my = PyMySQL(insert)
            test_2 = my.insert_date()
            if test_2 == 1:
                self.m_staticText.SetLabel(u"商铺编号已存在!")
                self.m_staticText.SetForegroundColour("red")
            else:
                self.value1 = 1
                self.Close(True)
        else:
            self.m_staticText.SetLabel(u"有信息未填完")
            self.m_staticText.SetForegroundColour("red")
Ejemplo n.º 14
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")
Ejemplo n.º 15
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)
Ejemplo n.º 16
0
    def Onclick(self, event):
        self.value = str(self.GetValue())

        update1 = 'UPDATE purchase_inf SET `评价`=\'' + self.value + '\' WHERE `商品编号`=\'' + self.value1 + '\''
        my = PyMySQL(update1)
        my.update_data()
        str_1 = []
        select = 'SELECT `评价` FROM item_inf WHERE `商品编号`=\'' + self.value1 + '\''
        my2 = PyMySQL(select)
        str_1 = my2.select_data(str_1)
        if str_1 == "0":
            update2='' \
                    'UPDATE item_inf SET `评价`=\''+self.value+'\' WHERE `商品编号`=\''+ self.value1 +'\''
        else:
            update2 ='UPDATE item_inf SET `评价`=CAST(((CAST(`评价` AS FLOAT)+' + self.value + ')/2.0)AS CHAR)' \
                                                                                        'WHERE `商品编号`=\'' + \
                  self.value1+ '\''
        #print(update2)
        my = PyMySQL(update2)
        my.update_data()
        self.Close(True)
Ejemplo n.º 17
0
 def initdb(self):
     select = 'SELECT  `商品编号`,`商品名称` FROM item_inf  WHERE `所属店铺`=\'' + self.value + '\''
     my = PyMySQL(select)
     self.list = my.select_data2(self.list)