Example #1
0
    def addUsersinfo(self):
        try:
            #take inputs as variables
            e = self.email
            pw = self.password
            pn = self.num
            fn = self.lineEditFirstName.text()
            sn = self.lineEditlastName.text()
            dateOfBirth = self.dateEdit.text()
            w = self.lineEditWeight.text()
            h = self.lineEditHeight.text()
            sw = w

            #if a user is added
            if (SQLStatements.addUserInfo(e, pw, pn, fn, sn, dateOfBirth, w, h,
                                          sw) == 'True'):

                #show message box and open login window
                QMessageBox.about(QMessageBox(), 'Success',
                                  'you have been added to the database.')
                self.openLoginWindow()
                #if it doesnt work
            elif (SQLStatements.addUserInfo(e, pw, pn, fn, sn, dateOfBirth, w,
                                            h, sw) == 'checkFailed'):
                #show message box
                QMessageBox.warning(QMessageBox(), 'Error', 'Email exists')
                #reopen sign in window
                self.openSignInWindow()

            else:
                QMessageBox.warning(QMessageBox(), 'Error',
                                    'Could not add you to the database.')

        except Exception as e:
            print(e)