private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int aux = 0; if (string.IsNullOrEmpty(this.txtDescripcion.Text.Trim())) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Ingrese una descripción válida.", ControlSender = this.txtDescripcion }); } else if (!Validar.IsValidDescripcion(this.txtDescripcion.Text)) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Ingrese una descripción válida.", ControlSender = this.txtDescripcion }); } if (string.IsNullOrEmpty(this.txtSueldoBase.Text.Trim())) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Ingrese un sueldo válido.", ControlSender = this.txtSueldoBase }); } else if (!Validar.IsValidDecimal(this.txtSueldoBase.Text)) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Ingrese un sueldo válido.", ControlSender = this.txtSueldoBase }); } return(Errores); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; if (string.IsNullOrEmpty(this.txtNombreCurso.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre del curso.", ControlSender = this.txtNombreCurso }); } if (string.IsNullOrEmpty(this.txtDescripcion.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar la descripción del curso.", ControlSender = this.txtDescripcion }); } if (string.IsNullOrEmpty(this.txtObejetivoGeneral.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar el Objetivo General.", ControlSender = this.txtObejetivoGeneral }); } if (string.IsNullOrEmpty(this.txtCalicacionMinAprovatoria.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Calificación Aprobatoria>>.", ControlSender = this.txtCalicacionMinAprovatoria }); } else { if (!Validar.IsValidDecimal(this.txtCalicacionMinAprovatoria.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Calificación Aprobatoria>>.", ControlSender = this.txtCalicacionMinAprovatoria }); } } if (string.IsNullOrEmpty(this.txtHoras.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Hora>>.", ControlSender = this.txtHoras }); } else { if (!Validar.IsValidOnlyNumber(this.txtHoras.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un dato válido para <<Hora>>.", ControlSender = this.txtHoras }); } } if (this.dgvTemasCursos.Rows.Count == 0) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe de seleccionar al menos un tema del curso", ControlSender = this.btnAgregarTemaCurso }); } return(Errores); } catch (Exception ex) { throw ex; } }