def updateEmail(self, n_email): if CheckRegistration.validEmail(n_email): cursor = self.connection.cursor() update = ( 'UPDATE USERR SET email="{}" WHERE username="******";'.format( n_email, self.getUsername())) cursor.execute(update) self.connection.commit() else: emailError = UpdateBuyerErrors.EmailErrorWindow(self.getUsername()) emailError.show() self.close()
def updateZip(self, n_zip): if ((len(n_zip) == 5) and n_zip.isdigit()): address_id = self.getAddressID() cursor = self.connection.cursor() update = ('UPDATE ADDRESS SET zip_code={} WHERE id={};'.format( int(n_zip), address_id)) cursor.execute(update) self.connection.commit() else: zipError = UpdateBuyerErrors.ZipCodeErrorWindow(self.getUsername()) zipError.show() self.close()
def updateLastName(self, new_l_name): if new_l_name != "": cursor = self.connection.cursor() update = ( 'UPDATE USERR SET last_name="{}" WHERE username="******";'.format( new_l_name, self.getUsername())) cursor.execute(update) self.connection.commit() else: nameError = UpdateBuyerErrors.NameErrorWindow(self.getUsername()) nameError.show() self.close()
def updateHouseNum(self, n_house_number): if CheckRegistration.validHouseNum(n_house_number): address_id = self.getAddressID() cursor = self.connection.cursor() update = ('UPDATE ADDRESS SET house_number={} WHERE id={};'.format( int(n_house_number), address_id)) cursor.execute(update) self.connection.commit() else: houseError = UpdateBuyerErrors.HouseNumErrorWindow( self.getUsername()) houseError.show() self.close()
def updatePassword(self, n_password, n_conf_password): if CheckRegistration.validPassword(n_password, n_conf_password): cursor = self.connection.cursor() update = ( 'UPDATE USERR SET password="******" WHERE username="******";'.format( n_password, self.getUsername())) cursor.execute(update) self.connection.commit() else: passError = UpdateBuyerErrors.PasswordErrorWindow( self.getUsername()) passError.show() self.close()
def updateUsername(self, n_username): if CheckRegistration.validUsername(n_username): cursor = self.connection.cursor() update = ( 'UPDATE USERR SET username="******" WHERE username="******";'.format( n_username, self.getUsername())) cursor.execute(update) self.connection.commit() self.setUsername(n_username) else: userError = UpdateBuyerErrors.UsernameErrorWindow( self.getUsername()) userError.show() self.close()