Ejemplo n.º 1
0
        public Tejido Get(Tejido get)
        {
            conexion.Open();
            Tejido tejido = new Tejido();

            query = new SqlCommand("SELECT * FROM Tejido WHERE Id = @Id", conexion);
            query.Parameters.AddWithValue("Id", get.Id);
            using (SqlDataReader reader = query.ExecuteReader())
            {
                while (reader.Read())
                {
                    tejido.Id                = reader.GetInt32(0);
                    tejido.Codigo            = reader.GetString(1);
                    tejido.Tiempo            = reader.GetInt32(2);
                    tejido.CantidadUtilizada = reader.GetInt32(3);
                    tejido.AreaTela          = reader.GetInt32(4);
                    tejido.Fecha             = reader.GetDateTime(5);
                    tejido.Hilado.Id         = reader.GetInt32(6);
                }
            }
            conexion.Close();
            DALHilado dalHilado = new DALHilado();

            tejido.Hilado = dalHilado.Get(tejido.Hilado);
            return(tejido);
        }
Ejemplo n.º 2
0
        public List <Tejido> GetList()
        {
            conexion.Open();
            List <Tejido> tejidos = new List <Tejido>();

            query = new SqlCommand("Select * From Tejido", conexion);
            using (SqlDataReader reader = query.ExecuteReader())
            {
                while (reader.Read())
                {
                    tejidos.Add(new Tejido(reader.GetInt32(0), reader.GetString(1), reader.GetInt32(3), reader.GetInt32(2), reader.GetInt32(4), reader.GetDateTime(5), new Hilado(reader.GetInt32(6), "", "", 1, 1)));
                }
            }
            conexion.Close();
            DALHilado dalHilado = new DALHilado();

            foreach (var tejido in tejidos)
            {
                tejido.Hilado = dalHilado.Get(tejido.Hilado);
            }
            return(tejidos);
        }
Ejemplo n.º 3
0
        public void RestoreMemento(Hilado hilado)
        {
            DALHilado dalHilado = new DALHilado();

            dalHilado.Modificar(hilado);
        }