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); }
public void buscarProductoNombre() { string productoNombre = "prueba"; List <Producto> producto = ProductoService.buscarProductoNombre(productoNombre); Assert.IsTrue(producto.Count > 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); } }
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); } }
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); }
public ProductoController() { productoServices = new ProductoService(); categoriaServices = new CategoriaService(); marcaServices = new MarcaService(); unidadMedidaServices = new UnidadMedidaService(); }
public void buscarProductoId() { int productoId = 1; Producto producto = ProductoService.buscarProductoId(productoId); Assert.AreEqual(producto.id, productoId); }
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(); }
// 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()); } } }
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; }
public void buscarProductoDesc() { string productoDesc = "prueba"; List <Producto> producto = ProductoService.buscarProductoDesc(productoDesc); Assert.IsTrue(producto.Count > 0); }
public FormProducto() { productoService = new ProductoService(ConfigConnection.ConnectionString); InitializeComponent(); productos = new List <Producto>(); ActualizarTabla(); }
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; }
public frmConsultaProductos() { InitializeComponent(); // Inicializamos la grilla de bugs InitializeDataGridView(); marcaService = new MarcaService(); productoService = new ProductoService(); }
public FormCrearFactura() { facturaService = new FacturaService(ConfigConnection.ConnectionString); productoService = new ProductoService(ConfigConnection.ConnectionString); clienteService = new ClienteService(ConfigConnection.ConnectionString); InitializeComponent(); factura = new Factura(); }
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)); }
public FormInicio() { InitializeComponent(); productoService = new ProductoService(ConfigConnection.connectionString); cliente = new ClienteService(ConfigConnection.connectionString); proveedor = new ProveedorService(ConfigConnection.connectionString); Dashboard(); }
public Form1() { productoService = new ProductoService(); clienteService = new ClienteService(); vs = new VentaService(); InitializeComponent(); mv = new MostrarVenta(); }
public ActionResult _VPProductos(string search = "") { List <Producto> productos = ProductoService.buscarProductoDesc(search); ViewBag.TituloVistaParcial = "Productos:"; return(PartialView("_VPProductos", productos)); }
public FrmProducto() { InitializeComponent(); materiaPrimaService = new MateriaPrimaService(ConfigConnection.connectionString); productoService = new ProductoService(ConfigConnection.connectionString); compuestoProductoService = new CompuestoProductoService(ConfigConnection.connectionString); LlenarMateriaPrima(); }
internal async Task CargarProductosAsync(string categoria) { Productos.Clear(); IList <string> productosDescripciones = await ProductoService.ObtenerDescripciones(categoria); Productos.AddRange(productosDescripciones); NotifyPropertyChanged(nameof(Categorias)); }
public FrmConsultaProductos() { InitializeComponent(); productoService = new ProductoService(ConfigConnection.connectionString); LlenarTabla(); }
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"); }
public frmProyectos() { InitializeComponent(); InitializeDataGridView(); proyectoService = new ProyectoService(); productoService = new ProductoService(); usuarioService = new UsuarioService();; }