public WRK_DETALLES_VENTAS guardaDetalleVenta(WRK_VENTAS wrkVenta, EntProductoComanda entProductoComanda) { WRK_DETALLES_VENTAS wrkDetalleVentaASerAlmacenado = null; //using (var context = this.context) //{ wrkDetalleVentaASerAlmacenado = new WRK_DETALLES_VENTAS(); wrkDetalleVentaASerAlmacenado.INT_CVE_VENTA = wrkVenta.INT_CVE_VENTA; wrkDetalleVentaASerAlmacenado.INT_CVE_PRODUCTO = entProductoComanda.getCatProducto().INT_CVE_PRODUCTO; wrkDetalleVentaASerAlmacenado.NUM_COSTO_PRODUCTO = (float)entProductoComanda.getCostoTotalProducto(); //Se almacena el detalle de cada venta por producto context.WRK_DETALLES_VENTAS.Add(wrkDetalleVentaASerAlmacenado); //context.SaveChanges(); Console.WriteLine("Se almaceno el detalle de venta con éxito "); foreach(INGREDIENTE_OPCIONAL_EN_COMANDA ingOpComanda in entProductoComanda.getListaIngredientesAdicionales()) { //Almacena el ingediente de venta producto guardaWrkDetalleVentaIngProd(wrkDetalleVentaASerAlmacenado, ingOpComanda); } //} return wrkDetalleVentaASerAlmacenado; }
/** Boton AGREGAR PRODUCTO A CUENTA **/ private void button1_Click(object sender, EventArgs e) { //Se creal el nuevo producto a ser agregado en la comanda EntProductoComanda entProductoComandaNuevo = new EntProductoComanda(); entProductoComandaNuevo.setCatProducto(catProductoSeleccionado); entProductoComandaNuevo.setListaIngrecientesAdicionales(listaIngredientesOpcionalesSeleccionados); entProductoComandaNuevo.setCostoTotalProducto(costoTotalProducto); nuevaVentaForm.agregarProductoAComanda(entProductoComandaNuevo); nuevaVentaForm.Enabled = true; nuevaVentaForm.Show(); this.Close(); }
// DATA GRID VIEW METHODS private void addRowProductoAComanda(EntProductoComanda entProductoComanda) { String ingredientesOpcionales = ""; foreach(INGREDIENTE_OPCIONAL_EN_COMANDA ingOpCommanda in entProductoComanda.getListaIngredientesAdicionales()) { REL_INGREDIENTES_OP_PRODUCTOS relIngredientesOpProd = ingOpCommanda.relIngOpProducto; ingredientesOpcionales = ingredientesOpcionales + relIngredientesOpProd.CAT_INGREDIENTES_OPCIONALES.TXT_NOMBRE_INGREDIENTE_OPCIONAL + " , "; } dgvVenta.Rows.Add(entProductoComanda.getCatProducto().INT_CVE_PRODUCTO, entProductoComanda.getCatProducto().TXT_NOMBRE_PRODUCTO , ingredientesOpcionales , "$" + entProductoComanda.getCostoTotalProducto() , "Eliminar"); productosComandaArray.Add(entProductoComanda); recalcularTotal(); }
public void agregarProductoAComanda(EntProductoComanda entProductoComanda) { CAT_PRODUCTOS prod = null; DataGridViewButtonColumn btnBorrar = new DataGridViewButtonColumn(); prod = entProductoComanda.getCatProducto(); btnBorrar.Text = "Eliminar"; btnBorrar.UseColumnTextForButtonValue = true; addRowProductoAComanda(entProductoComanda); }