コード例 #1
0
ファイル: Program.cs プロジェクト: Mauro300-ops/DSI-2020
        static void Main()
        {
            int continuidad;

            do
            {
                Console.WriteLine("BIENVENIDO A OPENSHOP\n\n");
                Console.WriteLine("1- Ingresar cliente\n");
                Console.WriteLine("2- Cargar tarjeta\n");
                Console.WriteLine("3- Mostrar productos\n");
                Console.WriteLine("4- Generar Json\n");
                var opcion = Int32.Parse(Console.ReadLine());
                GestorProducto.AgregarProducto();
                Console.WriteLine(opcion);

                Console.Clear();

                switch (opcion)
                {
                case 1:

                    GestorCliente.RegistrarCliente();
                    break;

                case 2:

                    GestorTarjeta.RegistrarTarjeta();
                    break;

                case 3:

                    GestorProducto.MostrarTodosProductos();
                    break;


                case 4:

                    OrdenPaga.GenerarOrdenCarrito();
                    break;

                default:
                    break;
                }
                Console.WriteLine("Desea realizar otra accion?");
                Console.WriteLine(" SI[1] - NO[0]");
                continuidad = Int32.Parse(Console.ReadLine());
                Console.Clear();
            } while (continuidad != 0);
        }
コード例 #2
0
ファイル: OrdenPaga.cs プロジェクト: Mauro300-ops/DSI-2020
        public static void GenerarOrdenCarrito()
        {
            const string RUTA_ARCHIVO_JSON = @"c:\datos\orden.json";

            //OrdenJson = OrdenJson.obtenerDatosOrdenDeCompra();

            OrdenPaga ordenConfirmada = new OrdenPaga();

            if (System.IO.File.Exists(RUTA_ARCHIVO_JSON))
            {
                var ordenCompraEnJson = JsonConvert.SerializeObject(ordenConfirmada);
                System.IO.File.WriteAllText("orden.json", ordenCompraEnJson);
            }
            else
            {
                throw new Exception("No es posible exportar los datos debido a su inexistencia");
            }
        }