Esempio n. 1
0
        private void pctVoltar_Click(object sender, EventArgs e)
        {
            frmAdminFuncionarios telaFuncionarios = new frmAdminFuncionarios();

            this.Hide();
            telaFuncionarios.Show();
        }
Esempio n. 2
0
        private void lblBtnFunc_Click(object sender, EventArgs e)
        {
            frmAdminFuncionarios telaAdminFunc = new frmAdminFuncionarios();

            telaAdminFunc.Show();
            this.Hide();
        }
Esempio n. 3
0
        private void lblBtnCadastrar_Click(object sender, EventArgs e)
        {
            if (txtNome.Text == string.Empty ||
                mskdCep.MaskFull == false ||
                rdSexFeminino.Checked == false && rdSexMasculino.Checked == false ||
                mskdCpf.Text == string.Empty ||
                txtBairro.Text == string.Empty ||
                txtLogin.Text == string.Empty ||
                txtSalario.Text == string.Empty ||
                mskdNascimento.MaskFull == false ||
                rdTipInstrutor.Checked == false && rdTipSecretario.Checked == false ||
                txtEndereco.Text == string.Empty ||
                txtNum.Text == string.Empty ||
                txtSenha.Text == string.Empty ||
                txtConfirmacao.Text == string.Empty)
            {
                MessageBox.Show("Por favor, preencha todos os campos obrigatorios vazios", "Campos vazios", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                if (txtSalario.Text == string.Empty)
                {
                    pbASalario.Visible = true;
                }
                if (rdTipInstrutor.Checked == false && rdTipSecretario.Checked == false)
                {
                    pbAtipo.Visible            = true;
                    lblObrigatorioTipo.Visible = false;
                }
                if (txtNome.Text == string.Empty)
                {
                    pbANome.Visible = true;
                }

                if (mskdCpf.MaskFull == false)
                {
                    pbACPF.Visible            = true;
                    lblObrigatorioCPF.Visible = false;
                }
                if (rdSexFeminino.Checked == false && rdSexMasculino.Checked == false)
                {
                    pbAsexo.Visible            = true;
                    lblObrigatorioSexo.Visible = false;
                }
                if (mskdCep.MaskFull == false)
                {
                    pbACEP.Visible = true;
                }
                if (txtBairro.Text == string.Empty)
                {
                    pbAbairro.Visible = true;
                }
                if (txtLogin.Text == string.Empty)
                {
                    pbAlogin.Visible = true;
                }
                if (mskdNascimento.MaskFull == false)
                {
                    pbADdeN.Visible = true;
                }
                if (txtEndereco.Text == string.Empty)
                {
                    pbAendereco.Visible = true;
                }
                if (txtNum.Text == string.Empty)
                {
                    pbANum.Visible = true;
                }
                if (txtSenha.Text == string.Empty)
                {
                    pbASenha.Visible = true;
                }
                if (txtConfirmacao.Text == string.Empty)
                {
                    pbAconfSenha.Visible = true;
                }
            }

            else
            {
                if (txtSenha.Text == txtConfirmacao.Text)
                {
                    if (acessarFuncCad.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);
                        pbAlogin.Visible = true;
                        txtLogin.Focus();
                    }
                    else
                    {
                        try
                        {
                            acessarFuncCad.cadastrarFunc(txtNome.Text, mskdCelular.Text, txtEmail.Text, mskdNascimento.Text, mskdCpf.Text, mskdTelefoneEmer.Text, sexo, tipo, mskdCep.Text, txtEndereco.Text, txtBairro.Text, txtNum.Text, txtComplemento.Text, txtSalario.Text, txtLogin.Text, txtSenha.Text);

                            MessageBox.Show("Funcionário cadastrado com sucesso.", "Cadastro de Funcionários", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            frmAdminFuncionarios telaFunc = new frmAdminFuncionarios();
                            this.Hide();
                            telaFunc.Show();
                        }
                        catch (FormatException)
                        {
                            MessageBox.Show("A data digitada não é válida", "Data inválida", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            pbADdeN.Visible = true;
                            mskdNascimento.Focus();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("A senha e confirmação não coincidem!", "Senhas diferentes", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    pbAconfSenha.Visible = true;
                    pbASenha.Visible     = true;
                    txtSenha.Focus();
                }
            }
        }