public CentroSaludSantaIsabel.UCHistoriaClinica Traducir(DTPaciente p)
 {
     CentroSaludSantaIsabel.UCHistoriaClinica uchc = new CentroSaludSantaIsabel.UCHistoriaClinica();
     uchc.labelNombres.Text   = p.paciente.Nombres;
     uchc.labelApellidos.Text = p.paciente.Apellidos;
     return(uchc);
 }
        public override void LoadTempIntoFlowLayout()
        {
            DTPaciente        last_added = BufferPaciente.Instance.buffer[BufferPaciente.Instance.buffer.Count - 1].paciente;
            UCHistoriaClinica ucp        = this.adaptadorUC.Traducir(last_added);

            ucp.index_paciente      = BufferPaciente.Instance.buffer.Count - 1;
            ucp.labelApellidos.Text = ucp.index_paciente.ToString() + " : " + BufferPaciente.Instance.buffer[ucp.index_paciente].paciente.id.ToString();
            ((System.Windows.Forms.FlowLayoutPanel) this.flowLayout).Controls.Add(ucp);
            BufferPaciente.Instance.DropTemp();
        }
Beispiel #3
0
        public FormHistoriaClinica Traducir(DTPaciente p)
        {
            FormHistoriaClinica form = new FormHistoriaClinica();

            form.ucPaciente.labelNombres.Text        = p.paciente.Nombres;
            form.ucPaciente.labelApellidos.Text      = p.paciente.Apellidos;
            form.ucPaciente.labelGrupoSanguineo.Text = p.paciente.GrupoSanguineo.ToString();
            form.ucPaciente.labelSexo.Text           = p.paciente.Sexo.ToString();
            return(form);
        }
 public CentroSaludSantaIsabel.UCPaciente Traducir(DTPaciente p)
 {
     CentroSaludSantaIsabel.UCPaciente uchc = new CentroSaludSantaIsabel.UCPaciente();
     uchc.labelNombres.Text        = p.paciente.Nombres;
     uchc.labelApellidos.Text      = p.paciente.Apellidos;
     uchc.labelGrupoSanguineo.Text = p.paciente.GrupoSanguineo.ToString();
     uchc.labelSexo.Text           = p.paciente.Sexo.ToString();
     uchc.index_paciente           = p.id;
     return(uchc);
 }
Beispiel #5
0
        public static void GestionarPaciente(UCPaciente ucp)
        {
            DTPaciente p = new DTPaciente();

            Personas.FormPaciente form = new Personas.FormPaciente();

            if (ucp.index_paciente != CONFIG.NEW_REG)
            {
                form = CTRLPaciente.adaptadorUI.Traducir(CTRLPaciente.adaptadorDT.
                                                         Traducir(BufferPaciente.Instance.buffer[ucp.index_paciente].paciente));
            }
            else if (BufferPaciente.Instance.temp.paciente != null &&
                     BufferPaciente.Instance.temp.paciente.id == 0)
            {
                form = CTRLPaciente.adaptadorUI.Traducir(CTRLPaciente.adaptadorDT.Traducir(BufferPaciente.Instance.temp.paciente));
            }

            {
                bool valid = false;
                while (!valid && form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        form.DialogResult = System.Windows.Forms.DialogResult.None;
                        p = CTRLPaciente.adaptadorDT.Traducir(CTRLPaciente.adaptadorUI.Traducir(form));

                        valid = true;
                        if (ucp.index_paciente != CONFIG.NEW_REG)
                        {
                            p.id = BufferPaciente.Instance.temp.paciente.id;
                            if (p == BufferPaciente.Instance.temp.paciente)
                            {
                                //se hace un update innecesario con los mismos datos al no verificar
                                //que no se haya cambiado ningun dato. habria que agregar eventos a cada textbox..
                                break;
                            }
                            p.instruccion = Instruccion.INSTRUCTION_UPDATE;
                        }
                        else
                        {
                            p.instruccion = Instruccion.INSTRUCTION_INSERT;
                        }
                        BufferPaciente.Instance.temp.paciente     = p;
                        BufferPaciente.Instance.temp.tipoRegistro = TipoRegistroDT.DIRTY_REG_INSERT;
                        CTRLPaciente.adaptadorUC.Traducir(ucp, p.paciente);
                    }
                    catch (NullReferenceException e)
                    {
                        System.Windows.Forms.MessageBox.Show("Ingresa bien tus datos! " + e.Message);
                    }
                }
            }
        }
        public override void LoadTempIntoFlowLayout(Object UC, int index)
        {
            DTPaciente last_modified = BufferPaciente.Instance.buffer[((UCHistoriaClinica)UC).index_paciente].paciente;

            ((System.Windows.Forms.FlowLayoutPanel) this.flowLayout).Controls.Remove((UCHistoriaClinica)UC);
            ((UCHistoriaClinica)UC).Dispose();
            UCHistoriaClinica ucp = adaptadorUC.Traducir(last_modified);

            ucp.index_paciente      = ((UCHistoriaClinica)UC).index_paciente;
            ucp.labelApellidos.Text = ucp.index_paciente.ToString() + " : " + BufferPaciente.Instance.buffer[ucp.index_paciente].paciente.id.ToString();
            ((System.Windows.Forms.FlowLayoutPanel) this.flowLayout).Controls.
            Add(ucp);
            BufferPaciente.Instance.DropTemp();
        }
 public static NpgsqlCommand Traducir(DTPaciente dtp)
 {
     if (dtp.instruccion == Instruccion.INSTRUCTION_INSERT)
     {
         return(insert(dtp));
     }
     else if (dtp.instruccion == Instruccion.INSTRUCTION_UPDATE)
     {
         return(update(dtp));
     }
     else
     {
         return(delete(dtp.id));
     }
 }
        public static DTPaciente Traducir(NpgsqlDataReader dr)
        {
            DTPaciente dtp = new DTPaciente();

            dtp.paciente.Nombres   = (String)dr[0];
            dtp.paciente.Apellidos = dr[1].ToString();
            dtp.id                      = Int32.Parse(dr[2].ToString());
            dtp.paciente.Sexo           = dr[3].ToString();
            dtp.paciente.FechaNac       = Convert.ToDateTime(dr[4].ToString());
            dtp.paciente.Ocupacion      = dr[5].ToString();
            dtp.paciente.EstadoCivil    = dr[6].ToString();
            dtp.paciente.Nacionalidad   = dr[7].ToString();
            dtp.paciente.IdiomaMaterno  = dr[8].ToString();
            dtp.paciente.GrupoSanguineo = dr[9].ToString();
            dtp.paciente.FactorRH       = dr[10].ToString();
            dtp.instruccion             = Instruccion.INSTRUCTION_NONE;
            return(dtp);
        }
        public static NpgsqlCommand update(DTPaciente p)
        {
            var cmd = BD.Instance.conn.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "UPDATE " + table_name + " SET nombres = @nombres, apellidos = @apellidos, sexo = @sexo,"
                              + " fecha_nac = @fecha_nac, ocupacion = @ocupacion, estado_civil = @estado_civil, nacionalidad = @nacionalidad,"
                              + " idioma_materno = @idioma_materno, grupo_sang = @grupo_sang, \"factorRH\" = @factorRH WHERE id = " + p.id + ";";
            cmd.Parameters.AddWithValue("nombres", p.paciente.Nombres);
            cmd.Parameters.AddWithValue("apellidos", p.paciente.Apellidos);
            cmd.Parameters.AddWithValue("sexo", p.paciente.Sexo.ToString());
            cmd.Parameters.AddWithValue("fecha_nac", p.paciente.FechaNac.ToString());
            cmd.Parameters.AddWithValue("ocupacion", p.paciente.Ocupacion);
            cmd.Parameters.AddWithValue("estado_civil", p.paciente.EstadoCivil);
            cmd.Parameters.AddWithValue("nacionalidad", p.paciente.Nacionalidad);
            cmd.Parameters.AddWithValue("idioma_materno", p.paciente.IdiomaMaterno);
            cmd.Parameters.AddWithValue("grupo_sang", p.paciente.GrupoSanguineo);
            cmd.Parameters.AddWithValue("factorRH", p.paciente.FactorRH);
            return(cmd);
        }
        public static NpgsqlCommand insert(DTPaciente p)
        {
            var cmd = BD.Instance.conn.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = " INSERT INTO " + table_name + " (nombres, apellidos, sexo, fecha_nac,"
                              + " ocupacion, estado_civil, nacionalidad, idioma_materno, grupo_sang, \"factorRH\")"
                              + " VALUES (@nombres, @apellidos, @sexo, @fecha_nac,"
                              + " @ocupacion, @estado_civil, @nacionalidad, @idioma_materno, @grupo_sang, @factorRH);";
            cmd.Parameters.AddWithValue("nombres", p.paciente.Nombres);
            cmd.Parameters.AddWithValue("apellidos", p.paciente.Apellidos);
            cmd.Parameters.AddWithValue("sexo", p.paciente.Sexo.ToString());
            cmd.Parameters.AddWithValue("fecha_nac", p.paciente.FechaNac.ToString());
            cmd.Parameters.AddWithValue("ocupacion", p.paciente.Ocupacion);
            cmd.Parameters.AddWithValue("estado_civil", p.paciente.EstadoCivil);
            cmd.Parameters.AddWithValue("nacionalidad", p.paciente.Nacionalidad);
            cmd.Parameters.AddWithValue("idioma_materno", p.paciente.IdiomaMaterno);
            cmd.Parameters.AddWithValue("grupo_sang", p.paciente.GrupoSanguineo);
            cmd.Parameters.AddWithValue("factorRH", p.paciente.FactorRH);
            return(cmd);
        }
 public void RemovePaciente(DTPaciente p)
 {
     paciente = null;
 }
 public DTHC(DTPaciente p)
 {
     paciente     = p;
     tipoRegistro = TipoRegistroDT.CLEAN_REG;
     //instrucciones.Add(new KeyValuePair<int, int>(buffer.Count, BD.INSTRUCTION_INSERT));
 }
 public void Traducir(ref UCHistoriaClinica uchc1, DTPaciente p)
 {
     CentroSaludSantaIsabel.UCHistoriaClinica uchc2 = Traducir(p);
     uchc1.labelNombres.Text   = uchc2.labelNombres.Text;
     uchc1.labelApellidos.Text = uchc2.labelApellidos.Text;
 }
 public Paciente Traducir(DTPaciente p)
 {
     return(p.paciente);
 }
 public static void Guardar(DTPaciente dtp)
 {
     CTRLBD.Execute(AdaptadorBDDTPaciente.Traducir(dtp));
 }