Пример #1
0
        private void BtnAgregarDetalle_Click(object sender, EventArgs e)
        {
            try
            {
                if (tbFactura.Text.Trim() == String.Empty || tbNumeroLinea.Text.Trim() == String.Empty ||
                    tbCodigoP.Text.Trim() == String.Empty || tbPrecio.Text.Trim() == String.Empty ||
                    tbCantidad.Text.Trim() == String.Empty)
                {
                    throw new ExcepcionEsVacio();
                }
                else if (btnVerificar.Enabled == true)
                {
                    MessageBox.Show("Debe verificar el numero de factura", "Error");
                }

                else
                {
                    mantenimientoProducto.VerificarExisteProducto(tbCodigoP.Text);
                    mantenimientoProducto.CantidadInventario(tbCodigoP.Text, tbCantidad.Text);
                    mantenimientoFactura.ExisteNumeroDetalle(tbNumeroLinea.Text);

                    dataGridViewD.Rows.Add(tbFactura.Text, tbNumeroLinea.Text, tbCodigoP.Text, tbPrecio.Text, tbCantidad.Text);
                    mantenimientoFactura.addList(tbFactura.Text, tbNumeroLinea.Text, tbCodigoP.Text, tbPrecio.Text, tbCantidad.Text);
                    tbSubTotal.Text = mantenimientoFactura.SubTotal().ToString();
                }
            }
            catch (ExcepcionEsVacio ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            catch (ExcepcionNoExisteID ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            catch (ExcepcionExisteID ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            catch (ExcepcionLimiteInventario ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Пример #2
0
        private void BtnBuscar_Click(object sender, EventArgs e)
        {
            strCodigo = tbCodigo.Text;
            FillDataGrid(strCodigo);

            try
            {
                mantenimiento.VerificarExisteProducto(strCodigo);
                btnEliminar.Enabled = true;
            }
            catch (ExcepcionNoExisteID ex)
            {
                MessageBox.Show(ex.Message, "Error");
                btnEliminar.Enabled = false;
            }
            catch (ExcepcionEsVacio ex)
            {
                MessageBox.Show(ex.Message, "Error");
                btnEliminar.Enabled = false;
            }
        }