private void btnEntrar_Click(object sender, EventArgs e) { Login log = new Login(); ControlerLogin clog = new ControlerLogin(); log.userName = TxtNome.Text; log.password = TxtSenha.Text; clog.Acessar(log); if ((TxtNome.Text.Length != 0) || (TxtSenha.Text.Length != 0)) { if (log.validacao == true) { TelaPrincipal telaPrincipal = new TelaPrincipal(); telaPrincipal.Show(); this.Visible = this.Enabled = false; } else { MessageBox.Show("Usuario ou senha não existem"); } } else { MessageBox.Show("Complete todos os campos"); } User = TxtNome.Text; }
private void BtnTelaCadastrarUser_Click(object sender, EventArgs e) { int resultado; ControlerLogin log = new ControlerLogin(); CadastroUser cadUser = new CadastroUser(); cadUser.userName = TxtNomeUsuarioCadastro.Text; cadUser.password = TxtSenhaUsuarioCadastro.Text; if ((TxtConfirmarSenhaCadastro.Text.Length != 0) && (TxtNomeUsuarioCadastro.Text.Length != 0) && (TxtSenhaUsuarioCadastro.Text.Length != 0)) { if (TxtSenhaUsuarioCadastro.Text == TxtConfirmarSenhaCadastro.Text) { resultado = log.CadastroUser(cadUser); if (resultado != 0) { MessageBox.Show("Cadastro bem sucedido"); } } else { MessageBox.Show("As senhas devem ser iguais"); } } else { MessageBox.Show("Você deve preencher todos os campos"); } }
private void btnEntrar_Click(object sender, EventArgs e) { Login log = new Login(); log.userName = TxtNome.Text; log.password = TxtSenha.Text; nomeUser = TxtNome.Text; ControlerLogin.Acessar(log); if ((TxtNome.Text.Length != 0) && (TxtSenha.Text.Length != 0)) { if (log.validacao == true) { TelaPrincipal telaPrincipal = new TelaPrincipal(); User = ControlerLogin.getUserbyId(TxtNome.Text); telaPrincipal.Show(); telaPrincipal.FormClosed += Logout; this.Hide(); } else { msgErro("Usuario ou senha não existem"); } } else { msgErro("Complete todos os campos"); } }