public static void consultarTarjetas()
        {
            if (GestorArchivos.Leer("Tarjetas.txt") is null)
            {
                throw new NonCards("No existen tarjetas en el sistema");
            }

            Console.WriteLine(GestorArchivos.Leer("Tarjetas.txt"));
        }
Exemple #2
0
        public static void jugar()
        {
            Console.Write("Nombre del juego: ");
            string juego = Console.ReadLine();

            if (GestorArchivos.Buscar("Juegos.txt", juego))
            {
                Console.WriteLine("Listo para jugar!");
            }
            else
            {
                Console.WriteLine("Primero debe comprar el juego :(");
            }
        }
        public static void registrarTarjeta()
        {
            Console.Write("Número de tarjeta: ");
            string numero = Console.ReadLine();

            if (GestorArchivos.Buscar("Tarjetas.txt", numero))
            {
                throw new ExistCardException("La tarjeta ya existe");
            }

            try
            {
                GestorArchivos.Anexar("Tarjetas.txt", numero);
                Console.WriteLine("Tarjeta creada exitosamente!");
            }
            catch
            {
                throw new Exception("No se pudo guardar la tarjeta, por favor intentelo mas tarde...");
            }
        }
Exemple #4
0
        public static void comprarJuego()
        {
            Console.Write("Número de tarjeta: ");
            string numero = Console.ReadLine();

            if (Banco.realizarCompras(numero))
            {
                Console.Write("Nombre del juego: ");
                string juego = Console.ReadLine();
                if (GestorArchivos.Buscar("Juegos.txt", juego))
                {
                    throw new ExistGameException("Ya tienes este juego");
                }
                GestorArchivos.Anexar("Juegos.txt", juego);

                Console.WriteLine("Juego comprado exitosamente!");
            }
            else
            {
                throw new NonExistCardException("La tarjeta no Existe");
            }
        }
 public static bool realizarCompras(string tarjeta)
 {
     return(GestorArchivos.Buscar("Tarjetas.txt", tarjeta));
 }