private void LeerAlmacenes() { String id; FileStream fs = new FileStream("Almacenes.txt", FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs); while ((id = sr.ReadLine()) != null) { AlmacenVirtual alm = new AlmacenVirtual(Int32.Parse(id), sr.ReadLine(), sr.ReadLine()); almacenes.Add(alm); } sr.Close(); fs.Close(); }
public Pedido(long id_pedido, DateTime fecha_produccion, DateTime fecha_entrega, string hora_entrega, Usuario responsable, TEstado estado, TTipoPedido tipo_pedido, AlmacenVirtual almacen, Area area, double monto, double monto_igv, double total) { this.Id_pedido = id_pedido; this.Fecha_produccion = fecha_produccion; this.Fecha_entrega = fecha_entrega; this.Hora_entrega = hora_entrega; this.Responsable = responsable; this.Estado = estado; this.Tipo_pedido = tipo_pedido; this.Almacen = almacen; this.Area = area; this.Monto = monto; this.Monto_igv = monto_igv; this.Total = total; this.detalles = new List <DetallePedido>(); }
private void LeerDatosPedidos() { String id; FileStream fs = new FileStream("Pedidos.txt", FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs); while ((id = sr.ReadLine()) != null) { Pedido ped = new Pedido(); ped.Id_pedido = Int32.Parse(id); ped.Estado = (TEstado)Enum.Parse(typeof(TEstado), sr.ReadLine()); ped.Fecha_entrega = DateTime.Parse(sr.ReadLine()); ped.Hora_entrega = sr.ReadLine(); ped.Fecha_produccion = DateTime.Parse(sr.ReadLine()); ped.Tipo_pedido = (TTipoPedido)Enum.Parse(typeof(TTipoPedido), sr.ReadLine()); Operario responsable = new Operario(); responsable.Nombre = sr.ReadLine(); responsable.Apellidos = sr.ReadLine(); ped.Responsable = responsable; AlmacenVirtual almac = new AlmacenVirtual(); almac.NomAlmacen = sr.ReadLine(); ped.Almacen = almac; Area area = new Area(); area.NombreArea = sr.ReadLine(); ped.Area = area; ped.Monto = Double.Parse(sr.ReadLine()); ped.Monto_igv = Double.Parse(sr.ReadLine()); if (ped.Estado == TEstado.Pendiente) { pedidos.Add(ped); } } sr.Close(); fs.Close(); }