Example #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Vx520        device  = new Vx520();
            VentaService service = new VentaService(this, 100);

            device.ExecuteService(service);
        }
Example #2
0
        public void DebePoderDevolverUnaListaDeVentas()
        {
            var data = new List <Sale>()
            {
                new Sale {
                    PacienteId = "1", FechaVenta = new DateTime(2019, 2, 2), Total = "10"
                },
                new Sale {
                    PacienteId = "2", FechaVenta = new DateTime(2019, 3, 2), Total = "20"
                },
                new Sale {
                    PacienteId = "3", FechaVenta = new DateTime(2019, 4, 2), Total = "30"
                }
            }.AsQueryable();

            var dbset = new Mock <DbSet <Sale> >();

            dbset.As <IQueryable <Sale> >().Setup(m => m.Provider).Returns(data.Provider);
            dbset.As <IQueryable <Sale> >().Setup(m => m.Expression).Returns(data.Expression);
            dbset.As <IQueryable <Sale> >().Setup(m => m.ElementType).Returns(data.ElementType);
            dbset.As <IQueryable <Sale> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

            var context = new Mock <OpticaContext>();

            context.Setup(a => a.Sales.Include(It.IsAny <string>())).Returns(dbset.Object);

            var ventaService = new VentaService(context.Object);

            var listaVentas = ventaService.Ventas();

            Assert.IsNotNull(listaVentas);
            Assert.AreEqual(3, listaVentas.Count);
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var idVenta = Request.QueryString["IdVenta"];
            var opc     = Request.QueryString["opc"];

            if (!Page.IsPostBack)
            {
                if (idVenta != null && opc.Equals("editar"))
                {
                    ViewState["opc"] = "editar";

                    var id = Int32.Parse(idVenta.ToString());

                    var venta = VentaService.GetVentaById(id);

                    Cache.Insert("venta", venta);

                    BindVenta(venta);
                }
                else if (opc != null && opc == "nuevo")
                {
                    var nuevaenta = new Venta()
                    {
                        Fecha = DateTime.Now
                    };
                    BindVenta(nuevaenta);

                    ViewState["opc"] = opc;
                }
            }
        }
Example #4
0
        public ActionResult getSales(String option, String userName, String month1, String month2, String year)
        {
            VentaService ventaService = new VentaService();
            List <Venta> list         = new List <Venta>();

            if (option == "allSales")
            {
                list = ventaService.getAllSales();
            }
            else if (option == "dateAndClient" && !String.IsNullOrEmpty(userName) && !String.IsNullOrEmpty(month1) && !String.IsNullOrEmpty(month2) && !String.IsNullOrEmpty(year))
            {
                //validando backend
                if (!checkData.CheckIntNumber(month1) || !checkData.CheckIntNumber(month2) || !checkData.CheckIntNumber(year))
                {
                    ViewBag.Msg = "value de <select> incorrecto";
                    return(View());
                }
                else
                {
                    list = ventaService.getSalesByDateAndUser(userName, month1, month2, year);
                }
            }
            else
            {
                ViewBag.Msg = "Error de datos";
                return(View());
            }

            return(View(list));
        }
Example #5
0
 public Form1()
 {
     productoService = new ProductoService();
     clienteService  = new ClienteService();
     vs = new VentaService();
     InitializeComponent();
     mv = new MostrarVenta();
 }
Example #6
0
 private void MostrarVenta_Load(object sender, EventArgs e)
 {
     us = new UsuarioService();
     //Aca listo las ventas
     vs = new VentaService();
     dgvListarVentas.DataSource = vs.listarVentas();
     usuarios = us.traerUsuarios();
 }
Example #7
0
 public frm_venta(double cotizacion)
 {
     InitializeComponent();
     service         = new UnidadService();
     serviceVenta    = new VentaService();
     this.cotizacion = cotizacion;
     detalles        = new List <int>();
 }
        internal async Task ModificarAsync(VentaListadoItem ventaListadoItem)
        {
            ModeloVenta.Venta venta = await VentaService.Obtener(ventaListadoItem.Venta.Id);

            VentaDetalleForm ventaDetalleForm = new VentaDetalleForm(venta);

            ventaDetalleForm.ShowDialog();
            await BuscarAsync();
        }
Example #9
0
        public void DebePoderAgregarUnaVenta()
        {
            var data1 = new List <Sale>()
            {
            }.AsQueryable();

            var data = new List <DetalleVenta>()
            {
            }.AsQueryable();

            var dbset = new Mock <DbSet <DetalleVenta> >();

            dbset.As <IQueryable <DetalleVenta> >().Setup(m => m.Provider).Returns(data.Provider);
            dbset.As <IQueryable <DetalleVenta> >().Setup(m => m.Expression).Returns(data.Expression);
            dbset.As <IQueryable <DetalleVenta> >().Setup(m => m.ElementType).Returns(data.ElementType);
            dbset.As <IQueryable <DetalleVenta> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

            var dbset2 = new Mock <DbSet <Sale> >();

            dbset.As <IQueryable <Sale> >().Setup(m => m.Provider).Returns(data1.Provider);
            dbset.As <IQueryable <Sale> >().Setup(m => m.Expression).Returns(data1.Expression);
            dbset.As <IQueryable <Sale> >().Setup(m => m.ElementType).Returns(data1.ElementType);
            dbset.As <IQueryable <Sale> >().Setup(m => m.GetEnumerator()).Returns(data1.GetEnumerator());

            var context = new Mock <OpticaContext>();

            context.Setup(a => a.DetalleVentas).Returns(dbset.Object);
            context.Setup(a => a.Sales).Returns(dbset2.Object);

            var iVentaService = new Mock <IVentaService>();
            var sale          = new Sale()
            {
                IdSALE = "aa"
            };
            var detalleVenta = new List <DetalleVenta>()
            {
                new DetalleVenta {
                    Id = "ddd", VentaId = "q22", Cantidad = "2", ProductoId = "33", ProductoNombre = "A", ProductoCategoria = "D", ProductoPrecio = "20", Total = "40"
                },
                new DetalleVenta {
                    Id = "dd", VentaId = "q23", Cantidad = "3", ProductoId = "44", ProductoNombre = "B", ProductoCategoria = "E", ProductoPrecio = "30", Total = "90"
                },
                new DetalleVenta {
                    Id = "aaa", VentaId = "q24", Cantidad = "4", ProductoId = "44", ProductoNombre = "C", ProductoCategoria = "F", ProductoPrecio = "40", Total = "160"
                },
            };

            var ventaService = new VentaService(context.Object);
            var add          = ventaService.AddVenta(sale, detalleVenta);

            Assert.IsTrue(add);
            Assert.AreEqual(true, add);
            Assert.AreNotEqual(false, add);
        }
        internal async Task BuscarAsync()
        {
            VentaListadoItems.Clear();

            int totalElementos = 0;
            List <ModeloVenta.Venta> ventas = await VentaService.Buscar(FechaDesde, FechaHasta, FormaDePagoSeleccionada.Key, UsuarioSeleccionado.Key?.Alias, AnuladaSeleccionado.Key, OrdenadoPor, DireccionOrdenamiento, PaginaActual, ElementosPorPagina, out totalElementos);

            ventas.ForEach(x => VentaListadoItems.Add(new VentaListadoItem(x)));
            TotalElementos = totalElementos;

            NotifyPropertyChanged(nameof(VentaListadoItems));
            NotifyPropertyChanged(nameof(TotalElementos));
        }
        public async Task Envio_15_ventas()
        {
            //Generamos un listado de ventas
            for (int i = 1; i <= 15; i++)
            {
                var ventaEva = new VentaService <VentaEvaModel>(new EvaResolver()).GenerarVenta();
                //Serializamos el listado de ventas a Json
                string json = Utils.ConvertirAJson(ventaEva);

                //Enviamos al server
                var    cloud     = new CloudService(new AzureResolver());
                string contenido = cloud.Post(json);
                contenido.Should().BeOfType <string>();
            }
        }
Example #12
0
        private async Task CargarDatosCajaAbiertaAsync()
        {
            Task <List <MovimientoMonto> > egresos  = Task.Run(() => GastoService.Saldo(FechaApertura));
            Task <List <MovimientoMonto> > ingresos = Task.Run(() => VentaService.Saldo(FechaApertura));

            await Task.WhenAll(egresos, ingresos);

            List <Ingresos> ingresosModel = new List <Ingresos>();

            ingresosModel.AddRange(ingresos.Result.Select(x => new Ingresos(x.Id, cierreCajaModel.Id, x.ModificaCaja, x.Concepto, x.Monto)));
            cierreCajaModel.AgregarIngresos(ingresosModel);

            List <Egresos> egresosModel = new List <Egresos>();

            egresosModel.AddRange(egresos.Result.Select(x => new Egresos(x.Id, cierreCajaModel.Id, x.ModificaCaja, x.Concepto, x.Monto)));
            cierreCajaModel.AgregarEgresos(egresosModel);
        }
Example #13
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            var venta = GetVenta();

            venta.Fecha = DateTime.Parse(txtFecha.Text);



            if (venta != null)
            {
                if (ViewState["opc"].ToString() == "nuevo")
                {
                    if (txtCliente.Text == "" && txtDni.Text == "")
                    {
                        ScriptManager.
                        RegisterClientScriptBlock(this,
                                                  this.GetType(), "alertMessage", "alert('Llenar datos de Cliente..!!')", true);
                    }
                    else
                    {
                        venta.ComprobateId = Int32.Parse(cbTipoComprobante.SelectedValue);
                        VentaService.AddVenta(venta);
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('VENTA Registrada..!!')", true);
                        Response.Redirect("frmListVentas.aspx");
                    }
                }
                else if (ViewState["opc"].ToString() == "editar")
                {
                    if (txtCliente.Text == "" && txtDni.Text == "")
                    {
                        ScriptManager.
                        RegisterClientScriptBlock(this,
                                                  this.GetType(), "alertMessage", "alert('Llenar datos de Cliente..!!')", true);
                    }
                    else
                    {
                        venta.ComprobateId = Int32.Parse(cbTipoComprobante.SelectedValue);
                        VentaService.UpdateVenta(venta);
                        ScriptManager.
                        RegisterClientScriptBlock(this,
                                                  this.GetType(), "alertMessage", "alert('Venta Editada..!!')", true);
                        Response.Redirect("frmListVentas.aspx");
                    }
                }
            }
        }
Example #14
0
        // POST api/<controller>
        public HttpResponseMessage Post([FromBody] RegistrarVenta rv)
        {
            HttpResponseMessage response;

            try
            {
                VentaService service = (VentaService) new VentaService().setDatabase(db);

                service.RegistrarVenta(rv);


                response = this.getSuccessResponse(rv);
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }
Example #15
0
        public HttpResponseMessage PostPreVenta([FromBody] ConfirmarPreventa cp)
        {
            HttpResponseMessage response;

            try
            {
                VentaService service = (VentaService) new VentaService().setDatabase(db);

                service.RegistrarPreventa(cp);


                response = this.getSuccessResponse(cp);
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }
Example #16
0
        // GET api/<controller>
        public HttpResponseMessage GetPreVenta()
        {
            HttpResponseMessage response;

            try
            {
                VentaService    service = (VentaService) new VentaService().setDatabase(db);
                List <Preventa> ventas  = service.getPreVentas();



                response = this.getSuccessResponse(ventas);
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }
        private static async Task CerrarCaja(CierreCaja cierreCaja)
        {
            Task <List <MovimientoMonto> > gastoSaldo = Task.Run(() => GastoService.Saldo(DateTime.Now));
            Task <List <MovimientoMonto> > ventaSaldo = Task.Run(() => VentaService.Saldo(DateTime.Now));

            await Task.WhenAll(gastoSaldo, ventaSaldo);

            List <Ingresos> ingresos = new List <Ingresos>();

            ingresos.AddRange(ventaSaldo.Result.Select(x => new Ingresos(x.Id, cierreCaja.Id, x.ModificaCaja, x.Concepto, x.Monto)));
            cierreCaja.AgregarIngresos(ingresos);

            List <Egresos> egresos = new List <Egresos>();

            egresos.AddRange(gastoSaldo.Result.Select(x => new Egresos(x.Id, cierreCaja.Id, x.ModificaCaja, x.Concepto, x.Monto)));
            cierreCaja.AgregarEgresos(egresos);

            decimal montoEnCaja = ingresos.Where(x => x.ModificaCaja).Sum(x => x.Monto);

            cierreCaja.Cerrar("Automático", montoEnCaja);
        }
Example #18
0
        internal async Task GuardarAsyn()
        {
            CobroForm cobroForm = new CobroForm(Total);

            if (cobroForm.ShowDialog() == DialogResult.OK)
            {
                ModeloVenta.Pago pago = new ModeloVenta.Pago(cobroForm.FormaPago, Total, cobroForm.MontoPago, 0, 0);

                IList <ModeloVenta.VentaItem> ventaItems = VentaItems.Select(x => new ModeloVenta.VentaItem(x.Producto, x.Cantidad, x.Precio)).ToList();

                ModeloVenta.Venta venta = new ModeloVenta.Venta(Sesion.Usuario.Alias, ventaItems, pago);
                venta.DisminuirStock();
                await VentaService.Guardar(venta);

                Imprimir(venta);

                VueltoForm vueltoForm = new VueltoForm(pago.Vuelto);
                vueltoForm.ShowDialog();

                VentaItems.Clear();
                NotifyPropertyChanged(nameof(VentaItems));
            }
        }
Example #19
0
        public FrmVenta()
        {
            vendedorService = new VendedorService(ConfigConnection.connectionString);
            vendedores      = new List <Vendedor>();

            productoService = new ProductoService(ConfigConnection.connectionString);
            productos       = new List <Producto>();

            detalleVentaService = new DetalleVentaService(ConfigConnection.connectionString);
            detallesVentas      = new List <DetalleVenta>();

            ventaService = new VentaService(ConfigConnection.connectionString);

            compuestoProductoService = new CompuestoProductoService(ConfigConnection.connectionString);
            materiaPrimaService      = new MateriaPrimaService(ConfigConnection.connectionString);
            materiaPrimas            = new List <MateriaPrima>();

            InitializeComponent();

            LlenarVendedor();
            LlenarProducto();

            Limpiar();
        }
Example #20
0
 public VentaController(IUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
     _service    = new VentaService(_unitOfWork);
 }
Example #21
0
        static void Main(string[] args)
        {
            // 1.Creando objeto
            Venta    venta = new Venta();
            Cliente  cliente, cliente2;
            Producto producto, producto2;
            var      Configuracion = new { Nombre = "Avansist" };

            // 2.Creando el objeto del servicio para llamar sus métodos
            ClienteService  clienteservice  = new ClienteService();
            ProductoService productoService = new ProductoService();
            VentaService    ventaService    = new VentaService();

            int cedula, codigo;

            // variable del while 1
            bool entrar = true;

            while (entrar)
            {
                try
                {
                    int modulo;
                    Console.WriteLine("MÓDULOS:\n1.Módulo Clientes\n2.Módulo Productos\n3.Módulo Ventas\n4.Modulo Reportes\n5.Módulo Configuración\n6.Salir del Sistema");
                    modulo = int.Parse(Console.ReadLine());
                    switch (modulo)
                    {
                    case 1:     // Módulo Clientes
                        try
                        {
                            bool moduloClientes = true;
                            while (moduloClientes)
                            {
                                int menuClientes;
                                Console.WriteLine("BIENVENIDO AL MÓDULO DE CLIENTES");
                                Console.WriteLine("Menú:\n1.Crear Cliente\n2.Buscar Cliente por cédula\n3.Modificar o Editar Cliente\n4.Eliminar Cliente\n5.Salir del módulo");
                                menuClientes = int.Parse(Console.ReadLine());

                                switch (menuClientes)
                                {
                                case 1:         // Crear cliente
                                                // variable del while 2
                                    bool respuesta = true;
                                    while (respuesta)
                                    {
                                        cliente = new Cliente();
                                        // Creando o guardando Clientes
                                        Console.WriteLine("ingrese la cédula:");
                                        cedula = int.Parse(Console.ReadLine());
                                        if (clienteservice.Validarcedula(cedula))
                                        {
                                            Console.WriteLine("El Cliente ya existe :(");         // El objeto ya existe
                                        }
                                        else
                                        {
                                            cliente.cedula = cedula;         // asignando cedula a la propiedad Cliente.cedula.
                                            Console.WriteLine("ingrese el nombre:");
                                            cliente.nombre = Console.ReadLine();
                                            Console.WriteLine("ingrese la dirección:");
                                            cliente.direccion = Console.ReadLine();
                                            Console.WriteLine("ingrese la teléfono:");
                                            cliente.telefono = Console.ReadLine();
                                            // 4.llamando el servicio para guardar o crear el Cliente
                                            clienteservice.CrearCliente(cliente);
                                        }

                                        Console.WriteLine("¿Desea ingresar más Clientes...(si/no)?");

                                        string salir;
                                        salir = Console.ReadLine();
                                        if ((salir.ToLower()).Equals("no"))
                                        {
                                            respuesta = false;
                                        }
                                    }
                                    break;

                                case 2:         // Buscar Cliente por cédula

                                    Console.WriteLine("Ingrese la cédula del cliente");
                                    cedula   = int.Parse(Console.ReadLine());
                                    cliente2 = clienteservice.BuscarClientePorCedula(cedula);
                                    Console.WriteLine($"Cédula:{cliente2.cedula} Nombre:{cliente2.nombre} Direccion:{cliente2.direccion} Teléfono:{cliente2.telefono}");
                                    break;

                                case 3:         // Modificar cliente

                                    Console.WriteLine("ingrese la cédula:");
                                    cedula = int.Parse(Console.ReadLine());
                                    if (clienteservice.BuscarPosicionCliente(cedula) >= 0)         // indice >= 0 creado
                                    {
                                        cliente        = new Cliente();
                                        cliente.cedula = cedula;         // asignando cedula a la propiedad Cliente.cedula.
                                        Console.WriteLine("ingrese el nombre:");
                                        int index = clienteservice.BuscarPosicionCliente(cedula);
                                        cliente.nombre = Console.ReadLine();
                                        Console.WriteLine("ingrese la dirección:");
                                        cliente.direccion = Console.ReadLine();
                                        Console.WriteLine("ingrese la teléfono:");
                                        cliente.telefono = Console.ReadLine();
                                        clienteservice.ModificarCliente(cliente, index);
                                        Console.WriteLine("El cliente se modificado");
                                    }
                                    else
                                    {
                                        Console.WriteLine("Cliente no encontrado");
                                    }
                                    break;

                                case 4:         // Eliminar cliente

                                    Console.WriteLine("ingrese la cédula:");
                                    cedula = int.Parse(Console.ReadLine());
                                    clienteservice.EliminarCliente(cedula);
                                    break;

                                case 5:
                                    Console.WriteLine("¿Esta seguro que desea salir del módulo (Si/No)...?");
                                    var res1 = Console.ReadLine();
                                    if ((res1.ToLower()).Equals("si"))
                                    {
                                        moduloClientes = false;
                                    }
                                    break;

                                default:
                                    Console.WriteLine("Opción incorrecta :(");
                                    break;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("Debe ingresar las opciones que aparecen en el Ménu Clientes");
                        }
                        break;

                    case 2:     // Módulo Productos
                        try
                        {
                            bool moduloProductos = true;
                            while (moduloProductos)
                            {
                                int menuProductos;
                                Console.WriteLine("BIENVENIDO AL MÓDULO DE PRODUCTOS");
                                Console.WriteLine("Menú:\n1.Crear Productos\n2.Buscar producto\n.Modificar producto\n4.Eliminar Porducto\n5.Salir del módulo");
                                menuProductos = int.Parse(Console.ReadLine());

                                switch (menuProductos)
                                {
                                case 1:         // Crear producto
                                    bool respuesta2 = true;

                                    while (respuesta2)
                                    {
                                        producto = new Producto();
                                        Console.WriteLine("Ingrese el código del producto");
                                        codigo = int.Parse(Console.ReadLine());
                                        if (productoService.ValidarCodigo(codigo))
                                        {
                                            Console.WriteLine("El producto ya existe");
                                        }
                                        else
                                        {
                                            producto.codigo = codigo;         // asignando cedula a la propiedad Cliente.cedula.
                                            Console.WriteLine("ingrese el nombre del Producto:");
                                            producto.nombre = Console.ReadLine();
                                            Console.WriteLine("ingrese el precio:");
                                            producto.precio = int.Parse(Console.ReadLine());
                                            Console.WriteLine("ingrese la cantidad:");
                                            producto.cantidad = int.Parse(Console.ReadLine());
                                            // 4.llamando el servicio para guardar o crear el Cliente
                                            productoService.CrearProducto(producto);
                                        }

                                        Console.WriteLine("¿Desea ingresar más Productos...(si/no)?");
                                        string salir;
                                        salir = Console.ReadLine();
                                        if ((salir.ToLower()).Equals("no"))
                                        {
                                            respuesta2 = false;
                                        }
                                    }

                                    break;

                                case 2:          // Buscar Producto por codigo

                                    Console.WriteLine("Ingrese el código del producto");
                                    codigo    = int.Parse(Console.ReadLine());
                                    producto2 = productoService.BuscarProductoPorCodigo(codigo);

                                    Console.WriteLine($"Código:{producto2.codigo} Nombre:{producto2.nombre} Precio:{producto2.precio} Cantidad:{producto2.cantidad}");
                                    break;

                                case 3:         // Modificar Producto

                                    Console.WriteLine("ingrese El código:");
                                    codigo = int.Parse(Console.ReadLine());
                                    if (productoService.BuscarPosicionProducto(codigo) >= 0)         // indice >= 0 creado
                                    {
                                        producto        = new Producto();
                                        producto.codigo = codigo;         // asignando cedula a la propiedad Cliente.cedula.
                                        Console.WriteLine("ingrese el nombre:");
                                        int index = productoService.BuscarPosicionProducto(codigo);
                                        producto.nombre = Console.ReadLine();
                                        Console.WriteLine("ingrese el precio:");
                                        producto.precio = int.Parse(Console.ReadLine());
                                        Console.WriteLine("ingrese la cantidad:");
                                        producto.cantidad = int.Parse(Console.ReadLine());
                                        productoService.ModificarProducto(producto, index);
                                        Console.WriteLine("El producto sea modificado");
                                    }
                                    else
                                    {
                                        Console.WriteLine("Producto no encontrado");
                                    }
                                    break;

                                case 4:          // Eliminar Producto

                                    Console.WriteLine("Ingrese el código:");
                                    codigo = int.Parse(Console.ReadLine());
                                    productoService.EliminarProducto(codigo);
                                    break;

                                case 5:
                                    Console.WriteLine("¿Esta seguro que desea salir del módulo (Si/No)...?");
                                    var res2 = Console.ReadLine();
                                    if ((res2.ToLower()).Equals("si"))
                                    {
                                        moduloProductos = false;
                                    }
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("Debe ingresar las opciones que aparecen en el Ménu Productos");
                        }
                        break;

                    case 3:     // Módulo Ventas
                        try
                        {
                            bool moduloVentas = true;
                            while (moduloVentas)
                            {
                                int menuVentas;
                                Console.WriteLine("BIENVENIDO AL MÓDULO DE VENTAS");
                                Console.WriteLine("Menú:\n1.Venta\n2.Salir del módulo");
                                menuVentas = int.Parse(Console.ReadLine());
                                switch (menuVentas)
                                {
                                case 1:
                                    Console.WriteLine("Factura Venta");
                                    Console.WriteLine($"Empresa:{Configuracion.Nombre} Fecha:{venta.fecha}");
                                    break;

                                case 2:
                                    Console.WriteLine("¿Esta seguro que desea salir del módulo (Si/No)...?");
                                    var res3 = Console.ReadLine();
                                    if ((res3.ToLower()).Equals("si"))
                                    {
                                        moduloVentas = false;
                                    }
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("Debe ingresar las opciones que aparecen en el Menú de Ventas");
                        }
                        break;

                    case 4:     // Módulo Reportes
                        try
                        {
                            bool moduloReportes = true;
                            while (moduloReportes)
                            {
                                int menuReportes;
                                Console.WriteLine("BIENVENIDO AL MÓDULO DE REPORTES");
                                Console.WriteLine("Menú\n1.Lista de Clientes\n2.Lista de Productos\n3.Lista de Facturas\n4.Salir del módulo");
                                menuReportes = int.Parse(Console.ReadLine());
                                switch (menuReportes)
                                {
                                case 1:         // Listar clientes

                                    var listaClientes = clienteservice.ListarClientes();
                                    foreach (Cliente iCliente in listaClientes)
                                    {
                                        Console.WriteLine($"nombre:{iCliente.nombre}\ndirección:{iCliente.direccion}\nteléfono:{iCliente.telefono}\ncédula:{iCliente.cedula}");
                                        Console.WriteLine("_____________");
                                    }

                                    break;

                                case 2:         // Listar productos
                                    var listaProductos = productoService.ListarProductos();
                                    foreach (Producto iProducto in listaProductos)
                                    {
                                        Console.WriteLine($"Código:{iProducto.codigo} Nombre:{iProducto.nombre} Precio:{iProducto.precio} Cantidad:{iProducto.cantidad}");
                                    }
                                    break;

                                case 3:         // Listar Facturas
                                    break;

                                case 4:
                                    Console.WriteLine("¿Esta seguro que desea salir del módulo (Si/No)...?");
                                    var res4 = Console.ReadLine();
                                    if ((res4.ToLower()).Equals("si"))
                                    {
                                        moduloReportes = false;
                                    }
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("Debe ingresar las opciones que aparecen en el Ménu Reportes");
                        }
                        break;

                    case 5:     // Módulo Configuración
                        try
                        {
                            bool moduloConfig = true;
                            while (moduloConfig)
                            {
                                Console.WriteLine("BIENVENIDO AL MÓDULO DE CONFIGURACIÓN");
                                Console.WriteLine($"Empresa {Configuracion.Nombre}");
                                int menuConfig;
                                Console.WriteLine("Menú:\n1.Salir del módulo");
                                menuConfig = int.Parse(Console.ReadLine());
                                switch (menuConfig)
                                {
                                case 1:
                                    Console.WriteLine("¿Esta seguro que desea salir del módulo (Si/No)...?");
                                    var res5 = Console.ReadLine();
                                    if ((res5.ToLower()).Equals("si"))
                                    {
                                        moduloConfig = false;
                                    }
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            throw;
                        }
                        break;

                    case 6:     // Salir del programa
                        Console.WriteLine("¿Esta seguro que desea salir del sistema...(si/no)?");
                        var salir2 = Console.ReadLine();
                        if ((salir2.ToLower()).Equals("si"))
                        {
                            entrar = false;
                        }
                        break;
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("Debe ingresar solo las opciones que aparecen en el Menú de Modulos... :(");
                }
            }
            Console.WriteLine("Gracias...y hasta la próxima :)\nPresiones cualquier tecla para salir()");
            Console.ReadKey();
        }
Example #22
0
 public VentaController(GeneralContext _context)
 {
     _ventaService   = new VentaService(_context);
     _vendidoService = new VendidoService(_context);
 }
Example #23
0
 public VentaController(ProductosContext context)
 {
     _ventaService = new VentaService(context);
 }
Example #24
0
 public VentaBL()
 {
     _ventaService = new VentaService();
 }
 internal async System.Threading.Tasks.Task AnularAsync()
 {
     Venta.Anular(MotivoAnulacion, Sesion.Usuario.Nombre);
     await VentaService.Guardar(Venta);
 }
Example #26
0
 public VentasController(VentaService ventaService)
 {
     _ventaService = ventaService;
 }
 public VentaController(VentaContext context, IHubContext <SignalHub> hubContext)
 {
     _ventaService = new VentaService(context);
     _hubContext   = hubContext;
 }
Example #28
0
        public ActionResult FiltrarVenta(String option, String idSale, String userName, String month1, String month2, String year)
        {
            String consulta = "";

            if (option == "nro-sale" || option == "allPurchases" || option == "date")
            {
                if (option == "nro-sale")
                {
                    if (String.IsNullOrEmpty(idSale))
                    {
                        ViewBag.Msg = "Debe escribir el id de venta";
                        return(View());
                    }
                    else
                    {
                        consulta = "SELECT * FROM ventas WHERE NombreUsuario = '" + userName + "' AND ventas.IdVenta = " + idSale;
                    }
                }
                /*si elije la opcion "buscar ventas por fecha"*/
                else if (option == "date")
                {
                    // validaciones backend
                    if (!checkData.CheckIntNumber(month1) || !checkData.CheckIntNumber(month2) || !checkData.CheckIntNumber(year))
                    {
                        ViewBag.Msg = "value de <select> incorrecto";
                        return(View());
                    }
                    //Esta obligado a elegir el rango de meses y el año
                    else if (String.IsNullOrEmpty(month1) || String.IsNullOrEmpty(month2) || String.IsNullOrEmpty(year))
                    {
                        ViewBag.Msg = "Debe elegir el rango de meses y el año";
                        return(View());
                    }
                    else
                    {
                        String a = "Select IdVenta, NombreUsuario, PrecioTotal, Fecha";
                        String b = " from ventas";
                        String c = " where month(Fecha) >= " + month1;
                        String d = " and month(Fecha) <= " + month2;
                        String e = " and year(Fecha) = " + year;
                        String f = " and NombreUsuario = '" + userName + "'";
                        String g = " order by Fecha desc";

                        consulta = a + b + c + d + e + f + g;
                    }
                }
                /*si elije la opcion "todas las ventas"*/
                else
                {
                    consulta = "SELECT * FROM ventas WHERE NombreUsuario = '" + userName + "' order by Fecha desc";
                }
            }
            else
            { /*por si pinchan los values de los radio button*/
                ViewBag.Msg = "Error al recibir los value de los radio button";
                return(View());
            }

            VentaService vs = new VentaService();

            ViewBag.userName = userName;
            return(View(vs.SalesByQueryGet(consulta)));
        }
Example #29
0
        public void Tipo_De_Venta_Es_Eva()
        {
            var ventaEva = new VentaService <VentaEvaModel>(new EvaResolver()).GenerarVenta();

            ventaEva.Should().BeOfType <VentaEvaModel>();
        }
Example #30
0
 public HomeController(IUnitOfWork uow)
 {
     unitOfWork   = uow;
     ventaService = new VentaService(unitOfWork);
 }