//To Inicializze all necesary elemen6ts the UI uses from the database and dates
        internal void LoadComponents()
        {
            dtpEdadHasta.MinDate = new DateTime(1900, 12, 31);
            dtpEdadHasta.MaxDate = DateTime.Today;

            dtpEdadDesde.MinDate = new DateTime(1900, 12, 31);
            dtpEdadDesde.MaxDate = DateTime.Today;

            dtpConsultaDesde.MinDate = new DateTime(1900, 12, 31);
            dtpConsultaDesde.MaxDate = DateTime.Today;

            dtpConsultaHasta.MinDate = new DateTime(1900, 12, 31);
            dtpConsultaHasta.MaxDate = DateTime.Today;

            bool   ResultadoOK  = false;
            string MensajeError = "";

            DataTable DTPacientes = new DataTable();

            DTPacientes = objBusquedaP.Buscar("", 1, ref ResultadoOK, ref MensajeError);
            string FechaNac;
            string FechaAlta;

            //  dgvResultadoBusquedaP.DataSource = DTPacientes;

            dgvResultadoBusquedaP.Rows.Clear();
            for (int i = 0; i < DTPacientes.Rows.Count; i++)
            {
                //FechaNac = Convert.ToDateTime(DTPacientes.Rows[i]["Pa_FechaNac"]).ToShortDateString();
                FechaAlta = Convert.ToDateTime(DTPacientes.Rows[i]["Pa_FechaAlta"]).ToShortDateString();
                FechaNac  = Efecto.ObtenerEdad(Convert.ToDateTime(DTPacientes.Rows[i]["Pa_FechaNac"]));
                dgvResultadoBusquedaP.Rows.Add(

                    DTPacientes.Rows[i]["Pa_ID"],
                    DTPacientes.Rows[i]["Pa_Nombre"],
                    DTPacientes.Rows[i]["Pa_Apellido"],
                    DTPacientes.Rows[i]["Gen_Descripcion"],
                    DTPacientes.Rows[i]["TP_Descripcion"],
                    FechaNac,
                    FechaAlta,
                    DTPacientes.Rows[i]["Pa_Cedula"],
                    DTPacientes.Rows[i]["Pa_Telefono"],
                    DTPacientes.Rows[i]["Pa_Celular"],
                    DTPacientes.Rows[i]["Est_Descripcion"],
                    DTPacientes.Rows[i]["Pa_Email"],
                    DTPacientes.Rows[i]["Zo_Nombre"],
                    DTPacientes.Rows[i]["Domi_Calle"],
                    DTPacientes.Rows[i]["Domi_Numero"],
                    DTPacientes.Rows[i]["Domi_Sector"],
                    DTPacientes.Rows[i]["Mu_Nombre"],
                    DTPacientes.Rows[i]["Pro_Nombre"]
                    );
            }
        }
예제 #2
0
        private void txtBuscarP_TextChanged(object sender, EventArgs e)
        {
            bool   ResultadoOK  = false;
            string MensajeError = "";
            clFachadaBusquedaPaciente objBusquedaP = new clFachadaBusquedaPaciente();
            DataTable DTPacientes = new DataTable();

            DTPacientes = objBusquedaP.Buscar(txtBuscarP.Text, 3, ref ResultadoOK, ref MensajeError);
            string FechaNac;
            string FechaAlta;

            //  dgvResultadoBusquedaP.DataSource = DTPacientes;
            dgvResultadoBusquedaP.Rows.Clear();
            for (int i = 0; i < DTPacientes.Rows.Count; i++)
            {
                //FechaNac = Convert.ToDateTime(DTPacientes.Rows[i]["Pa_FechaNac"]).ToShortDateString();
                FechaAlta = Convert.ToDateTime(DTPacientes.Rows[i]["Pa_FechaAlta"]).ToShortDateString();
                FechaNac  = Efecto.ObtenerEdad(Convert.ToDateTime(DTPacientes.Rows[i]["Pa_FechaNac"]));
                dgvResultadoBusquedaP.Rows.Add(
                    DTPacientes.Rows[i]["Pa_ID"],
                    DTPacientes.Rows[i]["Pa_Nombre"],
                    DTPacientes.Rows[i]["Pa_Apellido"],
                    DTPacientes.Rows[i]["Gen_Descripcion"],
                    DTPacientes.Rows[i]["TP_Descripcion"],
                    FechaNac,
                    FechaAlta,
                    DTPacientes.Rows[i]["Pa_Cedula"],
                    DTPacientes.Rows[i]["Pa_Telefono"],
                    DTPacientes.Rows[i]["Pa_Celular"],
                    DTPacientes.Rows[i]["Est_Descripcion"],
                    DTPacientes.Rows[i]["Pa_Email"],
                    DTPacientes.Rows[i]["Zo_Nombre"],
                    DTPacientes.Rows[i]["Domi_Calle"],
                    DTPacientes.Rows[i]["Domi_Numero"],
                    DTPacientes.Rows[i]["Domi_Sector"],
                    DTPacientes.Rows[i]["Mu_Nombre"],
                    DTPacientes.Rows[i]["Pro_Nombre"]
                    );
            }
            objBusquedaP = null;
            DTPacientes  = null;
        }
예제 #3
0
        private void btnBuscarPaciente_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtBuscarP.Text.Trim()))
            {
                Form_BuscarPaciente FB = new Form_BuscarPaciente();
                FB.ShowDialog();
            }
            else
            {
                clFachadaBusquedaPaciente objFachadaPaciente = new clFachadaBusquedaPaciente();
                DataTable DTPaciente   = new DataTable();
                string    Pa_ID        = txtBuscarP.Text;
                bool      ResultadoOK  = false;
                string    MensajeError = "";

                DTPaciente = objFachadaPaciente.Buscar(Pa_ID, 3, ref ResultadoOK, ref MensajeError);

                if (DTPaciente.Rows.Count == 1)
                {
                    //para asignar a las etiquetas en valor  de los datos del pacinetede la tabla consultada

                    lblNombre.Text       = DTPaciente.Rows[0]["Pa_Nombre"].ToString();
                    lblApellido.Text     = DTPaciente.Rows[0]["Pa_Apellido"].ToString();
                    lblEdad.Text         = Efecto.ObtenerEdad(Convert.ToDateTime(DTPaciente.Rows[0]["Pa_FechaNac"].ToString()));
                    lblGenero.Text       = DTPaciente.Rows[0]["Gen_Descripcion"].ToString();
                    lblTipoPaciente.Text = DTPaciente.Rows[0]["TP_Descripcion"].ToString();
                    lblZona.Text         = DTPaciente.Rows[0]["Zo_Nombre"].ToString();
                    lblCedula.Text       = DTPaciente.Rows[0]["Pa_Cedula"].ToString();
                    lblEstadoCivil.Text  = DTPaciente.Rows[0]["Est_descripcion"].ToString();
                    txtExpediente.Text   = DTPaciente.Rows[0]["Pa_ID"].ToString();

                    cargarCitas(txtExpediente.Text);
                }
                else
                {
                    MessageBox.Show("Paciente no encontrado", "Avertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                DTPaciente = null;
            }
        }