Пример #1
0
 void  text_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (DgvPendientes.CurrentCell.ColumnIndex == DgvPendientesColDocumento.Index)
         {
             Oper_Paciente _Paciente  = new Oper_Paciente();
             var           _pacienteD = new Cls_Paciente();
             _pacienteD = _Paciente.Buscar_Paciente_(Cls_Convertir.Convertir_Null_String(DgvPendientes.Rows[DgvPendientes.CurrentRow.Index].Cells["DgvPendientesColDocumento"]));
             if (_pacienteD.Pac_Identificacion != null)
             {
                 DgvPendientes.Rows[DgvPendientes.CurrentRow.Index].Cells["DgvPendientesNombrecompleto"].Value = _pacienteD.Pac_Nombre_Completo;
                 DgvPendientes.CurrentCell = DgvPendientes.Rows[DgvPendientes.CurrentRow.Index].Cells["DgvPendientesMotivo"];
             }
             else
             {
                 MessageBox.Show("Sin resultados");
                 DgvPendientes.CurrentCell = DgvPendientes.Rows[DgvPendientes.CurrentRow.Index].Cells["DgvPendientesColDocumento"];
             }
         }
     }
 }
Пример #2
0
        private async void BtnGuardar_Pendi_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("¿Desea continuar?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            //int x = 0;
            //Se hace el recorrido del DGV
            foreach (DataGridViewRow item in DgvPendientes.Rows)
            {
                //Obtenemos los valores de las filas que son no estan de color WhiteSmoke ya que estan son las que contienen la información del paciente que se le va a realizar la atención
                if (item.DefaultCellStyle.BackColor != Color.WhiteSmoke)
                {
                    string Identificacion = Cls_Convertir.Convertir_Null_String(item.Cells["DgvPendientesColDocumento"]);
                    string motivo         = Cls_Convertir.Convertir_Null_String(item.Cells["DgvPendientesMotivo"]);
                    string profesional    = Cls_Convertir.Convertir_Null_String(item.Cells["DgvPendientesProfesional"]);
                    string fechaentrada   = (Cls_Convertir.Convertir_Null_String(item.Cells["DgvPendientesFecha"]));
                    string Medico         = Cls_Convertir.Convertir_Null_String(item.Cells["DgvPendientesProfesional"]);
                    string Hora           = Cls_Convertir.Convertir_Null_String(item.Cells["DgvPendientesHora"]);
                    string nombre         = Cls_Convertir.Convertir_Null_String(item.Cells["DgvPendientesNombrecompleto"]);
                    int    Eps            = Convert.ToInt32(CboEPS.SelectedValue);
                    int    Arl            = Convert.ToInt32(CboARL.SelectedValue);

                    if (Identificacion != "" && motivo != "" && Medico != "" && nombre != "")
                    {
                        //MessageBox.Show(fechaentrada);
                        //Se cambia la fila de color
                        item.DefaultCellStyle.BackColor = Color.WhiteSmoke;
                        //Agregamos el paciente a nuela coleccion generica
                        Cls_AtencionAgregada.Cls_Atencions.Add(new Cls_Atencion
                        {
                            Entr_Numero        = 23,
                            Ent_MotivoConsulta = motivo,
                            Entr_FechaEntrada  = Convert.ToDateTime(fechaentrada),
                            Ent_Estado         = new Cls_Estados_Atencion2 {
                                EstAten_Codigo = Cls_Estados_Atencion.Pendiente
                            },
                            Entr_Hora             = Convert.ToDateTime(Hora),
                            Entr_Diagnostico      = "",
                            Entr_Concepto_Codigo  = 0,
                            Entr_Recomendacion    = "",
                            Entr_Reubicacion      = 1,
                            Entr_TipoExamenCodigo = "",
                            Ent_CodARL            = new Cls_Arl {
                                Arl_Codigo = Eps, Arl_Descripcion = ""
                            },
                            Ent_CodEPS = new Cls_Eps {
                                Eps_Codigo = Arl, Eps_Descripcion = ""
                            },
                            Ent_conceptoAptitud = "",
                            Ent_Enfasis         = 0,
                            Ent_CodMedico       = new Cls_Medico {
                                Medic_Identificacion = Medico
                            },
                            Entr_IdPaciente = new Cls_Paciente {
                                Pac_Identificacion = Identificacion
                            }                                                                           //Cls_PacienteAgregado.cls_PacienteNuevos[x]
                        });
                    }
                }
            }

            //Confirmamos que la coleccion tenga pacientes agregados
            if (Cls_AtencionAgregada.Cls_Atencions.Count > 0)
            {
                //Instanciamos la clase que contiene nuestro metodo de insertar paciente
                var _Insertar_PacientePendiente = new Cls_Insertar_Paiente_Pendiente();
                //llamamos al metodo y le enviamos el parametro que contiene los pacientes
                _Insertar_PacientePendiente.Insertar_PacientesPendientes(Cls_AtencionAgregada.Cls_Atencions);
                //Limpiamos los pacientes que fueron agregados recientemente
                Cls_PacienteAgregado.cls_PacienteNuevos.Clear();
                //Mostramos el mensaje devuelto
                MessageBox.Show(_Insertar_PacientePendiente.error);
                //Cargamos la colección de pacientes por atender
                await Cls_AtencionAgregada.CargarAtenciones_Pendientes();
            }
        }