private void button1_Click(object sender, EventArgs e) { DataResponse <Funcionario> response = funcionarioBLL.Autenticar(txtEmail.Text, txtSenha.Text); if (response.Sucesso) { FormMenu frmMenu = new FormMenu(); this.Hide(); frmMenu.ShowDialog(); //Esta linha só executa quando o FormMenu for fechado this.Show(); } else { MessageBox.Show(response.GetErrorMessage()); } }
private void btnLogar_Click(object sender, EventArgs e) { FuncionarioBLL bll = new FuncionarioBLL(); try { bll.Autenticar(txtUsuario.Text, txtSenha.Text); FormMenu frm = new FormMenu(); this.Hide(); frm.ShowDialog(); this.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { //Variável static n morre em aplicações desktop. FuncionarioBLL fbll = new FuncionarioBLL(); Funcionario fLogado = fbll.Autenticar(txtEmail.Text, txtSenha.Text); if (fLogado != null) { Parametros.FuncionarioLogado = fLogado; FormMenu frmMenu = new FormMenu(); this.Hide(); frmMenu.ShowDialog(); this.Show(); } else { MessageBox.Show("Usuário e/ou senha inválidos"); } FormCleaner.Clear(this); }