public MovimientoColeccion LeerTodos(string idSiniestro)
 {
     try
     {
         MovimientoColeccion lista = new MovimientoColeccion();
         OracleConnection    con;
         string conStr = "SELECT * FROM MOVIMIENTO WHERE SINIESTRO_id_siniestro = '" + idSiniestro + "'";
         con = CommonBC.Con;
         con.Open();
         OracleCommand cmd = new OracleCommand();
         cmd.CommandText = conStr;
         cmd.Connection  = con;
         cmd.CommandType = CommandType.Text;
         OracleDataReader dr = cmd.ExecuteReader();
         while (dr.Read())
         {
             Movimiento mov = new Movimiento()
             {
                 Id_Movimiento = dr.GetString(0)
             };
             mov.Leer();
             lista.Add(mov);
         }
         return(lista);
     }
     catch (Exception)
     {
         return(null);
     }
 }
        public MovimientoColeccion(string xml)
        {
            XmlSerializer       serializador = new XmlSerializer(typeof(MovimientoColeccion));
            StringReader        reader       = new StringReader(xml);
            MovimientoColeccion lista        = (MovimientoColeccion)serializador.Deserialize(reader);

            this.AddRange(lista);
        }
Пример #3
0
        public bool Leer()
        {
            try
            {
                string           cmd = "SELECT * FROM SINIESTRO WHERE ID_SINIESTRO = '" + this.Id_Siniestro + "'";
                OracleDataReader dr  = CommonBC.OracleDataReader(cmd);
                this.Fecha     = dr.GetDateTime(1);
                this.Direccion = dr.GetString(3);
                this.Estado    = dr.GetString(4);
                this.Patente   = dr.GetString(7);

                Empleado empleado = new Empleado()
                {
                    Id_Empleado = dr.GetString(8)
                };
                empleado.Leer();
                this.Empleado = empleado;
                Ciudad ciudad = new Ciudad()
                {
                    Id_ciudad = dr.GetInt32(9)
                };
                ciudad.Leer();
                this.Ciudad = ciudad;
                Taller taller = new Taller()
                {
                    Id_Taller = dr.GetString(11)
                };
                taller.Leer();
                this.Taller = taller;

                MovimientoColeccion movimientoColeccion = new MovimientoColeccion();
                this.MovimientoColeccion = movimientoColeccion.LeerTodos(this.Id_Siniestro);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }