private void btnAgregar_Click(object sender, EventArgs e) { Producto.Origen origen; string nombre; int valorDeCompra; bool descuento; int.TryParse(this.txtValorCompra.Text, out valorDeCompra); nombre = this.txtNombre.Text; Enum.TryParse <Producto.Origen>(this.cmbOrigen.SelectedValue.ToString(), out origen); descuento = this.rdDescuento.Checked; Producto p; if (this.rdLinea.Checked) { p = new LineaBlanca(nombre, valorDeCompra, origen, descuento); } else { p = new Smartphone(nombre, valorDeCompra, origen); } this.empresa += p; }
private void btnAgregarProductos_Click(object sender, EventArgs e) { //cmbBotellaTipo.DataSource = Enum.GetValues(typeof(Botella.Tipo)); int valor; Producto.Origen origenEnum; int.TryParse(txtValorDeCompra.Text, out valor); Enum.TryParse <Producto.Origen>(cmbOrigen.Text, out origenEnum); if (cmbTipo.Text == "Smartphone") { Smartphone smf = new Smartphone(txtNombreProducto.Text, valor, origenEnum); empresa = empresa + smf; MessageBox.Show("Agregado"); } else if (cmbTipo.Text == "LineaBlanca") { LineaBlanca lb = new LineaBlanca(txtNombreProducto.Text, valor, origenEnum); empresa = empresa + lb; MessageBox.Show("Agregado"); } }
private void btnAgregarProducto_Click(object sender, EventArgs e) { string nombreProducto = txtNombreProducto.Text; int precioDeCompra; Enum.TryParse <Producto.Origen>(cmbOrigen.SelectedValue.ToString(), out origenSeleccionado); if (string.IsNullOrWhiteSpace(txtNombreProducto.Text) && int.TryParse(txtValorDeCompraProducto.Text, out precioDeCompra)) { Producto productoNuevo; if (rbtnLineaBlanca.Checked) { productoNuevo = new LineaBlanca(nombreProducto, precioDeCompra, origenSeleccionado); } else { productoNuevo = new Smartphone(nombreProducto, precioDeCompra, origenSeleccionado); } miEmpresa += productoNuevo; MessageBox.Show("El producto se agrego con exito"); } LineaBlanca aux1 = new LineaBlanca("heladera", 1500, Producto.Origen.Importado, true); LineaBlanca aux2 = new LineaBlanca("heladera", 3200, Producto.Origen.Nacional); LineaBlanca aux3 = new LineaBlanca("heladera", 7450, Producto.Origen.Importado); Smartphone sm1 = new Smartphone("s7", 2000, Producto.Origen.Importado); Smartphone sm2 = new Smartphone("s7", 5545, Producto.Origen.Importado); Smartphone sm3 = new Smartphone("s7", 1000, Producto.Origen.Importado); miEmpresa += aux1; miEmpresa += aux2; miEmpresa += aux3; miEmpresa += sm1; miEmpresa += sm2; miEmpresa += sm3; }
void Start() { Debug.Log("Bienvenido a Hiraoka"); Debug.Log("Tenemos estos productos en oferta!"); Audio Radio = new Audio(3, true, true, 1.4f, 12.4f, 35.50f); Audio HomeTheatre = new Audio(3, true, true, 1.4f, 12.4f, 35.50f); Audio InstrumentosMusicale = new Audio(3, true, true, 1.4f, 12.4f, 35.50f); Audio ReproductoresMultimedia = new Audio(3, true, true, 1.4f, 12.4f, 35.50f); Audio Grabadora = new Audio(3, true, true, 1.4f, 12.4f, 35.50f); Audio Audifono = new Audio(3, true, true, 1.4f, 12.4f, 35.50f); Audio Parlante = new Audio(3, true, true, 1.4f, 12.4f, 35.50f); Audio Linterna = new Audio(3, true, true, 1.4f, 12.4f, 35.50f); Audio Microfono = new Audio(3, true, true, 1.4f, 12.4f, 35.50f); Video Bluray = new Video(4, 5, true, 1.5f, 4.6f, 78.60f); Video Dvd = new Video(4, 5, true, 1.5f, 4.6f, 78.60f); Video CamaraDeVideo = new Video(4, 5, true, 1.5f, 4.6f, 78.60f); Video Televisore = new Video(4, 5, true, 1.5f, 4.6f, 78.60f); Dispositivos Celulare = new Dispositivos(4, 5, true, true, 1.5f, 4.6f, 78.60f, 5.6f, "rectangular"); Dispositivos Smartphone = new Dispositivos(4, 5, true, true, 1.5f, 4.6f, 78.60f, 5.6f, "rectangular"); Dispositivos Telefono = new Dispositivos(4, 5, true, true, 1.5f, 4.6f, 78.60f, 5.6f, "rectangular"); Accesorios Case = new Accesorios("rojo", 1.5f, 4.6f, 78.60f, 5.6f, "rectangular"); Accesorios SelfieStick = new Accesorios("rojo", 1.5f, 4.6f, 78.60f, 5.6f, "rectangular"); Accesorios Grip = new Accesorios("rojo", 1.5f, 4.6f, 78.60f, 5.6f, "rectangular"); Electrohogar Ventiladore = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar MaquinaDeCoser = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Tensiometro = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Estetoscopio = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Termometro = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Balanza = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Batidora = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Cafetera = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Licuadora = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Plancha = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Sandwichera = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Tostadora = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Electrohogar Aspiradora = new Electrohogar(3, true, true, 1.4f, 12.4f, 35.50f, "redonda"); Tecnologia Consola = new Tecnologia(3, 4, true, true, 1.4f, 12.4f, 35.50f, "cuadrada"); Tecnologia Videojuego = new Tecnologia(3, 4, true, true, 1.4f, 12.4f, 35.50f, "cuadrada"); Tecnologia Impresora = new Tecnologia(3, 4, true, true, 1.4f, 12.4f, 35.50f, "cuadrada"); Tecnologia Proyectore = new Tecnologia(3, 4, true, true, 1.4f, 12.4f, 35.50f, "cuadrada"); Tecnologia AccesorioDePC = new Tecnologia(3, 4, true, true, 1.4f, 12.4f, 35.50f, "cuadrada"); Tecnologia Laptop = new Tecnologia(3, 4, true, true, 1.4f, 12.4f, 35.50f, "cuadrada"); Tecnologia Tablet = new Tecnologia(3, 4, true, true, 1.4f, 12.4f, 35.50f, "cuadrada"); Tecnologia CPU = new Tecnologia(3, 4, true, true, 1.4f, 12.4f, 35.50f, "cuadrada"); Tecnologia Calculadora = new Tecnologia(3, 4, true, true, 1.4f, 12.4f, 35.50f, "cuadrada"); LineaBlanca Lavadora = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); LineaBlanca Secadora = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); LineaBlanca Refrigerador = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); LineaBlanca Congelador = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); LineaBlanca DispensadoreDeAgua = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); LineaBlanca Horno = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); LineaBlanca Cocina = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); LineaBlanca AireAcondicionado = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); LineaBlanca Estufa = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); LineaBlanca SecadoraDeMano = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); LineaBlanca PurificadorDeAire = new LineaBlanca(3, true, 1.4f, 12.4f, 35.50f, 42.6f, "redonda"); Debug.Log("Tenemos la radio en oferta a tan solo s/." + Radio.precio); Debug.Log("Además tenemos esta tablet a tan solo s/." + Tablet.precio); Debug.Log("Tambien disponemos de este case de color " + Case.color); Debug.Log("¿Desea comrpar o hacer mantenimiento?"); }