public NuevoIngredienteForm(DetalleProductos dp, INGREDIENTE_OPCIONAL_EN_COMANDA relIngProd) { InitializeComponent(); this.parentForm = dp; this.relIngProd = relIngProd; }
private void ingredienteAdicionalSeleccionado(object sender, EventArgs e) { Button button = sender as Button; Console.WriteLine(" Ingrediente adicional key " + button.Name); int intCveRelIngredienteAdicional = (Int32.Parse(button.Name)); foreach( REL_INGREDIENTES_OP_PRODUCTOS relIngProd in listaIngredientesOpcionales) { if( relIngProd.INT_CVE_REL_INGREDIENTE_OP_PROD == intCveRelIngredienteAdicional) { foreach(INGREDIENTE_OPCIONAL_EN_COMANDA prodInComanda in listaIngredientesOpcionalesSeleccionados) { REL_INGREDIENTES_OP_PRODUCTOS relIngProdSel = prodInComanda.relIngOpProducto; if ( relIngProdSel.INT_CVE_REL_INGREDIENTE_OP_PROD == intCveRelIngredienteAdicional) { MessageBox.Show("El ingrediente " + relIngProdSel.CAT_INGREDIENTES_OPCIONALES.TXT_NOMBRE_INGREDIENTE_OPCIONAL + " ya fue agreado con anterioridad a la órden. "); return; } } //Si el ingrediente opcional es un otros, se despliega y solicita un detalle del mismo if (relIngProd.CAT_INGREDIENTES_OPCIONALES.B_COSTO_POR_DEFINIR == DominioAppConstantes.B_ACTIVO) { INGREDIENTE_OPCIONAL_EN_COMANDA prodInComanda = new INGREDIENTE_OPCIONAL_EN_COMANDA(); prodInComanda.relIngOpProducto = relIngProd; NuevoIngredienteForm nIF = new NuevoIngredienteForm(this, prodInComanda); //this.Hide(); nIF.Show(); this.Enabled = false; } else { INGREDIENTE_OPCIONAL_EN_COMANDA prodInComanda = new INGREDIENTE_OPCIONAL_EN_COMANDA(); prodInComanda.relIngOpProducto = relIngProd; listaIngredientesOpcionalesSeleccionados.Add(prodInComanda); //Costo directo de catálogo ingredientesAdicionalesListBox.Items.Add(relIngProd.CAT_INGREDIENTES_OPCIONALES.TXT_NOMBRE_INGREDIENTE_OPCIONAL + " + $ " + relIngProd.NUM_COSTO_INGREDIENTE); costoTotalProducto = costoTotalProducto + (float)relIngProd.NUM_COSTO_INGREDIENTE; } } } actualizarCostoTotalProducto(); }
public void actualizarIngredienteOpcionalOtroSeleccionado( INGREDIENTE_OPCIONAL_EN_COMANDA prodInComanda) { ingredientesAdicionalesListBox.Items.Add(prodInComanda.txtDescripcionAdicional + " + $ " + prodInComanda.costo); costoTotalProducto = costoTotalProducto + (float)prodInComanda.costo; listaIngredientesOpcionalesSeleccionados.Add(prodInComanda); actualizarCostoTotalProducto(); }
/** Método que almavena el detalle de venta de ingredientes de un producto **/ public WRK_DETALLES_VENTA_ING_PROD guardaWrkDetalleVentaIngProd(WRK_DETALLES_VENTAS wrkDetalleVenta, INGREDIENTE_OPCIONAL_EN_COMANDA ingOpComanda) { WRK_DETALLES_VENTA_ING_PROD wrkDetalleVentaIngProdASerAlmacenado = null; //using (var context = this.context) //{ wrkDetalleVentaIngProdASerAlmacenado = new WRK_DETALLES_VENTA_ING_PROD(); wrkDetalleVentaIngProdASerAlmacenado.INT_CVE_DETALLE_VENTA = wrkDetalleVenta.INT_CVE_DETALLE_VENTA; wrkDetalleVentaIngProdASerAlmacenado.INT_CVE_REL_INGREDIENTE_OP_PRODUCTO = ingOpComanda.relIngOpProducto.INT_CVE_REL_INGREDIENTE_OP_PROD; //Si el ingrediente opcional es diferente y mayor a 0 entoncs se agrega a la base de datos if(ingOpComanda.txtDescripcionAdicional != null && ingOpComanda.txtDescripcionAdicional.Trim().Length > 0) { wrkDetalleVentaIngProdASerAlmacenado.NUM_COSTO_OTRO_INGREDIENTE = (float)ingOpComanda.costo; wrkDetalleVentaIngProdASerAlmacenado.TXT_DESC_OTRO_INGREDIENTE = ingOpComanda.txtDescripcionAdicional; } //Se Almacena el detalle de la venta por ingrediente de producto context.WRK_DETALLES_VENTA_ING_PROD.Add(wrkDetalleVentaIngProdASerAlmacenado); //context.SaveChanges(); Console.WriteLine("Se almacena el detalle de los ingredientes opcionales por venta " + wrkDetalleVentaIngProdASerAlmacenado.INT_CVE_REL_INGREDIENTE_OP_PRODUCTO); //} return wrkDetalleVentaIngProdASerAlmacenado; }