Exemplo n.º 1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtDescripcion.Text))
            {
                if (!String.IsNullOrEmpty(comboTipo.Text))
                {
                    if (!String.IsNullOrEmpty(txtPrecio.Text))
                    {
                        if (!String.IsNullOrEmpty(txtStock.Text))
                        {
                            try
                            {
                                ProductoController pc = new ProductoController();

                                if (pc.AgregarProducto(txtDescripcion.Text, int.Parse(txtStock.Text), int.Parse(txtPrecio.Text), comboTipo.Text, (int)App.user.IDADMINISTRADOR, comboProveedor.Text))
                                {
                                    pc.LlenarGrid(App.fpp.dataProd);
                                    this.Dispose();
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Ingrese un numero valido.", "Crear Producto", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Ingrese stock del producto.", "Crear Producto", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Ingrese precio del producto.", "Crear Producto", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Ingrese tipo del producto.", "Crear Producto", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("Ingrese descripcion del producto.", "Crear Producto", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }