private bool Validar() { MyErrorProvider.Clear(); bool paso = true; if (string.IsNullOrWhiteSpace(ProfesorComboBox.Text)) { MyErrorProvider.SetError(ProfesorComboBox, "Debe de seleccionar un profesor valido"); ProfesorComboBox.Focus(); paso = false; } if (SemestreIdNumericUpDown.Value == 0) { MyErrorProvider.SetError(SemestreIdNumericUpDown, "Debe de introducir un semestre id"); SemestreIdNumericUpDown.Focus(); paso = false; } if (this.Detalle.Count == 0) { MyErrorProvider.SetError(EstudiantesDataGridView, "Debe de seleccionar una asignatura con estudiantes"); EstudiantesDataGridView.Focus(); paso = false; } return(paso); }
private bool ValidarSemestre(Semestres semestre) { MyErrorProvider.Clear(); bool paso = true; if (semestre == null) { MyErrorProvider.SetError(SemestreIdNumericUpDown, "Debe de insertar un id de un semestre valido"); SemestreIdNumericUpDown.Focus(); return(false); } if (!semestre.Activo) { MyErrorProvider.SetError(SemestreIdNumericUpDown, "Debe de insertar un id de un semestre activo"); SemestreIdNumericUpDown.Focus(); paso = false; } return(paso); }
private bool Validar() { MyErrorProvider.Clear(); bool paso = true; if (string.IsNullOrWhiteSpace(AsignaturasComboBox.Text)) { MyErrorProvider.SetError(AsignaturasComboBox, "Debe de seleccionar una asignatura"); AsignaturasComboBox.Focus(); paso = false; } if (this.Detalle.Count == 0) { MyErrorProvider.SetError(EstudiantesDataGridView, "Debe agregar algun estudiante"); EstudiantesDataGridView.Focus(); paso = false; } SemestreRepositorio repositorio = new SemestreRepositorio(); Semestres semestre = repositorio.Buscar((int)SemestreIdNumericUpDown.Value); if (semestre == null) { MyErrorProvider.SetError(SemestreIdNumericUpDown, "Debe de insertar un id de un semestre valido"); SemestreIdNumericUpDown.Focus(); return(false); } if (!semestre.Activo) { MyErrorProvider.SetError(SemestreIdNumericUpDown, "Debe de insertar un id de un semestre activo"); SemestreIdNumericUpDown.Focus(); paso = false; } return(paso); }