Example #1
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            try
            {
                DTOPessoa tryEntrarDTO = new DTOPessoa();

                tryEntrarDTO.Nome  = txtUsuario.Text;
                tryEntrarDTO.Senha = txtSenha.Text;

                PessoaControl control  = new PessoaControl();
                string        permitir = control.PessoaEntrar(tryEntrarDTO);
                if (permitir == "Acesso Permitido")
                {
                    FrmMenuPrincipal abrir = new FrmMenuPrincipal();
                    abrir.Show();

                    this.Hide();
                    lblErroLogin.Visible = false;
                }
                else
                {
                    lblErroLogin.Text    = "Oops! O usuário ou senha estão incorretos!";
                    lblErroLogin.Visible = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("O Banco de Dados pode estar offline :(" + ex.Message, "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public FormReduzConsumo(FrmMenuPrincipal form)
 {
     formCompartilhado = form;
     InitializeComponent();
 }