Exemple #1
0
 def logIn(self):
     user_name, psw = self.user_id.text(), self.password.text()
     found, user, position = self.system.checkRegisteredUser(user_name, psw)
     if not found:
         error = QErrorMessage()
         error.showMessage("wrong input")
         error.setWindowTitle("Error!!!")
         error.exec_()
     else:
         self.parent.loginSucess(user, position)
         self.close()
    def save(self):
        data = self.getData()
        if self.editOrNew == 'edit':
            if not self.parent.editEmployee(self.idEmployee, data, data[3]):
                error = QErrorMessage()
                error.showMessage("Invalid username: "******" already exist")
                error.setWindowTitle("Error!!!")
                error.exec_()
            else:
                self.returnVal = True

        elif self.editOrNew == 'new':
            if not self.parent.addNewEmployee(data, data[3]):
                error = QErrorMessage()
                error.showMessage("ID or/and Username is/are invalid")
                error.setWindowTitle("Error!!!")
                error.exec_()
            else:
                self.returnVal = True
        else:
            raise TypeError