def confirmClicked(self):
        self.updateFirstName(self.f_nameEdit.text())
        self.updateLastName(self.l_nameEdit.text())
        self.updateEmail(self.emailEdit.text())
        self.updatePassword(self.passwordEdit.text(),
                            self.conf_passwordEdit.text())
        self.updateUsername(self.usernameEdit.text())

        if self.f_nameEdit.text() != "":
            f_nameValid = True
        else:
            f_nameValid = False

        if self.l_nameEdit.text() != "":
            l_nameValid = True
        else:
            l_nameValid = False

        validEmail = CheckRegistration.validEmail(self.emailEdit.text())
        validPassword = CheckRegistration.validPassword(
            self.passwordEdit.text(), self.conf_passwordEdit.text())
        validUsername = CheckRegistration.validEmail(self.emailEdit.text())

        if f_nameValid and l_nameValid and validEmail and validEmail and validUsername:
            self.updateSuccessful = UpdateSuccessful(self.getUsername())
            self.updateSuccessful.show()

        self.connection.close()
        self.close()
Exemplo n.º 2
0
    def confirmClicked(self):
        self.updateFirstName(self.f_nameEdit.text())
        self.updateLastName(self.l_nameEdit.text())
        self.updatePhone(self.phoneEdit.text())
        self.updatePassword(self.passwordEdit.text(),
                            self.conf_passwordEdit.text())
        self.updateEmail(self.emailEdit.text())
        self.updateStrMng(self.strMngEdit.text())
        self.updateHouseNum(self.strHouseNumEdit.text())
        self.updateStrStreet(self.strStreetEdit.text())
        self.updateUsername(self.usernameEdit.text())

        if self.f_nameEdit.text() != "":
            f_nameValid = True
        else:
            f_nameValid = False

        if self.l_nameEdit.text() != "":
            l_nameValid = True
        else:
            l_nameValid = False

        if ((len(self.phoneEdit.text()) == 10)
                and self.phoneEdit.text().isdigit()):
            phoneValid = True
        else:
            phoneValid = False

        passwordValid = CheckRegistration.validPassword(
            self.passwordEdit.text(), self.conf_passwordEdit.text())

        validEmail = CheckRegistration.validEmail(self.emailEdit.text())

        if self.strMngEdit.text() != "":
            validStore = True
        else:
            validStore = False

        validHouseNum = CheckRegistration.validHouseNum(
            self.strHouseNumEdit.text())

        if self.strStreetEdit.text() != "":
            validStreet = True
        else:
            validStreet = False

        if f_nameValid and l_nameValid and phoneValid and passwordValid and validEmail and validStore and validHouseNum and validStreet:
            self.updateSuccessful = UpdateSuccessful(self.getUsername())
            self.updateSuccessful.show()

        self.connection.close()
        self.close()
Exemplo n.º 3
0
    def registerClicked(self):
        username = self.usernameEdit.text()
        password = self.passwordEdit.text()
        conf_password = self.conf_passwordEdit.text()
        email = self.emailEdit.text()
        conf_code = int(self.conf_codeEdit.text())

        userValid = CheckRegistration.validUser(username, password,
                                                conf_password, email)
        managerValid = CheckRegistration.validManager(conf_code)

        if not userValid:
            self.userError = CheckRegistration.UserErrorWindow()
            self.userError.show()
            self.close()

        elif not managerValid:
            self.managerError = CheckRegistration.ManagerErrorWindow()
            self.managerError.show()
            self.close()

        else:
            cursor = self.connection.cursor()

            user_type = "manager"
            first_name = self.f_nameEdit.text()
            last_name = self.l_nameEdit.text()
            store_address = self.getStoreAddress()

            insertUser = (
                'INSERT INTO USERR VALUES ("{}", "{}", "{}", "{}", "{}", "{}");'
                .format(username, password, user_type, email, first_name,
                        last_name))
            cursor.execute(insertUser)
            self.connection.commit()

            updateManages = (
                'UPDATE MANAGES SET username="******" WHERE store_address={}'.
                format(username, store_address))
            cursor.execute(updateManages)
            self.connection.commit()

        self.connection.close()
Exemplo n.º 4
0
    def registerClicked(self):
        username = self.usernameEdit.text()
        password = self.passwordEdit.text()
        conf_password = self.conf_passwordEdit.text()
        email = self.emailEdit.text()
        conf_code = int(self.conf_codeEdit.text())

        userValid = CheckRegistration.validUser(username, password,
                                                conf_password, email)
        delivererValid = CheckRegistration.validDeliverer(conf_code)

        if not userValid:
            self.userError = CheckRegistration.UserErrorWindow()
            self.userError.show()
            self.close()

        elif not delivererValid:
            self.managerError = CheckRegistration.ManagerErrorWindow()
            self.managerError.show()
            self.close()

        else:
            user_type = "deliverer"
            first_name = self.f_nameEdit.text()
            last_name = self.l_nameEdit.text()

            cursor = self.connection.cursor()

            insertUser = (
                'INSERT INTO USERR VALUES ("{}", "{}", "{}", "{}", "{}", "{}");'
                .format(username, password, user_type, email, first_name,
                        last_name))
            cursor.execute(insertUser)
            self.connection.commit()

            self.deliverFunct = DelivererFunctionality.DelivererFunctWindow(
                username)
            self.deliverFunct.show()
            self.close()

        self.connection.close()
Exemplo n.º 5
0
    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()
Exemplo n.º 6
0
    def confirmClicked(self):
        self.updateFirstName(self.f_nameEdit.text())
        self.updateLastName(self.l_nameEdit.text())
        self.updatePassword(self.passwordEdit.text(),
                            self.conf_passwordEdit.text())
        self.updateHouseNum(self.house_numberEdit.text())
        self.updateStreet(self.streetEdit.text())
        self.updateCity(self.cityEdit.text())
        self.updateState(self.stateEdit.text())
        self.updateZip((self.zipEdit.text()))
        self.updateEmail(self.emailEdit.text())
        self.updateUsername(self.usernameEdit.text())

        if self.f_nameEdit.text() != "":
            f_nameValid = True
        else:
            f_nameValid = False

        if self.l_nameEdit.text() != "":
            l_nameValid = True
        else:
            l_nameValid = False

        validPassword = CheckRegistration.validPassword(
            self.passwordEdit.text(), self.conf_passwordEdit.text())
        validAddress = CheckRegistration.validAddress(
            self.house_numberEdit.text(), self.zipEdit.text())
        validEmail = CheckRegistration.validEmail(self.emailEdit.text())
        validUsername = CheckRegistration.validUsername(
            self.usernameEdit.text())

        if f_nameValid and l_nameValid and validPassword and validAddress and validEmail and validUsername:
            self.updateSuccessful = UpdateSuccessful(self.getUsername())
            self.updateSuccessful.show()

        self.connection.close()
        self.close()
Exemplo n.º 7
0
    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()
Exemplo n.º 8
0
    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()
Exemplo n.º 9
0
    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()
Exemplo n.º 10
0
    def registerClicked(self):
        house_number = self.house_numberEdit.text()
        zip_code = self.zipEdit.text()
        username = self.usernameEdit.text()
        password = self.passwordEdit.text()
        conf_password = self.conf_passwordEdit.text()
        email = self.emailEdit.text()
        phone = self.phoneEdit.text()

        addressValid = CheckRegistration.validAddress(house_number, zip_code)
        userValid = CheckRegistration.validUser(username, password, conf_password, email)
        buyerValid = CheckRegistration.validBuyer(username, phone)

        if not addressValid:
            self.addressError = CheckRegistration.AddressErrorWindow()
            self.addressError.show()
            self.close()

        elif not userValid:
            self.userError = CheckRegistration.UserErrorWindow()
            self.userError.show()
            self.close()

        elif not buyerValid:
            self.buyerError = CheckRegistration.BuyerErrorWindow()
            self.buyerError.show()
            self.close()

        # create new row for address, user, and buyer (in that order)
        else:
            address_id = self.getMaxAddress() + 1
            house_number = int(self.house_numberEdit.text())
            street = self.streetEdit.text()
            city = self.cityEdit.text()
            state = self.stateEdit.text()
            zip_code = int(self.zipEdit.text())

            user_type = "buyer"
            first_name = self.f_nameEdit.text()
            last_name = self.l_nameEdit.text()

            phone = int(self.phoneEdit.text().replace("-", ""))
            default_store_id = self.getDefaultStore()

            cursor1 = self.connection.cursor()
            cursor2 = self.connection.cursor()
            cursor3 = self.connection.cursor()

            insertAddress = ('INSERT INTO ADDRESS VALUES ({}, {}, "{}", "{}", "{}", {});'.format(address_id, house_number, street, city, state, zip_code))
            cursor1.execute(insertAddress)
            self.connection.commit()

            insertUser = ('INSERT INTO USERR VALUES ("{}", "{}", "{}", "{}", "{}", "{}");'.format(username, password, user_type, email, first_name, last_name))
            cursor2.execute(insertUser)
            self.connection.commit()

            insertBuyer = ('INSERT INTO BUYER VALUES ("{}", "{}", {}, "NONE", {});'.format(username, phone, address_id, default_store_id))
            cursor3.execute(insertBuyer)
            self.connection.commit()

            self.buyerFunct = BuyerFunctionality.BuyerFunctWindow(username)
            self.buyerFunct.show()
            self.close()

        self.connection.close()