private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int Aux = 0; if (string.IsNullOrEmpty(this.txtRazonSocial.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar la razón social de la empresa.", ControlSender = this.txtRazonSocial }); } else { if (!Validar.IsValidDescripcion(this.txtRazonSocial.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar una razón social válida.", ControlSender = this.txtRazonSocial }); } } if (string.IsNullOrEmpty(this.txtSucursal.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre de sucursal.", ControlSender = this.txtSucursal }); } else { if (!Validar.IsValidDescripcion(this.txtSucursal.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar una nombre de sucursal válido.", ControlSender = this.txtSucursal }); } } if (string.IsNullOrEmpty(this.txtUsuario.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre de usuario.", ControlSender = this.txtUsuario }); } else { if (!Validar.IsValidUserName(this.txtUsuario.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar un nombre deusuario válido.", ControlSender = this.txtUsuario }); } } if (string.IsNullOrEmpty(this.txtPassword.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar una contraseña.", ControlSender = this.txtPassword }); } else { if (!Validar.IsValidPassword(this.txtPassword.Text.Trim())) { Errores.Add(new Error { Numero = (Aux += 1), Descripcion = "Debe ingresar una contraseña válida: Debe contener al menos una letra mayúscula, una letra minúscula, un número o caracter especial, y mínimo 8 caracteres de longitud.", ControlSender = this.txtPassword }); } } return(Errores); } catch (Exception ex) { throw ex; } }