private bool ValidarCamposDetalle() { bool paso = true; if (string.IsNullOrWhiteSpace(CategoriacomboBox.Text)) { MyerrorProvider.SetError(CategoriacomboBox, "El campo Categoria no puede estar vacio"); CategoriacomboBox.Focus(); paso = false; } if (CantidadnumericUpDown.Value == 0) { MyerrorProvider.SetError(CantidadnumericUpDown, "El campo Cantidad no puede ser cero"); CantidadnumericUpDown.Focus(); paso = false; } if (PrecionumericUpDown.Value == 0) { MyerrorProvider.SetError(PrecionumericUpDown, "El campo Precio no puede ser cero"); PrecionumericUpDown.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(ImportetextBox.Text)) { MyerrorProvider.SetError(ImportetextBox, "El campo Importe no puede ser cero"); ImportetextBox.Focus(); paso = false; } return(paso); }
private void Agregarbutton_Click(object sender, EventArgs e) { if (DetalledataGridView.DataSource != null) { this.Detalle = (List <CategoriasDetalle>)DetalledataGridView.DataSource; } if (!ValidarCamposDetalle()) { return; } this.Detalle.Add(new CategoriasDetalle (CategoriaDetalleId: 0, EstudianteId: (int)IdnumericUpDown.Value, NombreCategoria: CategoriacomboBox.Text, Cantidad: Convert.ToInt32(CantidadnumericUpDown.Value), Precio: PrecionumericUpDown.Value, Importe: Convert.ToDecimal(ImportetextBox.Text) )); CargarGrid(); TotaltextBox.Text = Convert.ToString(Convert.ToDecimal(TotaltextBox.Text) + Convert.ToDecimal(ImportetextBox.Text)); CategoriacomboBox.Focus(); CategoriacomboBox.Text = string.Empty; CantidadnumericUpDown.Value = 0; PrecionumericUpDown.Value = 0; ImportetextBox.Text = string.Empty; }
private void Limpiar() { IdnumericUpDown.Value = 0; FechadateTimePicker.Value = DateTime.Now; EstudiantetextBox.Text = string.Empty; CategoriacomboBox.ResetText(); CantidadnumericUpDown.Value = 0; PrecionumericUpDown.Value = 0; ImportetextBox.Text = string.Empty; TotaltextBox.Text = "0.00"; MyerrorProvider.Clear(); this.Detalle = new List <CategoriasDetalle>(); CargarGrid(); }
private bool validar() { bool paso = true; if (string.IsNullOrWhiteSpace(LibroIdnumericUpDown.Text)) { MyerrorProvider.SetError(LibroIdnumericUpDown, "El campo no debe estar vacio"); LibroIdnumericUpDown.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(NombretextBox.Text)) { MyerrorProvider.SetError(NombretextBox, "El campo no debe estar vacio"); NombretextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(ISBNtextBox.Text)) { MyerrorProvider.SetError(ISBNtextBox, "El Campo no debe estar vacio"); ISBNtextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(CategoriacomboBox.Text)) { MyerrorProvider.SetError(CategoriacomboBox, "Seleccione la categoria del libro"); CategoriacomboBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(EditoracomboBox.Text)) { MyerrorProvider.SetError(EditoracomboBox, "Seleccione la editorial de la cual proviene el libro"); EditoracomboBox.Focus(); paso = false; } if (ValidarISBN()) { MyerrorProvider.SetError(ISBNtextBox, "Ya existe un Libro con este ISBN"); ISBNtextBox.Focus(); paso = false; } return(paso); }
private bool validar() { bool paso = true; if (string.IsNullOrWhiteSpace(NobretextBox.Text)) { SuperErrorProvider.SetError(NobretextBox, "El campo no debe estar vacio"); NobretextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(ISBNtextBox.Text)) { SuperErrorProvider.SetError(ISBNtextBox, "El Campo no debe estar vacio"); ISBNtextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(DescripciontextBox.Text)) { SuperErrorProvider.SetError(DescripciontextBox, "El Campo no debe estar vacio"); DescripciontextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(CategoriacomboBox.Text)) { SuperErrorProvider.SetError(CategoriacomboBox, "El Campo no debe estar vacio"); CategoriacomboBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(EditoracomboBox.Text)) { SuperErrorProvider.SetError(EditoracomboBox, "El Campo no debe estar vacio"); EditoracomboBox.Focus(); paso = false; } return(paso); }