static void AgregarIndumentaria(TiendaRopa tienda) { string varianteIndumentaria = ConsoleHelpers.PedirString("una opción: \n Pantalon(P) \n Camisa(C) \n"); if (varianteIndumentaria.ToUpper() == "P") { int codigo = tienda.GetProximoCodigo(); TipoIndumentaria tipo = new IndumentariaCasual(); string talle = ConsoleHelpers.PedirString("un talle"); double precio = ConsoleHelpers.PedirDouble("el precio"); int material = ConsoleHelpers.PedirInt("un material (Códigos \n Algodón(1) \n Polyester(2)"); Indumentaria nuevaIndumentaria = new Pantalon(codigo, talle, precio, material, true); tienda.Agregar(nuevaIndumentaria); } else if (varianteIndumentaria == "C") { int codigo = tienda.GetProximoCodigo(); TipoIndumentaria tipo = new IndumentariaFormal(); string talle = ConsoleHelpers.PedirString("un talle"); double precio = ConsoleHelpers.PedirDouble("el precio"); int tipoManga = ConsoleHelpers.PedirInt("un tipo de manga (Códigos \n Corta(1) \n Larga(2)"); Indumentaria nuevaIndumentaria = new Camisa(codigo, talle, precio, false, tipoManga); tienda.Agregar(nuevaIndumentaria); } else { Console.WriteLine("No existe la indumentaria elegida"); } }
static void AgregarIndumentaria(TiendaRopa tiendaRopa) { Console.WriteLine("\n******************** AGREGAR INDUMENTARIA ********************\n"); string texto; int booleanoNumero; bool booleano; int tipoIndumentaria = Validaciones.Entero("tipo de indumentaria (1-Casual | 2-Deportiva | 3-Formal)", 1, 3); int claseIndumentaria = Validaciones.Entero("1-Camisa | 2-Pantalon)", 1, 2); string talle = Validaciones.Texto("talle").ToUpper(); double precio = Validaciones.Importe("precio", 1, 999999); if (claseIndumentaria == 1) { texto = Validaciones.Texto("tipo de manga"); booleanoNumero = Validaciones.Entero("tiene estampado? (1-SI | 2-NO)", 1, 2); } else { texto = Validaciones.Texto("material"); booleanoNumero = Validaciones.Entero("tiene bolsillos? (1-SI | 2-NO)", 1, 2); } if (booleanoNumero == 1) { booleano = true; } else { booleano = false; } string origen = Validaciones.Texto("origen"); double porcentaje = Validaciones.Importe("porcentaje", 1, 100); try { tiendaRopa.Agregar(tipoIndumentaria, claseIndumentaria, talle, precio, texto, booleano, origen, porcentaje); Console.WriteLine("El producto se agrego con exito!"); } catch (Exception e) { Console.WriteLine("Error - " + e.Message); } }
private static void InsertarIndumentaria(TiendaRopa tienda) { bool bolsillo = false; bool estampado = false; string material = ""; string bolsillos = ""; string tipomanga = ""; string estampados = ""; string talle = ServValidac.PedirStrNoVac("Ingrese un talle de indumentaria"); double precio = ServValidac.PedirDouble("Ingrese un precio de indumentaria"); double porcentajeAlgodon = ServValidac.PedirDouble("Ingrese un porcentaje algodon de indumentaria"); string origen = ServValidac.PedirStrNoVac("Ingrese un origen de indumentaria"); string opciontipoindumentaria = ServValidac.PedirStrNoVac("Ingrese el tipo de indumentaria: D - Deportiva \t C - Casual \t F - Formal"); int opcionropa = ServValidac.PedirInt("Ingrese la prenda: 1 - pantalon \t 2 - Camisa"); if (opcionropa == 1) { material = ServValidac.PedirStrNoVac("Ingrese un material del pantalon"); bolsillos = ServValidac.PedirStrNoVac("Tiene bolsillo? 1 - SI \t 2 - NO"); if (bolsillos == "1") { bolsillo = true; } else { bolsillo = false; } } else if (opcionropa == 2) { tipomanga = ServValidac.PedirStrNoVac("Ingrese un tipo de manga de la camisa"); estampados = ServValidac.PedirStrNoVac("Tiene estampado? 1 - SI \t 2 - NO"); if (estampados == "1") { estampado = true; } else { estampado = false; } } tienda.Agregar(opciontipoindumentaria, opcionropa, talle, precio, origen, porcentajeAlgodon, tipomanga, estampado, material, bolsillo); Console.WriteLine("indumentaria agregada"); }
static void CargasIniciales(TiendaRopa tiendaRopa) { tiendaRopa.CargaInicialClientes("Gonzalo", "Carranza"); tiendaRopa.CargaInicialClientes("Sofia", "Carranza"); tiendaRopa.CargaInicialClientes("Andrea", "Amatrudo"); tiendaRopa.CargaInicialClientes("Roberto", "Sanchez"); tiendaRopa.Agregar(1, 1, "S", 200, "Corta", true, "Argentina", 90); tiendaRopa.Agregar(3, 1, "M", 1000, "Larga", false, "Chile", 70); tiendaRopa.Agregar(1, 2, "S", 500, "Algodon", false, "Indonesia", 90); tiendaRopa.Agregar(2, 2, "M", 600, "Tela Avion", false, "Indonesia", 70); tiendaRopa.Agregar(3, 2, "L", 800, "Laycra", true, "Costa Rica", 50); tiendaRopa.Agregar(3, 2, "S", 800, "Laycra", true, "Costa Rica", 50); }
static void Main(string[] args) { TiendaRopa tienda = new TiendaRopa(); bool continuar = true; int opcion; string menu = "Ingrese: \n1) Listar Indumentarias \n2) Agregar Indumentaria \n3) Modificar Indumentaria \n4) Eliminar Indumentaria \n5) Listar Ordenes \n6) Ingresar Orden \n7) Devolver Orden \n8) Salir"; Console.WriteLine("Bienvenido"); do { Console.WriteLine(menu); opcion = Validacion.PedirEntero(Console.ReadLine()); switch (opcion) { case 1: foreach (Indumentaria item in tienda.Listar()) { item.GetDetalle(); } break; case 2: TipoIndumentaria t_indumentaria; do { string origen = Validacion.PedirString("Ingrese origen"); double porcentaje_algodon = Validacion.PedirDouble("Ingrese porcentaje de algodon"); int tipo = Validacion.PedirEntero("Ingrese tipo de indumentaria: \n1) Deportiva \n2) Casual \n3) Formal"); switch (opcion) { case 1: t_indumentaria = new IndumentariaDeportiva(origen, porcentaje_algodon); continuar = false; break; case 2: t_indumentaria = new IndumentariaCasual(origen, porcentaje_algodon); continuar = false; break; case 3: t_indumentaria = new IndumentariaFormal(origen, porcentaje_algodon); continuar = false; break; default: Console.WriteLine(""); break; } } while (continuar); continuar = true; do { string talle; int stock = Validacion.PedirEntero("Ingrese el stock"); do { talle = Validacion.PedirString("Ingrese talle: L, M o S"); if (talle.ToLower() == "l" && talle.ToLower() == "m" && talle.ToLower() == "s") { continuar = false; } else { continuar = true; Console.WriteLine("Opcion Incorrecta"); } } while (continuar); continuar = true; double precio = Validacion.PedirDouble("Ingrese el precio"); opcion = Validacion.PedirEntero("Ingrese: \n1) Camisa \n2) Pantalon"); switch (opcion) { case 1: bool estampado = Validacion.PedirBool("Tiene estampado?"); string tipo_manga = Validacion.PedirString("Ingresar tipo manga"); tienda.Agregar(new Camisa(tipo_manga, estampado, stock, talle, precio, t_indumentaria)); break; case 2: string material = Validacion.PedirString("Ingrese material"); bool bolsillos = Validacion.PedirBool("Tiene bolsillos?"); tienda.Agregar(new Pantalon(material, bolsillos, stock, talle, precio, t_indumentaria)); break; default: Console.WriteLine("Opicon Incorrecta"); break; } } while (continuar); continuar = true; Console.WriteLine("Prenda agregada..."); break; case 8: continuar = false; break; default: Console.WriteLine("Opcion Incorrecta"); break; } } while (continuar); Console.WriteLine("Hasta luego!"); }