Exemplo n.º 1
0
        public void GuardarVenta()
        {
            Venta venta = new Venta(2);

            venta.AgregaVentaItem("ABC", "Producto1", 12.44M, 1, 0.1M, 1, Common.Core.Enum.TipoCliente.Minorista, 12.44M, 0.1M, 13.44M, 0);
            //venta.AgregaPago(12.01M, 12.01M, 12.01M, 12.01M, Common.Core.Enum.TipoPago.Cheque, 0.5M, "Visa", 2);
            venta.AgregarComision(0.4M, 0.4M);
            //venta.AgregarFactura(Common.Core.Enum.TipoFactura.Manual, Common.Core.Enum.CondicionIVA.Consumidor_Final, "", "", "", "", new List<int>() { 123, 456 });
            VentaRepository repository = new VentaRepository(new VentaContext());

            repository.Guardar(venta);
        }
Exemplo n.º 2
0
        public static Task Guardar(Model.Venta venta)
        {
            VentaValidador   validador          = new VentaValidador();
            ValidationResult validadorResultado = validador.Validate(venta);

            if (!validadorResultado.IsValid)
            {
                throw new NegocioException(string.Join(Environment.NewLine, validadorResultado.Errors.Select(x => x.ErrorMessage)));
            }

            VentaRepository ventaRepository = new VentaRepository(new Context());

            return(ventaRepository.Guardar(venta));
        }
Exemplo n.º 3
0
        public string Guardar(Venta venta)
        {
            try
            {
                conexion.Open();

                ventaRepository.Guardar(venta);

                return($"se guardaron los datos correctamente ");
            }
            catch (System.Exception eg)
            {
                return("Error de Datos " + eg.Message);
            }
            finally
            {
                conexion.Close();
            }
        }