Esempio n. 1
0
        /*public void delete(Expediente objExpediente)
         * {
         *
         *
         *  string delete = "delete from expediente where idcharila='" + objExpediente.acceso_exp + "'";
         *
         *      comando = new SqlCommand();
         *      objExpediente.miconexion.Open();
         *      comando.ExecuteNonQuery();
         *
         *  int i =comando.ExecuteNonQuery();
         *  .Close();
         *  if (i > 0)*/
        //{
        //  return true;
        //}
        //else
        //{
        //    return false;
        //  }

        //}


        public Expediente Buscar(String Consulta, Expediente MiExp)//buscando expediente
        {
            Datos         selecciona = new Datos();
            SqlDataReader lector;

            if (selecciona.Conectar())
            {
                selecciona.construye_reader(Consulta);
                lector = selecciona.ejecuta_reader();

                if (lector.Read() == true)//verifica que el data reader tengan datos aunque sean null
                {
                    do
                    {
                        if (!(lector.IsDBNull(0))) //veririfca que no sean datos null
                        {
                            MiExp.Clasificación           = lector.GetString(0);
                            MiExp.idFondo                 = lector.GetString(1);
                            MiExp.idseccion               = lector.GetString(2);
                            MiExp.idserie                 = lector.GetString(3);
                            MiExp.no_exp                  = lector.GetInt32(4);
                            MiExp.año                     = lector.GetInt32(5);
                            MiExp.id_unid_admva_resp      = lector.GetString(6);
                            MiExp.id_area_prod            = lector.GetString(7);
                            MiExp.id_resp_exp             = lector.GetString(8);
                            MiExp.resumen_exp             = lector.GetString(9);
                            MiExp.asunto_exp              = lector.GetString(10);
                            MiExp.funcion_exp             = lector.GetString(11);
                            MiExp.acceso_exp              = lector.GetString(12);
                            MiExp.val_prim_exp            = lector.GetString(13);
                            MiExp.fec_ext_ini_exp         = lector.GetDateTime(14);
                            MiExp.fec_ext_fin_exp         = lector.GetDateTime(15);
                            MiExp.no_legajo_exp           = lector.GetInt32(16);
                            MiExp.no_fojas_exp            = lector.GetInt32(17);
                            MiExp.vinc_otro_exp           = lector.GetString(18);
                            MiExp.id_exp_vincd            = lector.GetString(19);
                            MiExp.formato_Soporte         = lector.GetString(20);
                            MiExp.plazo_conservacion_exp  = lector.GetInt32(21);
                            MiExp.tipo_exp                = lector.GetString(22);
                            MiExp.destino_final_exp       = lector.GetString(23);
                            MiExp.valores_secundarios_exp = lector.GetString(24);
                            MiExp.id_ubic_topog           = lector.GetString(25);
                            MiExp.IdEdificio              = lector.GetString(26);
                            MiExp.IdPisoEd                = lector.GetString(27);
                            MiExp.IdPasillo               = lector.GetString(28);
                            MiExp.IdEstante               = lector.GetString(29);
                            MiExp.IdCharola               = lector.GetString(30);
                            MiExp.IdUnidInsCaja           = lector.GetString(31);
                            MiExp.fecha_alta_exp          = lector.GetDateTime(32);
                            MiExp.id_capturista_exp       = lector.GetString(33);
                            MiExp.id_autorizador_exp      = lector.GetString(34);
                        }
                    } while (lector.Read());
                    selecciona.desconectar();
                    selecciona.dr.Close();

                    return(MiExp);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }