示例#1
0
        static void DevolverOrden(TiendaRopa T)
        {
            // Mostrarle la lista de ordenes
            try
            {
                if (T.ListarOrdenes().Count == 0)
                {
                    throw new Exception("Lista Vacia de ordenes");
                }
                else
                {
                    ConsolaHelper.MostrarMensaje("LISTA DE ORDENES");
                    foreach (Venta V in T.ListarOrdenes())
                    {
                        ConsolaHelper.MostrarMensaje(V.ToString());
                    }
                }

                //ingresar cual quiere devolver

                string _strorden;
                int    _orden = 0;
                bool   flag   = false;
                do
                {
                    _strorden = ConsolaHelper.PedirOrden();
                    flag      = Validaciones.ValidarCliente(_strorden, ref _orden);
                } while (!flag);

                Venta Ve  = T.BuscarVenta(_orden);
                Venta mod = null;
                foreach (Venta V  in T.ListarOrdenes())
                {
                    if (V.Equals(Ve))
                    {
                        mod = Ve;
                    }
                }

                if (mod is null)
                {
                    throw new Exception("Venta inexistente");
                }
                else
                {
                    T.DevolerOrden(mod);
                    ConsolaHelper.MostrarMensaje("Venta devuelta con exito");
                }
            }
            catch (Exception e)
            {
                ConsolaHelper.MostrarMensaje(e.Message);
            }
        }