Exemplo n.º 1
0
        private void frmUsuario_Load(object sender, EventArgs e)
        {
            gvDados.AutoGenerateColumns = false;
            daoPaciente dp = new daoPaciente();

            gvDados.DataSource = dp.carregaUsuario();
        }
Exemplo n.º 2
0
        private void btnConfirma_Click(object sender, EventArgs e)
        {
            bool   ok  = false;
            string ret = string.Empty;

            if (validaSenha(txtUser.Text))
            {
                ok  = true;
                ret = "Usuário Inválido!";
            }
            if (validaSenha(txtNome.Text))
            {
                ok   = true;
                ret += "Nome Inválido!";
            }

            if (ok)
            {
                MessageBox.Show(ret);
            }
            else
            {
                daoPaciente dp = new daoPaciente();
                dp.chkUser(tratarStr(txtUser.Text), tratarStr(txtNome.Text), cbxTipoUser.Text);
                MessageBox.Show("Usuário Cadastrado com Sucesso!");
            }
        }
Exemplo n.º 3
0
        private void frmPrincipal_Load(object sender, EventArgs e)
        {
            lblUser.Text = "";
            daoPaciente dp = new daoPaciente();

            lblUser.Text = dp.userLog(usuarioLog);
        }
Exemplo n.º 4
0
        private void btnGravar_Click(object sender, EventArgs e)
        {
            if (validaDados())
            {
                int id = Convert.ToInt32(txtId.Text);

                nome = tratarStr(txtNome.Text);
                cpf  = tratarStr(txtCpf.Text);
                rg   = tratarStr(txtRg.Text);
                dt   = dtNasc.Text;
                fone = tratarStr(txtFone.Text);
                sexo = (rdbMasc.Checked ? "M" : "F");
                nac  = tratarStr(txtNac.Text);
                end  = tratarStr(txtEnd.Text);
                num  = tratarStr(txtNum.Text);
                cep  = tratarStr(txtCep.Text);
                uf   = tratarStr(cbxUf.Text);

                daoPaciente dp = new daoPaciente();
                if (dp.editPac(id, nome, cpf, rg, dt, fone, sexo, nac, end, num, cep, uf))
                {
                    frmPaciente fr = new frmPaciente();
                    fr.atualizaGrid();
                    this.Close();
                }
            }
        }
Exemplo n.º 5
0
        private void btnPesq_Click(object sender, EventArgs e)
        {
            txtCod.Text         = "";
            txtPsec.Text        = "";
            txtRsec.Text        = "";
            gbxAltSenha.Enabled = false;
            string[] psec = new string[2];
            if (!validaSenha(txtUser.Text))
            {
                daoPaciente dp = new daoPaciente();
                psec = dp.recSenha(txtUser.Text);

                if (!psec[0].Contains("Incorreto"))
                {
                    txtPsec.Text       = psec[0];
                    txtCod.Text        = psec[1];
                    btnOkSenha.Enabled = true;
                }
                else
                {
                    MessageBox.Show(psec[0]);
                }
            }
            else
            {
                MessageBox.Show("Nome Incorreto!");
            }
        }
Exemplo n.º 6
0
 private void btnOkSenha_Click(object sender, EventArgs e)
 {
     if (txtNewSenha.Text == txtNewSenha2.Text)
     {
         if (!validaSenha(txtRsec.Text))
         {
             daoPaciente dp = new daoPaciente();
             if (dp.alteraSenha(Convert.ToInt32(txtCod.Text), txtNewSenha.Text))
             {
                 MessageBox.Show("Senha Alterada!");
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Erro ao alterar!");
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("Senha Não pode conter especiais!");
         }
     }
     else
     {
         MessageBox.Show("Senhas não conferam!");
     }
 }
Exemplo n.º 7
0
        private void btnPesq_Click(object sender, EventArgs e)
        {
            string id   = tratarStr(txtId.Text);
            string nome = tratarStr(txtNome.Text);
            string cpf  = tratarStr(txtCpf.Text);

            gvPesqClie.DataSource = null;

            daoPaciente dp = new daoPaciente();

            if (dp.pesqPaciente(id, nome, cpf).Rows.Count > 0)
            {
                gvPesqClie.DataSource = dp.pesqPaciente(id, nome, cpf);
            }
        }
Exemplo n.º 8
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            daoPaciente dp         = new daoPaciente();
            int         usuarioLog = dp.validaUsuario(tratarStr(txtUsuario.Text), tratarStr(txtSenha.Text));

            if (usuarioLog > 0)
            {
                frmPrincipal fp = new frmPrincipal();
                fp.gravaUser(usuarioLog);
                fp.Show();
                this.Visible = false;
            }
            else
            {
                MessageBox.Show("Usuario ou senha incorretos!");
            }
        }
Exemplo n.º 9
0
        private void btnApaga_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(gvDados.CurrentRow.Cells["ID"].Value);

            if (id > 0)
            {
                string nome = gvDados.CurrentRow.Cells["NOME"].Value.ToString();
                var    exc  = MessageBox.Show("Deseja realmente excluir o paciente " + nome + " ?", "Excluir", MessageBoxButtons.YesNo);

                if (exc == DialogResult.Yes)
                {
                    daoPaciente dp = new daoPaciente();
                    if (dp.delPac(id))
                    {
                        MessageBox.Show("Paciente Excluido Com Sucesso!");
                        atualizaGrid();
                    }
                }
            }
        }
Exemplo n.º 10
0
 private void btnConfirma_Click(object sender, EventArgs e)
 {
     if (!validaSenha(txtRsec.Text))
     {
         daoPaciente dp = new daoPaciente();
         if (dp.obtResp(Convert.ToInt32(txtCod.Text)).Equals(txtRsec.Text))
         {
             gbxAltSenha.Enabled = true;
         }
         else
         {
             MessageBox.Show("Digite a Resposta Corretamente!");
             txtRsec.Focus();
         }
     }
     else
     {
         MessageBox.Show("Digite a Resposta Corretamente!");
         txtRsec.Focus();
     }
 }
Exemplo n.º 11
0
        private void frmCadPaciente_Load(object sender, EventArgs e)
        {
            daoPaciente dp = new daoPaciente();

            txtId.Text = dp.proxId().ToString();

            #region PREENCHE UF
            cbxUf.Items.Add("AC");
            cbxUf.Items.Add("AL");
            cbxUf.Items.Add("AM");
            cbxUf.Items.Add("AP");
            cbxUf.Items.Add("BA");
            cbxUf.Items.Add("CE");
            cbxUf.Items.Add("DF");
            cbxUf.Items.Add("ES");
            cbxUf.Items.Add("GO");
            cbxUf.Items.Add("MA");
            cbxUf.Items.Add("MG");
            cbxUf.Items.Add("MS");
            cbxUf.Items.Add("MT");
            cbxUf.Items.Add("PA");
            cbxUf.Items.Add("PB");
            cbxUf.Items.Add("PE");
            cbxUf.Items.Add("PI");
            cbxUf.Items.Add("PR");
            cbxUf.Items.Add("RJ");
            cbxUf.Items.Add("RN");
            cbxUf.Items.Add("RO");
            cbxUf.Items.Add("RR");
            cbxUf.Items.Add("RS");
            cbxUf.Items.Add("SC");
            cbxUf.Items.Add("SE");
            cbxUf.Items.Add("SP");
            cbxUf.Items.Add("TO");
            #endregion
        }
Exemplo n.º 12
0
        private void btnConfirma_Click(object sender, EventArgs e)
        {
            if (!validaCampos())
            {
                if (!validaSenha(txtSenha.Text))
                {
                    string[] ret = new string[1];
                    if (txtSenha.Text == txtSenha2.Text)
                    {
                        daoPaciente dp = new daoPaciente();
                        ret = dp.primeiroAcesso(tratarStr(txtUsuario.Text), tratarStr(txtSenha.Text), tratarStr(txtPsec.Text), tratarStr(txtRsec.Text));

                        if (ret[0] == "0")
                        {
                            MessageBox.Show(ret[1]);
                        }
                        else
                        {
                            if (ret[0] == "1")
                            {
                                MessageBox.Show(ret[1]);
                                this.Close();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Senhas não são conferem!");
                    }
                }
                else
                {
                    MessageBox.Show("Senha não pode conter carácteres especiais!");
                }
            }
        }
Exemplo n.º 13
0
        private void editPaci_Load(object sender, EventArgs e)
        {
            #region PREENCHE UF
            cbxUf.Items.Add("AC");
            cbxUf.Items.Add("AL");
            cbxUf.Items.Add("AM");
            cbxUf.Items.Add("AP");
            cbxUf.Items.Add("BA");
            cbxUf.Items.Add("CE");
            cbxUf.Items.Add("DF");
            cbxUf.Items.Add("ES");
            cbxUf.Items.Add("GO");
            cbxUf.Items.Add("MA");
            cbxUf.Items.Add("MG");
            cbxUf.Items.Add("MS");
            cbxUf.Items.Add("MT");
            cbxUf.Items.Add("PA");
            cbxUf.Items.Add("PB");
            cbxUf.Items.Add("PE");
            cbxUf.Items.Add("PI");
            cbxUf.Items.Add("PR");
            cbxUf.Items.Add("RJ");
            cbxUf.Items.Add("RN");
            cbxUf.Items.Add("RO");
            cbxUf.Items.Add("RR");
            cbxUf.Items.Add("RS");
            cbxUf.Items.Add("SC");
            cbxUf.Items.Add("SE");
            cbxUf.Items.Add("SP");
            cbxUf.Items.Add("TO");
            #endregion

            if (modConsulta)
            {
                txtId.ReadOnly    = true;
                txtNome.ReadOnly  = true;
                txtCpf.ReadOnly   = true;
                txtRg.ReadOnly    = true;
                dtNasc.Enabled    = false;
                txtFone.ReadOnly  = true;
                txtNac.ReadOnly   = true;
                txtEnd.ReadOnly   = true;
                txtNum.ReadOnly   = true;
                txtCep.ReadOnly   = true;
                rdbFem.Enabled    = false;
                rdbMasc.Enabled   = false;
                cbxUf.Enabled     = false;
                btnGravar.Visible = false;
            }

            DataTable dt = new DataTable();

            daoPaciente dp = new daoPaciente();
            dt = dp.consultaPaciente(idPaciente);

            txtId.Text   = dt.Rows[0]["ID"].ToString();
            txtNome.Text = dt.Rows[0]["NOME"].ToString();
            txtCpf.Text  = dt.Rows[0]["CPF"].ToString();
            txtRg.Text   = dt.Rows[0]["RG"].ToString();
            dtNasc.Value = Convert.ToDateTime(dt.Rows[0]["DTNASC"]);
            txtFone.Text = dt.Rows[0]["FONE"].ToString();
            txtNac.Text  = dt.Rows[0]["NACIONALIDADE"].ToString();
            txtEnd.Text  = dt.Rows[0]["ENDERECEO"].ToString();
            txtNum.Text  = dt.Rows[0]["NUMERO"].ToString();
            txtCep.Text  = dt.Rows[0]["CEP"].ToString();
            cbxUf.Text   = dt.Rows[0]["UF"].ToString();

            if (dt.Rows[0]["SEXO"].ToString() == "M")
            {
                rdbMasc.Checked = true;
                rdbFem.Checked  = false;
            }
            else
            {
                rdbFem.Checked  = true;
                rdbMasc.Checked = false;
            }
        }
Exemplo n.º 14
0
        public void atualizaGrid()
        {
            daoPaciente dp = new daoPaciente();

            gvDados.DataSource = dp.carregaPaciente();
        }