コード例 #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtLogin.Text) || string.IsNullOrEmpty(txtSenha.Text))
            {
                MessageBox.Show("Os campos de login e senha não deverão estar vazios", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            string _msgErro = "Login e/ou senha inválido(s)";

            BusinessOperations businessOperations = new BusinessOperations();

            AdministracaoPlayersVip administracaoPlayersVip = businessOperations.BusinessAdministracaoPlayersVip(new AdministracaoPlayersVip
            {
                AdminLogin    = txtLogin.Text,
                AdminPassword = txtSenha.Text
            });

            if (administracaoPlayersVip == null)
            {
                MessageBox.Show(_msgErro, "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                lblMsgSistema.ForeColor = Color.Red;
                lblMsgSistema.Visible   = true;
                lblMsgSistema.Text      = _msgErro + ". Tente novamente!";
                return;
            }
            else
            {
                FrmMain frmMain = new FrmMain(administracaoPlayersVip);
                Hide();
                frmMain.Show();
            }
        }