def OnBotaoEditarButton(self, event): prof = Professor() login = Login() sexo = 0 if self.campoCPF.GetValue() == '' or len( self.campoCPF.GetValue()) != 11: self.erroText.SetLabel('Preencha o campo CPF corretamente!') return 0 elif self.verificador() == False: self.erroText.SetLabel('Preencha os campos corretamente!') return 0 elif self.campoSenha.GetValue() != self.campoConfirmeSenha.GetValue(): self.erroText.SetLabel('Preencha o campo Senha corretamente!') return 0 else: if self.botaoMasc.GetValue(): sexo = 1 else: sexo = 2 data = self.campoNascimento.GetValue().split('-') nasc = '' for i in range(len(data) - 1, -1, -1): if nasc == '': nasc += data[i] else: nasc += '-' + data[i] prof.salvarEdit(self.campoCPF.GetValue(), self.campoNome.GetValue(), nasc, sexo, self.campoCep.GetValue(), self.campoUF.GetValue(), self.campoCidade.GetValue(), self.campoBairro.GetValue(), self.campoEndereco.GetValue(), int(self.campoNumero.GetValue()), self.campoComplemento.GetValue(), self.campoFixo.GetValue(), self.campoCelular.GetValue()) if self.campoSenha.GetValue( ) != '' and self.campoConfirmeSenha.GetValue() != '': None else: if login.carregar(self.campoCPF.GetValue()): login.salvarEdit(login.getLogin(), self.campoSenha.GetValue(), login.getTipo()) self.erroText.SetLabel('Editado com Sucesso!') self.zerar() event.Skip()
def OnBotaoLogarButton(self, event): self.nomeErro.SetLabel('Aguarde, carregando BD') self.Logar = Login() self.valorLogin = self.digiteLogin.GetValue() self.valorSenha = self.digiteSenha.GetValue() if self.Logar.carregar(self.valorLogin): if self.valorSenha == self.Logar.getSenha( ): #and self.Logar.getTipo() == 'ADM': self.Close() ponte.mainAcademicsFrameApp() exit() else: self.nomeErro.SetLabel('Login ou Senha Invalido!') else: self.nomeErro.SetLabel('Login ou Senha Invalido!') event.Skip()
def OnBotaoSalvarButton(self, event): aluno = Aluno() login = Login() try: if self.verificador == 0: try: if self.sexoMAluno.GetValue(): sexo = 1 else: sexo = 2 num = int(self.campoNumero.GetValue()) if self.campoTelefone.GetValue() != '': str(int(self.campoTelefone.GetValue())) tel = self.campoTelefone.GetValue() else: tel = '' if self.campoCelular.GetValue() != '': str(int(self.campoCelular.GetValue())) cel = self.campoCelular.GetValue() else: cel = '' teste = str(int(self.campoCPFA.GetValue())) if self.getSerie() != 'false': aluno.add( self.campoCPFA.GetValue(), self.campoNomeA.GetValue(), self.invertData(self.campoNascimentoA.GetValue()), sexo, self.campoCEP.GetValue(), self.campoUF.GetValue(), self.campoCidade.GetValue(), self.campoBairro.GetValue(), self.campoEndereco.GetValue(), num, self.campoComplemento.GetValue(), self.getSerie(), self.getTurno(), tel, cel) else: None self.zerar() except: None else: try: if self.sexoMAluno.GetValue(): sexo = 1 else: sexo = 2 num = int(self.campoNumero.GetValue()) if self.campoTelefone.GetValue() != '': str(int(self.campoTelefone.GetValue())) tel = self.campoTelefone.GetValue() else: tel = '' if self.campoCelular.GetValue() != '': cel = str(int(self.campoCelular.GetValue())) cel = self.campoCelular.GetValue() else: cel = '' teste = str(int(self.campoCPFA.GetValue())) if self.getSerie() != 'false': aluno.salvarEdit( self.campoCPFA.GetValue(), self.campoNomeA.GetValue(), self.invertData(self.campoNascimentoA.GetValue()), sexo, self.campoCEP.GetValue(), self.campoUF.GetValue(), self.campoCidade.GetValue(), self.campoBairro.GetValue(), self.campoEndereco.GetValue(), num, self.campoComplemento.GetValue(), tel, cel, self.getSerie(), self.getTurno()) else: None self.zerar() except: None except: None event.Skip()