コード例 #1
0
 public void agregar(Obra o)
 {
     datos.actualizarDB("insert into Obras(nombre,id_estilo,id_tipo_obra,id_artista,descripcion,dimension,valuacion,estado_obra,disponible,fecha_creacion)" +
                        "values('" + o.Nombre + "', " + o.Estilo.Id + ", " + o.TipoObra.Id + ", " + o.Artista.IdArtista + ", '" + o.Descripcion + "', '" + o.Dimension + "', " + Convert.ToDecimal(o.Valuacion) + ", '" + o.EstadoObra + "', " + Convert.ToInt32(o.Disponibilidad) + " , " + "'" + o.FechaCreacion + "')");
 }
コード例 #2
0
        private List <Obra> ObtenerObras(String query)
        {
            List <Obra> lista = new List <Obra>();

            datos.leerTabla2(query);
            while (datos.pLector.Read())
            {
                Obra o = new Obra();
                if (!datos.pLector.IsDBNull(0))
                {
                    o.Codigo = datos.pLector.GetInt32(0);
                }
                if (!datos.pLector.IsDBNull(1))
                {
                    o.Nombre = datos.pLector.GetString(1);
                }
                if (!datos.pLector.IsDBNull(2))
                {
                    o.Estilo.Id = datos.pLector.GetInt32(2);
                }
                if (!datos.pLector.IsDBNull(3))
                {
                    o.Estilo.NombreEstilo = datos.pLector.GetString(3);
                }
                if (!datos.pLector.IsDBNull(4))
                {
                    o.TipoObra.Id = datos.pLector.GetInt32(4);
                }
                if (!datos.pLector.IsDBNull(5))
                {
                    o.TipoObra.NombreTipoObra = datos.pLector.GetString(5);
                }
                if (!datos.pLector.IsDBNull(6))
                {
                    o.Artista.IdArtista = datos.pLector.GetInt32(6);
                }
                if (!datos.pLector.IsDBNull(7))
                {
                    o.Artista.NombreArtista = datos.pLector.GetString(7);
                }
                if (!datos.pLector.IsDBNull(8))
                {
                    o.Descripcion = datos.pLector.GetString(8);
                }
                if (!datos.pLector.IsDBNull(9))
                {
                    o.Dimension = datos.pLector.GetString(9);
                }
                if (!datos.pLector.IsDBNull(10))
                {
                    o.Valuacion = datos.pLector.GetFloat(10);
                }
                if (!datos.pLector.IsDBNull(11))
                {
                    o.EstadoObra = datos.pLector.GetString(11);
                }
                if (!datos.pLector.IsDBNull(12))
                {
                    o.Disponibilidad = datos.pLector.GetBoolean(12);
                }
                if (!datos.pLector.IsDBNull(13))
                {
                    o.FechaCreacion = datos.pLector.GetString(13);
                }
                lista.Add(o);
            }
            datos.desconectar();
            return(lista);
        }
コード例 #3
0
 public Locker()
 {
     obra         = new Obra();
     fechaIngreso = DateTime.Today.ToString("dd/MM/yy");
     fechaEgreso  = "";
 }