protected void lvProformas_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (e.CommandName == "agregar")
            {
                var productoId = Convert.ToInt32(e.CommandArgument.ToString());

                var producto = ProductoService.GetProductoById(productoId);

                var proforma = Cache.Get("proforma") as Proforma;

                var existe = proforma.detalleproforma.SingleOrDefault(d => d.ProductoId.Equals(productoId));

                if (existe == null)
                {
                    var detalleproforma = new DetalleProforma()
                    {
                        ProductoId = productoId,
                        producto   = producto,
                        Cantidad   = 1,
                        ProformaId = proforma.Id,
                        Precio     = producto.PrecioUnitarioDeVenta
                    };

                    proforma.detalleproforma.Add(detalleproforma);
                }
                else
                {
                    existe.Cantidad += 1;
                }

                BindProforma(proforma);
                Cache.Insert("proforma", proforma);
            }
        }
        //[ApiAuthenticationFilter(true)]
        public HttpResponseMessage Delete(long id)
        {
            HttpResponseMessage response;

            try
            {
                ProductoService service = (ProductoService) new ProductoService().setDatabase(db);
                Producto        p       = service.find(id);
                service.delete(id);

                if (p.Estado == "D")
                {
                    response = this.getSuccessResponse(p);
                }
                else
                {
                    response = this.getSuccessResponse("No se puede eliminar porque existe una compra o hay stock disponible");
                }
            }
            catch (Exception e)
            {
                response = this.getErrorResponse(e);
            }
            return(response);
        }
Beispiel #3
0
        public void buscarProductoNombre()
        {
            string          productoNombre = "prueba";
            List <Producto> producto       = ProductoService.buscarProductoNombre(productoNombre);

            Assert.IsTrue(producto.Count > 0);
        }
Beispiel #4
0
        private void Canje_Puntos_Load(object sender, EventArgs e)
        {
            try
            {
                ClienteService  clienteService  = new ClienteService();
                ProductoService productoService = new ProductoService();

                this.dataGridPremios.DataSource = productoService.getAllProducto();
                List <string> encabezados = new List <string>(new string[] { "Id" });
                foreach (DataGridViewColumn column in this.dataGridPremios.Columns)
                {
                    if (encabezados.Contains(column.HeaderText))
                    {
                        column.Visible = false;
                    }
                }

                Src.Modelo.Entidades.Cliente cliente = clienteService.GetClienteByUsername(this.usuario.Username);
                this.Cliente = cliente;

                clienteService.getPuntaje(this.Cliente);

                this.points.Text = this.Cliente.Puntos.ToString();


                this.dataGridPremios.AutoSize   = false;
                this.dataGridPremios.ScrollBars = ScrollBars.Both;
                this.dataGridPremios.ClearSelection();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Beispiel #5
0
        private void Canje_Punto_Historial_Load(object sender, EventArgs e)
        {
            try
            {
                ProductoService productoService = new ProductoService();

                this.dataGridPremiosHistorial.DataSource = productoService.getHistorialCanje(this.Cliente);

                List <string> encabezados = new List <string>(new string[] { "Id" });

                foreach (DataGridViewColumn column in this.dataGridPremiosHistorial.Columns)
                {
                    if (encabezados.Contains(column.HeaderText))
                    {
                        column.Visible = false;
                    }
                }

                this.dataGridPremiosHistorial.AutoSize   = false;
                this.dataGridPremiosHistorial.ScrollBars = ScrollBars.Both;
                this.dataGridPremiosHistorial.ClearSelection();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Beispiel #6
0
        private void PrepararCadena()
        {
            InitializeComponent();
            var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            service = new ProductoService(connectionString);
        }
        public ProductoController(IConfiguration configuration)
        {
            Configuration = configuration;
            string connectionString = Configuration["ConnectionStrings:DefaultConnection"];

            _productoService = new ProductoService(connectionString);
        }
Beispiel #8
0
 public ProductoController()
 {
     productoServices     = new ProductoService();
     categoriaServices    = new CategoriaService();
     marcaServices        = new MarcaService();
     unidadMedidaServices = new UnidadMedidaService();
 }
Beispiel #9
0
        public void buscarProductoId()
        {
            int      productoId = 1;
            Producto producto   = ProductoService.buscarProductoId(productoId);

            Assert.AreEqual(producto.id, productoId);
        }
Beispiel #10
0
        protected void lvProductos_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (e.CommandName == "addProducto")
            {
                var productoId = Int32.Parse(e.CommandArgument.ToString());

                var producto = ProductoService.GetProductoById(productoId);

                var venta = GetVenta();

                var existe = venta.detalleVenta
                             .SingleOrDefault(i => i.ProductoId.Equals(productoId));

                if (existe == null)
                {
                    var itemPedido = new DetalleVenta()
                    {
                        VentaId    = venta.Id,
                        Cantidad   = 1,
                        producto   = producto,
                        ProductoId = productoId,
                        Precio     = producto.PrecioUnitarioDeVenta
                    };
                    venta.detalleVenta.Add(itemPedido);
                }
                else
                {
                    existe.Cantidad += 1;
                }

                BindVenta(venta);

                Cache.Insert("venta", venta);
            }
        }
 public frmUpdateProyectos()
 {
     InitializeComponent();
     oProyectoService = new ProyectoService();
     productoService  = new ProductoService();
     usuarioService   = new UsuarioService();
 }
Beispiel #12
0
        // GET: api/Producto
        public IHttpActionResult Get()
        {
            ProductoService ps       = new ProductoService();
            List <Producto> producto = ps.ObtenerProducto();

            return(Ok(producto));
        }
 private void BtnRegistrar_Click(object sender, EventArgs e)
 {
     marcaservice    = new MarcaService(ConfigConnection.ConnectionString);
     productoservice = new ProductoService(ConfigConnection.ConnectionString);
     if (TxtCodigo.Text.Equals("") || TxtInstrumento.Text.Equals("") || TxtPrecio.Text.Equals("") ||
         CmbMarca.Text.Equals(""))
     {
         MessageBox.Show("Complete los campos. ");
     }
     else
     {
         try
         {
             decimal  precio   = decimal.Parse(TxtPrecio.Text.Trim());
             Producto producto = new Producto();
             producto.Codigo = TxtCodigo.Text.Trim().ToUpper();
             producto.Marca  = marcaservice.FiltrarMarca(CmbMarca.Text);
             producto.Nombre = TxtInstrumento.Text.Trim().ToUpper();
             producto.Precio = precio;
             MessageBox.Show(productoservice.GuardarProducto(producto));
             Inventario.Actualizar();
             UnlockInventario.unlockInventario();
             this.Close();
         }
         catch (FormatException ex)
         {
             MessageBox.Show("Error " + ex.Message.ToString());
         }
     }
 }
Beispiel #14
0
        public FormRegistodeProducto()
        {
            InitializeComponent();
            productoService = new ProductoService(ConfigConnection.connectionString);
            colorService    = new ColorService(ConfigConnection.connectionString);
            marcaService    = new MarcaService(ConfigConnection.connectionString);
            llenarComboColor();
            LlenarComboMarca();
            LlenarComboTalla();
            Inhabilitar();
            txtCodigoMarca.Enabled = false;
            txtCodigoColor.Enabled = false;
            table.Columns.Add("Codigo");
            table.Columns.Add("Nombre");
            table.Columns.Add("Precio Compra");
            table.Columns.Add("Precio venta");
            table.Columns.Add("Talla");
            table.Columns.Add("Color");
            table.Columns.Add("Stock");
            table.Columns.Add("Marca");
            table.Columns.Add("Imagen");


            cmbColor.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbMarca.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbTalla.DropDownStyle = ComboBoxStyle.DropDownList;
        }
Beispiel #15
0
        public void buscarProductoDesc()
        {
            string          productoDesc = "prueba";
            List <Producto> producto     = ProductoService.buscarProductoDesc(productoDesc);

            Assert.IsTrue(producto.Count > 0);
        }
Beispiel #16
0
 public FormProducto()
 {
     productoService = new ProductoService(ConfigConnection.ConnectionString);
     InitializeComponent();
     productos = new List <Producto>();
     ActualizarTabla();
 }
Beispiel #17
0
        public ActionResult Buscar(String searchString, String tipoBusqueda)
        {
            List <Producto> productos;

            switch (tipoBusqueda)
            {
            case "1":
                productos = ProductoService.buscarProductoDesc(searchString);
                ViewBag.TituloVistaParcial = "Productos:";
                return(View("_VPProductos", productos));

            case "2":
                productos = ProductoService.buscarProductoNombre(searchString);
                ViewBag.TituloVistaParcial = "Productos:";
                return(View("_VPProductos", productos));

            case "3":
                int  id   = 0;
                bool isId = int.TryParse(searchString, out id);
                if (isId)
                {
                    return(RedirectToAction("Details/" + id));
                }
                else
                {
                    productos = new List <Producto>();
                    return(View("_VPProductos", productos));
                }

            default:
                productos = ProductoService.buscarProductoNombre(searchString);
                ViewBag.TituloVistaParcial = "Productos:";
                return(View("_VPProductos", productos));
            }
        }
 public FacturaVentaFrm()
 {
     productoService = new ProductoService(ExtraerCadena.connectionString);
     clienteService  = new PersonaClienteService(ExtraerCadena.connectionString);
     facturaService  = new FacturaService(ExtraerCadena.connectionString);
     InitializeComponent();
     FechaDeExpedicionDTP.Value = DateTime.Now;
 }
Beispiel #19
0
 public frmConsultaProductos()
 {
     InitializeComponent();
     // Inicializamos la grilla de bugs
     InitializeDataGridView();
     marcaService    = new MarcaService();
     productoService = new ProductoService();
 }
Beispiel #20
0
 public FormCrearFactura()
 {
     facturaService  = new FacturaService(ConfigConnection.ConnectionString);
     productoService = new ProductoService(ConfigConnection.ConnectionString);
     clienteService  = new ClienteService(ConfigConnection.ConnectionString);
     InitializeComponent();
     factura = new Factura();
 }
Beispiel #21
0
 public FormMovimientos()
 {
     InitializeComponent();
     movimientosService = new MovimientosService(ConfigConnection.connectionString);
     productoService    = new ProductoService(ConfigConnection.connectionString);
     Gestionar();
     LlenarCombo();
 }
        internal async Task CargarAutocompletadoAsync()
        {
            CodigosDescripcionesProductos.Clear();
            CodigosDescripcionesProductos.AddRange((await ProductoService.ObtenerCodigos(null, ProveedorSeleccionado.Key, null, null)).ToArray());

            NotifyPropertyChanged(nameof(ProveedorSeleccionado));
            NotifyPropertyChanged(nameof(CodigosDescripcionesProductos));
        }
Beispiel #23
0
 public FormInicio()
 {
     InitializeComponent();
     productoService = new ProductoService(ConfigConnection.connectionString);
     cliente         = new ClienteService(ConfigConnection.connectionString);
     proveedor       = new ProveedorService(ConfigConnection.connectionString);
     Dashboard();
 }
Beispiel #24
0
 public Form1()
 {
     productoService = new ProductoService();
     clienteService  = new ClienteService();
     vs = new VentaService();
     InitializeComponent();
     mv = new MostrarVenta();
 }
Beispiel #25
0
        public ActionResult _VPProductos(string search = "")
        {
            List <Producto> productos = ProductoService.buscarProductoDesc(search);

            ViewBag.TituloVistaParcial = "Productos:";

            return(PartialView("_VPProductos", productos));
        }
Beispiel #26
0
 public FrmProducto()
 {
     InitializeComponent();
     materiaPrimaService      = new MateriaPrimaService(ConfigConnection.connectionString);
     productoService          = new ProductoService(ConfigConnection.connectionString);
     compuestoProductoService = new CompuestoProductoService(ConfigConnection.connectionString);
     LlenarMateriaPrima();
 }
Beispiel #27
0
        internal async Task CargarProductosAsync(string categoria)
        {
            Productos.Clear();
            IList <string> productosDescripciones = await ProductoService.ObtenerDescripciones(categoria);

            Productos.AddRange(productosDescripciones);
            NotifyPropertyChanged(nameof(Categorias));
        }
Beispiel #28
0
        public FrmConsultaProductos()
        {
            InitializeComponent();

            productoService = new ProductoService(ConfigConnection.connectionString);

            LlenarTabla();
        }
Beispiel #29
0
 public FormGestionCompra()
 {
     InitializeComponent();
     service                     = new ProveedorService(ConfigConnection.connectionString);
     productoService             = new ProductoService(ConfigConnection.connectionString);
     compraService               = new FacturaCompraService(ConfigConnection.connectionString);
     detalleService              = new DetalleFacturaCompraService(ConfigConnection.connectionString);
     LbelFechaFacturaCompra.Text = DateTime.Now.ToString("dd/MM/yyyy");
 }
Beispiel #30
0
        public frmProyectos()
        {
            InitializeComponent();
            InitializeDataGridView();
            proyectoService = new ProyectoService();

            productoService = new ProductoService();
            usuarioService  = new UsuarioService();;
        }