コード例 #1
0
        /// <summary>
        /// Alteração de um paciente.
        /// </summary>
        private void btnAlterar_Click(object sender, EventArgs e)
        {
            if (!ValidarCampos())
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            try
            {
                // componente de negócio
                PacienteBc pacienteBc = new PacienteBc();

                // valores dos controles
                this.pacienteRow.Nome                = this.txtNome.Text;
                this.pacienteRow.CPF                 = this.mtxtCPF.Text;
                this.pacienteRow.DataNascimento      = this.dtpDataNascimento.Value;
                this.pacienteRow.Endereco            = this.txtEndereco.Text;
                this.pacienteRow.Complemento         = this.txtComplemento.Text;
                this.pacienteRow.Bairro              = this.txtBairro.Text;
                this.pacienteRow.CEP                 = this.mtxtCEP.Text;
                this.pacienteRow.Cidade              = this.txtCidade.Text;
                this.pacienteRow.Estado              = this.cmbEstado.Text;
                this.pacienteRow.Sexo                = (this.cmbSexo.SelectedIndex == 1);
                this.pacienteRow.Nacionalidade       = this.txtNacionalidade.Text;
                this.pacienteRow.Email               = this.txtEmail.Text;
                this.pacienteRow.TelefoneResidencial = this.txtFoneResidencial.Text;
                this.pacienteRow.TelefoneComercial   = this.txtFoneComercial.Text;
                this.pacienteRow.TelefoneCelular     = this.txtFoneCelular.Text;
                this.pacienteRow.Observacoes         = this.txtObservacoesGerais.Text;

                // altera o paciente
                pacienteBc.AlterarPaciente(this.pacienteRow);

                // muda o estado
                MudarEstado(Estado.Mostrando);
            }
            catch (Exception ex)
            {
                string strMessage = this.resourceMgr.GetString(ex.Message);

                if (strMessage == null)
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = ex.Message;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
                else
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = strMessage;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
            }

            Cursor.Current = Cursors.Default;
        }
コード例 #2
0
        /// <summary>
        /// Busca pelo paciente.
        /// </summary>
        private void btnBuscarPaciente_Click(object sender, EventArgs e)
        {
            // desabilita botão
            this.btnProximo.Enabled = false;

            // escolha do paciente
            FrmBuscarPaciente frmBuscarPaciente = new FrmBuscarPaciente();

            if (frmBuscarPaciente.ShowDialog(this) == DialogResult.Cancel)
            {
                frmBuscarPaciente.Dispose();
                return;
            }

            // modifica cursor
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                // componente de negócio
                PacienteBc pacienteBc = new PacienteBc();

                // busca pelo paciente
                this.pacienteRow = pacienteBc.BuscarPaciente(frmBuscarPaciente.CodigoPaciente);

                // nome do paciente
                this.txtPaciente.Text = this.pacienteRow.Nome;

                // habilita botão
                this.btnProximo.Enabled = true;
            }
            catch (Exception ex)
            {
                string strMessage = this.resourceMgr.GetString(ex.Message);

                if (strMessage == null)
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = ex.Message;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
                else
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = strMessage;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
            }
            finally
            {
                frmBuscarPaciente.Dispose();
                Cursor.Current = Cursors.Default;
            }
        }
コード例 #3
0
        /// <summary>
        /// Exclui o paciente.
        /// </summary>
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            // mensagem de confirmação
            if (MessageBox.Show(this, this.resourceMgr.GetString("MSG0026"), this.Text,
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            try
            {
                // componente de negócio
                PacienteBc pacienteBc = new PacienteBc();

                // exclui o paciente
                pacienteBc.ExcluirPaciente(pacienteRow.CodigoPaciente);

                // limpa campos
                LimparCampos();

                // muda o estado
                MudarEstado(Estado.Limpo);
            }
            catch (Exception ex)
            {
                string strMessage = this.resourceMgr.GetString(ex.Message);

                if (strMessage == null)
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = ex.Message;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
                else
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = strMessage;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
            }

            Cursor.Current = Cursors.Default;
        }
コード例 #4
0
        /// <summary>
        /// Realiza listagem dos pacientes.
        /// </summary>
        private void ListarPacientes()
        {
            this.lstPacientes.DataSource = null;

            try
            {
                // componente de negócio
                PacienteBc pacienteBc = new PacienteBc();

                // lista pacientes
                PacienteDs pacienteDs = pacienteBc.ListarPacientes(this.txtNome.Text);

                // data bind
                this.lstPacientes.DataSource    = pacienteDs.Paciente;
                this.lstPacientes.DisplayMember = "Nome";
                this.lstPacientes.ValueMember   = "CodigoPaciente";
            }
            catch (Exception ex)
            {
                string strMessage = this.resourceMgr.GetString(ex.Message);

                if (strMessage == null)
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = ex.Message;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
                else
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = strMessage;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Busca pelo paciente.
        /// </summary>
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            FrmBuscarPaciente frmBuscarPaciente = new FrmBuscarPaciente();

            if (frmBuscarPaciente.ShowDialog(this) == DialogResult.OK)
            {
                Cursor.Current = Cursors.WaitCursor;

                try
                {
                    // componente de negócio
                    PacienteBc pacienteBc = new PacienteBc();

                    // busca pelo paciente
                    this.pacienteRow = pacienteBc.BuscarPaciente(frmBuscarPaciente.CodigoPaciente);

                    // atribui dados aos controles
                    this.txtNome.Text              = this.pacienteRow.Nome;
                    this.mtxtCPF.Text              = this.pacienteRow.CPF;
                    this.dtpDataNascimento.Value   = this.pacienteRow.DataNascimento;
                    this.txtEndereco.Text          = this.pacienteRow.Endereco;
                    this.txtComplemento.Text       = this.pacienteRow.Complemento;
                    this.txtBairro.Text            = this.pacienteRow.Bairro;
                    this.mtxtCEP.Text              = this.pacienteRow.CEP;
                    this.txtCidade.Text            = this.pacienteRow.Cidade;
                    this.cmbEstado.SelectedIndex   = this.cmbEstado.FindStringExact(this.pacienteRow.Estado);
                    this.cmbSexo.SelectedIndex     = (this.pacienteRow.Sexo) ? 1 : 0;
                    this.txtNacionalidade.Text     = this.pacienteRow.Nacionalidade;
                    this.txtEmail.Text             = this.pacienteRow.Email;
                    this.txtFoneResidencial.Text   = this.pacienteRow.TelefoneResidencial;
                    this.txtFoneComercial.Text     = this.pacienteRow.TelefoneComercial;
                    this.txtFoneCelular.Text       = this.pacienteRow.TelefoneCelular;
                    this.txtObservacoesGerais.Text = this.pacienteRow.Observacoes;

                    // muda estado
                    MudarEstado(Estado.Mostrando);
                }
                catch (Exception ex)
                {
                    string strMessage = this.resourceMgr.GetString(ex.Message);

                    if (strMessage == null)
                    {
                        FrmErro frmErro = new FrmErro();
                        frmErro.Mensagem = ex.Message;
                        frmErro.ShowDialog(this);
                        frmErro.Dispose();
                    }
                    else
                    {
                        FrmErro frmErro = new FrmErro();
                        frmErro.Mensagem = strMessage;
                        frmErro.ShowDialog(this);
                        frmErro.Dispose();
                    }
                }

                Cursor.Current = Cursors.Default;
            }

            frmBuscarPaciente.Dispose();
        }
コード例 #6
0
        /// <summary>
        /// Lista cálculos de IMC do paciente.
        /// </summary>
        /// <param name="codigoPaciente">Código do paciente.</param>
        private void ListarCalculosIMC(int codigoPaciente)
        {
            // modifica cursor
            Cursor.Current = Cursors.WaitCursor;

            // trava busca
            this.travarBusca = true;

            // desabilita botão
            this.btnExcluir.Enabled = false;

            try
            {
                // componente de negócio
                PacienteBc pacienteBc = new PacienteBc();

                // busca pelo paciente
                this.pacienteRow = pacienteBc.BuscarPaciente(codigoPaciente);

                // nome do paciente
                this.txtPaciente.Text = this.pacienteRow.Nome;

                // lista cálculos
                CalculoIMCDs calculoIMCDs = pacienteBc.ListarCalculosIMC(this.pacienteRow.CodigoPaciente);

                // lista cálculos de IMC
                this.lstCalculos.DataSource    = calculoIMCDs.CalculoIMC;
                this.lstCalculos.DisplayMember = "Data";
                this.lstCalculos.ValueMember   = "CodigoCalculoIMC";
            }
            catch (Exception ex)
            {
                string strMessage = this.resourceMgr.GetString(ex.Message);

                if (strMessage == null)
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = ex.Message;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
                else
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = strMessage;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
            }
            finally
            {
                Cursor.Current = Cursors.Default;

                // destrava busca
                this.travarBusca = false;
            }

            // seleciona cálculo
            if (this.lstCalculos.SelectedItems.Count > 0)
            {
                this.lstCalculos_SelectedIndexChanged(this.lstCalculos, new EventArgs());
            }
        }
コード例 #7
0
        /// <summary>
        /// Mostra os dados do cálculo do IMC.
        /// </summary>
        private void lstCalculos_SelectedIndexChanged(object sender, EventArgs e)
        {
            // verifica trava da busca
            if (this.travarBusca)
            {
                return;
            }

            this.Cursor             = Cursors.WaitCursor;
            this.btnExcluir.Enabled = false;

            try
            {
                // componentes de negócio
                CalculoIMCBc calculoIMCBc = new CalculoIMCBc();
                UsuarioBc    usuarioBc    = new UsuarioBc();
                PacienteBc   pacienteBc   = new PacienteBc();

                // busca cálculo do IMC
                CalculoIMCDs.CalculoIMCRow calculoIMCRow = calculoIMCBc.BuscarCalculoIMC((int)this.lstCalculos.SelectedValue);

                // busca fisioterapeuta
                UsuarioDs.UsuarioRow usuario = usuarioBc.BuscarUsuario(calculoIMCRow.CodigoUsuario);

                // mostra dados
                this.lblAlturaCalculada.Text = calculoIMCRow.Altura.ToString("0.00") + " m";
                this.lblMassaCalculada.Text  = calculoIMCRow.Massa.ToString("0.0") + " kg";

                // calcula IMC
                float imc = (float)(calculoIMCRow.Altura * calculoIMCRow.Altura);
                if (imc > 0.01f)
                {
                    imc = (float)calculoIMCRow.Massa / imc;
                }
                this.lblIMCCalculado.Text = imc.ToString("0.0") + " kg/m²";

                // cria componente bc
                CalculoIMCBc calculoIMC = new CalculoIMCBc();

                // classifica paciente
                int tipoIMC = calculoIMC.ClassificarIMC(imc);

                string tipo = this.resourceMgr.GetString("MSGTIPOIMC" + tipoIMC.ToString("00"));

                this.lblClassificacaoDiagnosticada.Text = tipo;

                // fisioterapeuta
                this.lblFisioterapeutaCadastrado.Text = usuario.Nome;

                // observações
                this.txtObservacoes.Text = calculoIMCRow.Observacoes;

                // imagem
                byte[] imagem;
                pacienteBc.BuscarImagem(calculoIMCRow.CodigoImagem, out imagem);

                // cria bitmap
                System.IO.MemoryStream memStream = new System.IO.MemoryStream(imagem);
                Bitmap bitmap = new Bitmap(memStream);
                this.pctImagem.Image = bitmap;

                // verifica se é o fisioterapeuta que criou o cálculo
                this.btnExcluir.Enabled = (usuario.CodigoUsuario == this.usuarioRow.CodigoUsuario);
            }
            catch (Exception ex)
            {
                string strMessage = this.resourceMgr.GetString(ex.Message);

                if (strMessage == null)
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = ex.Message;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
                else
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = strMessage;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
コード例 #8
0
        /// <summary>
        /// Mostra os dados da avaliação postural
        /// </summary>
        private void lstAvaliacoes_SelectedIndexChanged(object sender, EventArgs e)
        {
            // verifica trava da busca
            if (this.travarBusca)
            {
                return;
            }

            this.Cursor             = Cursors.WaitCursor;
            this.btnExcluir.Enabled = false;

            try
            {
                // componentes de negócio
                AvaliacaoPosturalBc avaliacaoPosturalBc = new AvaliacaoPosturalBc();
                UsuarioBc           usuarioBc           = new UsuarioBc();
                PacienteBc          pacienteBc          = new PacienteBc();

                // busca avaliação postural
                AvaliacaoPosturalDs.AvaliacaoPosturalRow avaliacaoPosturalRow = avaliacaoPosturalBc.BuscarAvaliacaoPostural((int)this.lstAvaliacoes.SelectedValue);

                // busca fisioterapeuta
                UsuarioDs.UsuarioRow usuario = usuarioBc.BuscarUsuario(avaliacaoPosturalRow.CodigoUsuario);

                // mostra dados
                double[] angulos = new double[10];
                angulos[0] = avaliacaoPosturalRow.Angulo1;
                angulos[1] = avaliacaoPosturalRow.Angulo2;
                angulos[2] = avaliacaoPosturalRow.Angulo3;
                angulos[3] = avaliacaoPosturalRow.Angulo4;
                angulos[4] = avaliacaoPosturalRow.Angulo5;
                angulos[5] = avaliacaoPosturalRow.Angulo6;
                angulos[6] = avaliacaoPosturalRow.Angulo7;
                angulos[7] = avaliacaoPosturalRow.Angulo8;
                angulos[8] = avaliacaoPosturalRow.Angulo9;
                angulos[9] = avaliacaoPosturalRow.Angulo10;

                // tipo de escoliose
                int tipoEscoliose = avaliacaoPosturalBc.DiagnosticarEscoliose(ref angulos, this.angDiff);

                string strMsg = "MSGTIPOESC" + tipoEscoliose.ToString("00");

                if (tipoEscoliose == 0)
                {
                    this.lblTipoEscolioseDiagnosticada.Text      = this.resourceMgr.GetString(strMsg);
                    this.lblTipoEscolioseDiagnosticada.ForeColor = Color.Red;
                }
                else
                {
                    this.lblTipoEscolioseDiagnosticada.Text      = this.resourceMgr.GetString(strMsg);
                    this.lblTipoEscolioseDiagnosticada.ForeColor = Color.Black;
                }

                // fisioterapeuta
                this.lblFisioterapeutaCadastrado.Text = usuario.Nome;

                // observações
                this.txtObservacoes.Text = avaliacaoPosturalRow.Observacoes;

                // imagem
                byte[] imagem;
                pacienteBc.BuscarImagem(avaliacaoPosturalRow.CodigoImagem, out imagem);

                // cria bitmap
                System.IO.MemoryStream memStream = new System.IO.MemoryStream(imagem);
                Bitmap bitmap = new Bitmap(memStream);

                // pontos de referência
                PontoDs pontoDs = avaliacaoPosturalBc.ListarPontosReferencia(avaliacaoPosturalRow.CodigoImagem);

                // verifica quantidade de pontos
                if (pontoDs.Ponto.Count == 16)
                {
                    // desenha os pontos
                    DesenharPontosZoom(pontoDs, bitmap);
                }
                else
                {
                    this.pctImagem.Image = bitmap;
                }

                // verifica se é o fisioterapeuta que criou a avaliação
                this.btnExcluir.Enabled = (usuario.CodigoUsuario == this.usuarioRow.CodigoUsuario);
            }
            catch (Exception ex)
            {
                string strMessage = this.resourceMgr.GetString(ex.Message);

                if (strMessage == null)
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = ex.Message;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
                else
                {
                    FrmErro frmErro = new FrmErro();
                    frmErro.Mensagem = strMessage;
                    frmErro.ShowDialog(this);
                    frmErro.Dispose();
                }
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }