private bool Validar() //Funcion encargada de validar el registro { bool Paso = true; MyErrorProvider.Clear(); if (UsuarioTextBox.Text == string.Empty) //Valida que el vendedor no este vacio { MyErrorProvider.SetError(UsuarioTextBox, "La factura debe tener un vendedor asignado!"); UsuarioTextBox.Focus(); Paso = false; } if (ClienteTextBox.Text == string.Empty) //Valida que el cliente no este vacio { MyErrorProvider.SetError(ClienteTextBox, "La factura debe tener un cliente!"); ClienteTextBox.Focus(); Paso = false; } if (DetalleDataGridView.Rows.Count <= 0 || Convert.ToSingle(TotalTextBox.Text) == 0) //Valida que el cliente no este vacio { MyErrorProvider.SetError(DetalleDataGridView, "La factura debe tener al menos un producto vendido!"); ProductoIdNumericUpDown.Focus(); Paso = false; } return(Paso); }
private bool ValidarEliminar() { bool paso = true; MyErrorProvider.Clear(); if (ProductoIdNumericUpDown.Value == 0) { MyErrorProvider.SetError(ProductoIdNumericUpDown, "Debe de introducir un ProductoId"); ProductoIdNumericUpDown.Focus(); paso = false; } return(paso); }
private void BuscarProductoButton_Click(object sender, EventArgs e) { Productos Producto = BuscaProducto(Convert.ToInt32(ProductoIdNumericUpDown.Value)); LimpiarProductoGroupBox(); if (Producto == null) { MyErrorProvider.SetError(ProductoIdNumericUpDown, "No existe un producto con este código!"); ProductoIdNumericUpDown.Focus(); } else { LlenaCamposProducto(Producto); CantidadNumericUpDown.Focus(); } }