public Ventas(int ventasId, string tipoPago, decimal valor, decimal devuelta, decimal itebisVenta, decimal subTotalVenta, decimal totalVenta) { VentasId = ventasId; TipoPago = tipoPago; Valor = valor; Devuelta = devuelta; ItebisVenta = itebisVenta; SubTotalVenta = subTotalVenta; TotalVenta = totalVenta; Detalle = new VentasDetalle(); }
public void AgregarDetalle(int IdProducto, int Cantidad, float Precio, int IdOferta) { VentasDetalle det = new VentasDetalle(); det.IdProducto = IdProducto; det.Cantidad = Cantidad; det.Precio = Precio; det.IdOferta = IdOferta; this.Detalle.Add(det); }
public Ventas() { VentasId = 0; TipoPago = string.Empty; Valor = 0; Devuelta = 0; ItebisVenta = 0; SubTotalVenta = 0; TotalVenta = 0; Detalle = new VentasDetalle(); }
public override bool Insertar() { ConexionDb conexion = new ConexionDb(); VentasDetalle ventasdetalle = new VentasDetalle(); bool retorno = false; try { conexion.ObtenerDatos(string.Format("insert into Ventas(VentaId, Fecha, Monto) Values('" + this.VentaId + "','" + this.Fecha + "','" + this.Monto + "')Select @@Identity")); foreach (VentasDetalle item in Tipo) { conexion.Ejecutar(string.Format("insert into VentasDetalles(Id, VentaId, ArticuloId, Cantidad, Precio) Values({1},{2},{3})", retorno, (int)item.Cantidad, (float)item.Precio)); } } catch (Exception e) { throw e; } return(retorno); }