protected void Page_Load(object sender, EventArgs e) { Utilidades.SCritpValidacion(); if (!Page.IsPostBack) { LlenarDropCliente(); LlenarDrop(); dt.Columns.AddRange(new DataColumn[5] { new DataColumn("ID Articulo"), new DataColumn(" Precio"), new DataColumn("Cantidad"), new DataColumn("Nombre"), new DataColumn("ITBS") }); ViewState["Detalle"] = dt; artig = new Entidades.Articulos(); listadoArticulos = new List <Entidades.Articulos>(); listaRelaciones = new List <Entidades.FacturaDetalles>(); facturaG = new Entidades.Facturas(); DropDownTipoVenta.Text = ""; } }
public void EliminaTest() { int id = 19; articulo = BLL.ArticuloBLL.Buscar(c => c.IdArticulo == id); Assert.IsTrue(ArticuloBLL.Eliminar(articulo)); }
//Boton Buscar. private void BuscarButton_Click(object sender, RoutedEventArgs e) { var articulos = ArticulosBLL.Buscar(int.Parse(ArticuloIdTextBox.Text)); if (articulos != null) { this.articulos = articulos; } else { this.articulos = new Entidades.Articulos(); } this.DataContext = this.articulos; }
private void EliminarExitencia() { decimal descuento = 0; Entidades.Articulos Descontar = new Entidades.Articulos(); foreach (GridViewRow producto in FacturaGrid.Rows) { int productoId = Convert.ToInt32(producto.Cells[0].Text); ///Celda 2 es el idArticulo antes esta detalleid y facturaid descuento = Convert.ToDecimal(producto.Cells[2].Text); //Celda 4 es la cantiddad Descontar = BLL.ArticuloBLL.BuscarB(productoId); // if(Descontar.Existencia <) Descontar.Existencia -= Convert.ToInt32(descuento); BLL.ArticuloBLL.Mofidicar(Descontar); } }
public void BuscarTest() { int id = 19; bool bandera = false; articulo = ArticuloBLL.Buscar(p => p.IdArticulo == id); if (articulo != null) { bandera = true; } else { bandera = false; } Assert.IsTrue(bandera); }
public void ModificarTest() { int id = 14; articulo = ArticuloBLL.Buscar(p => p.IdArticulo == id); articulo.NombreArticulo = "Tenis"; articulo.Precio = 100; articulo.Costo = 150; articulo.Categoria = "Calzado"; articulo.CodigoArticulo = "000"; articulo.ITBIS = 10m; articulo.FechaIngreso = Convert.ToDateTime("0:00:00.079507"); articulo.Existencia = 20; Assert.IsTrue(ArticuloBLL.Mofidicar(articulo)); }
protected void Agregar_Click(object sender, EventArgs e) { int id = Utilidades.TOINT(DropArticulo.SelectedValue); artig = BLL.ArticuloBLL.Buscar(p => p.IdArticulo == id); if (Utilidades.TOINT(TextBoxCantidad.Text) > artig.Existencia) { Utilidades.ShowToastr(this, "Cantidad exece existencia", "info"); TextBoxCantidad.Text = ""; } else { bool agregado = false; foreach (GridViewRow producto in FacturaGrid.Rows) { int prueba = Utilidades.TOINT(producto.Cells[0].Text); if (artig.IdArticulo == Utilidades.TOINT(producto.Cells[0].Text)) { agregado = true; Utilidades.ShowToastr(this, " Articulo ya esta en factura -Selecione otro", "Error", "info"); break; } } if (agregado == true) { Utilidades.ShowToastr(this, " Articulo ya esta en factura -Selecione otro", "Error", "info"); } else { DataTable dt = (DataTable)ViewState["Detalle"]; dt.Rows.Add(DropArticulo.SelectedValue, artig.Precio, TextBoxCantidad.Text.Trim(), artig.NombreArticulo, artig.ITBIS); ViewState["Detalle"] = dt; this.BindGrid(); CalcularMonto(); TextBoxCantidad.Text = ""; TexboxCantidad.Focus(); } } }
private void Limpiar() { this.articulos = new Entidades.Articulos(); this.DataContext = articulos; }