Ejemplo n.º 1
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.º 2
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.º 3
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.º 4
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.º 5
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")