Ejemplo n.º 1
0
        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();
                }
            }
        }
Ejemplo n.º 2
0
 protected void DropArticulo_SelectedIndexChanged(object sender, EventArgs e)
 {
     TexboxCantidad.Focus();
 }