private void btnGuardar_Click(object sender, EventArgs e) { DialogResult Result = MessageBox.Show("¿DESEA GUARDAR LA INFORMACION?", "PREGUNTA", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Result == DialogResult.No) { return; } string Desc = txtDescripcion.Text, Prec = txtPrecio.Text, Marca = txtMarca.Text;; float Precio; int Cant = Convert.ToInt32(nudCantidad.Value); if (Rutinas.IsEmpty(Desc)) { MessageBox.Show("FAVOR DE ESCRIBIR UNA DESCRIPCION", "CAMPO VACIO", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Rutinas.IsEmpty(Marca)) { MessageBox.Show("FAVOR DE ESCRIBIR EL MODELO", "CAMPO VACIO", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!(Rutinas.validadDecimal(Prec))) { MessageBox.Show("SOLO SE ACEPTAN NUMEROS EN FORMATO (0.00)", "FORMATO INCORRECTO", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { Precio = Convert.ToSingle(txtPrecio.Text); } catch (FormatException E) { MessageBox.Show("EL PRECIO NO PUEDE ESTAR VACIO", "CAMPO VACIO", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Precio < 1) { MessageBox.Show("EL PRECIO NO PUEDE SER MENOR A 1", "VALOR FUERA DE RANGO", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (Cant < 1) { MessageBox.Show("LA CANTIDAD DE ARTICULOS A INGRESAR NO PUEDE SER MENOR A 1", "VALOR FUERA DE RANGO", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (AdmA.BuscaClaveArt(Desc) > -1) { MessageBox.Show("EL ARTICULO YA FUE REGISTRADO", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!AdmA.AgregaArt(Desc, Marca, Precio, Cant)) { MessageBox.Show("NO SE PUDO GUARDAR EL ARTICULO", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("ARTICULO AGREGADO EXITOSAMENTE", "INFORMACION", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); }