예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection     conect = new SqlConnection(Program.ConnectionString);
            class_funcionario Insert = new class_funcionario();

            Insert.Update(int.Parse(cb_cd_fc.Text), cb_nome_fc.Text, m_tb_cpf_fc.Text, tb_endereco_fc.Text, int.Parse(tb_numero_fc.Text), tb_complemento_fc.Text, tb_cidade_fc.Text, m_tb_telefone_fc.Text, m_tb_celular_fc.Text, dt_dataNascimento_fc.Text);
            MessageBox.Show("Funcionário alterado com sucesso!!!", "<- Cronos Agenda -> Funcionário editado!");
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (tb_senha_nu.Text == "")
                {
                    MessageBox.Show("O campo 'senha' nao foi preenchido!", "< - Cronos Agenda - > Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                if (tb_usuario_nu.Text == "")
                {
                    MessageBox.Show("O campo 'usuário' nao foi preenchido!", "<- Cronos Agenda -> Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                if (rb_adm.Checked == true)
                {
                    Program._nvadm_n_fc = 1;
                }
                else
                if (rb_secretario.Checked == true)
                {
                    Program._nvadm_n_fc = 2;
                }
                else
                if (rb_funcionario.Checked == true)
                {
                    Program._nvadm_n_fc = 3;
                }
                else
                {
                    MessageBox.Show("Erro! Tipo de usuário inválido.", "<- Cronos Agenda -> Erro!");
                    return;
                }
                SqlConnection     conect = new SqlConnection(Program.ConnectionString);
                class_funcionario Insert = new class_funcionario();
                Insert.NovoUsuario(tb_usuario_nu.Text, tb_senha_nu.Text);
                MessageBox.Show("Usuário cadastrado com sucesso!!!", "<- Cronos Agenda -> Usuário cadastrado!");
                this.Close();
            }
            catch (Exception erro)
            {
                if (MessageBox.Show("Erro, não foi possivel cadastrar um novo usuário.\n\n\nDeseja mostrar a causa do erro?", "<- Cronos Agenda -> Erro!", MessageBoxButtons.YesNo, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                {
                    MessageBox.Show("" + erro);
                }

                else
                {
                }
            }
        }
예제 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            int _nvadm = 0;

            if (tb_nome.Text == "")
            {
                MessageBox.Show("Erro! O campo 'Nome' não foi preenchido corretamente.", "<- Cronos Agenda -> Erro!");
            }
            else
            if (tb_usuario_eu.Text == "")
            {
                MessageBox.Show("Erro! O campo 'Login' não foi preenchido corretamente.", "<- Cronos Agenda -> Erro!");
            }
            else
            if (tb_senha_eu.Text == "")
            {
                MessageBox.Show("Erro! O campo 'Senha' não foi preenchido corretamente.", "<- Cronos Agenda -> Erro!");
            }
            if (rb_adm.Enabled == true)
            {
                _nvadm = 1;
            }
            else
            if (rb_secretario.Enabled == true)
            {
                _nvadm = 2;
            }
            else
            if (rb_funcionario.Enabled == true)
            {
                _nvadm = 3;
            }
            else
            {
                MessageBox.Show("Erro! Tipo de usuário inválido.", "<- Cronos Agenda -> Erro!");
            }



            SqlConnection     conect = new SqlConnection(Program.ConnectionString);
            class_funcionario Insert = new class_funcionario();

            Insert.UpdateUSU(tb_nome.Text, tb_usuario_eu.Text, tb_senha_eu.Text, _nvadm);
            MessageBox.Show("Usuário alterado com sucesso!!!", "<- Cronos Agenda -> Alteração de usuário concluido!");
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //Validações

                if (tb_nome_fc.Text == "")
                {
                    MessageBox.Show("O campo 'Nome do funcionario' não foi preenchido coretamente.", "<- Cronos Agenda -> Erro!");
                    return;
                }
                else
                if (m_tb_cpf_fc.Text == "___.___.___-__")
                {
                    MessageBox.Show("O campo 'CPF' não foi preenchido coretamente.", "<- Cronos Agenda -> Erro!");
                    return;
                }
                else
                if (tb_endereco_fc.Text == "")
                {
                    MessageBox.Show("O campo 'Endereço' não foi preenchido coretamente.", "<- Cronos Agenda -> Erro!");
                    return;
                }
                else
                if (tb_numero_fc.Text == "")
                {
                    MessageBox.Show("O campo 'Número' não foi preenchido coretamente.", "<- Cronos Agenda -> Erro!");
                    return;
                }
                else
                if (tb_cidade_fc.Text == "")
                {
                    MessageBox.Show("O campo 'Cidade' não foi preenchido coretamente.", "<- Cronos Agenda -> Erro!");
                    return;
                }
                else
                if (m_tb_telefone_fc.Text == "(__) ____-____")
                {
                    MessageBox.Show("O campo 'Telefone' não foi preenchido coretamente.", "<- Cronos Agenda -> Erro!");
                    return;
                }



                Program._nome_n_FC = tb_nome_fc.Text;
                SqlConnection     conect = new SqlConnection(Program.ConnectionString);
                class_funcionario Insert = new class_funcionario();
                Insert.CadastrarFuncionarios(tb_nome_fc.Text, m_tb_cpf_fc.Text, tb_endereco_fc.Text, int.Parse(tb_numero_fc.Text), tb_complemento_fc.Text, tb_cidade_fc.Text, m_tb_telefone_fc.Text, m_tb_celular_fc.Text, dt_dataNascimento_fc.Text);
                MessageBox.Show("Funcionário cadastrado com sucesso!!!", "<- Cronos Agenda -> Funcionário cadastrado!");

                if (class_funcionario.valid == 1)
                {
                    Cadastro_de_usuário novoUsu = new Cadastro_de_usuário();
                    novoUsu.ShowDialog();
                    this.Close();
                }
                else
                {
                }
            }
            catch
            {
                MessageBox.Show("Não foi possivel cadastrar um novo funcionario!", "<- Cronos Agenda -> Erro!");
            }
        }