예제 #1
0
        private void lblBtnEntrar_Click(object sender, EventArgs e)
        {
            if (txtNome.Text == string.Empty || txtLogin.Text == string.Empty || txtSenha.Text == string.Empty || txtSenhaConfirmacao.Text == string.Empty)
            {
                MessageBox.Show("Por favor, preencha todos os campos!", "Campos vazios", MessageBoxButtons.OK, MessageBoxIcon.Error);

                if (txtNome.Text == string.Empty)
                {
                    pctrAlertNome.Visible = true;
                }
                if (txtLogin.Text == string.Empty)
                {
                    pctrAlertUsuario.Visible = true;
                }
                if (txtSenha.Text == string.Empty)
                {
                    pctrAlertSenha.Visible = true;
                }
                if (txtSenhaConfirmacao.Text == string.Empty)
                {
                    pctrAlertConfSenha.Visible = true;
                }
            }
            else
            {
                if (txtSenha.Text != txtSenhaConfirmacao.Text)
                {
                    MessageBox.Show("A senha e confirmação não coincidem!", "Senhas diferentes", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    pctrAlertSenha.Visible     = true;
                    pctrAlertConfSenha.Visible = true;
                    txtSenha.Focus();
                }
                else
                {
                    if (acessarAdminCadastro.verificarLogin(txtLogin.Text) == false)
                    {
                        MessageBox.Show("O nome de usuário escolhido (Login) já existe. \r\nPor favor, digite outro!", "Login já existente", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        pctrAlertUsuario.Visible = true;
                        txtLogin.Focus();
                    }
                    else
                    {
                        acessarAdminCadastro.cadastrarAdmin(txtNome.Text, txtLogin.Text, txtSenha.Text);
                        MessageBox.Show("Administrador cadastrado com sucesso!", "Cadastro", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        frmFincanceioOpcoes finOpcoes = new frmFincanceioOpcoes();
                        finOpcoes.ShowDialog();
                        this.Hide();
                        frmTelaLogin telaLogin = new frmTelaLogin();
                        telaLogin.Show();
                        this.Hide();
                    }
                }
            }
        }
예제 #2
0
        private void lblBtnOpcoes_Click(object sender, EventArgs e)
        {
            frmFincanceioOpcoes telaFinOp = new frmFincanceioOpcoes();

            telaFinOp.ShowDialog();
        }