public bool IsOKWithGeolocation(Member user) { if (!IsGeolocated) { return(true); } if (!String.IsNullOrWhiteSpace(GeolocatedCC) && !GeolocatedCC.Contains(user.CountryCode.Trim())) { return(false); } if (GeolocatedAgeMin > 0 && user.Age < GeolocatedAgeMin) { return(false); } if (GeolocatedAgeMax > 0 && user.Age > GeolocatedAgeMax) { return(false); } if (GeolocatedGender != Gender.Null && GeolocatedGender != user.Gender) { return(false); } return(true); }
/// <summary> /// Checks whether the member passes the geolocation requirements or not /// </summary> /// <param name="user"></param> /// <returns></returns> public bool IsGeolocationMeet(Member user) { if (IsGeolocated) { try { if (IsGeolocatedByCountry && !GeolocatedCC.Contains(user.CountryCode)) { return(false); } if (IsGeolocatedByCity && !GeolocatedCities.Contains(user.City)) { return(false); } if (IsGeolocatedByGender && user.Gender != GeolocatedGender) { return(false); } if (GeolocatedAgeMin > 0 && user.Age < GeolocatedAgeMin) { return(false); } if (GeolocatedAgeMax > 0 && user.Age > GeolocatedAgeMax) { return(false); } if (!IsGeolocationProfileMeet(GeolocationProfile, user)) { return(false); } } catch (Exception ex) { ErrorLogger.Log(ex); } } return(true); }
public bool IsGeolocationMet(string countryCode, int?age, Gender gender) { if (IsGeolocated) { try { if (IsGeolocatedByCountry && !GeolocatedCC.Contains(countryCode)) { return(false); } //Geolocation by city is not implemented //if (IsGeolocatedByCity && !GeolocatedCities.Contains(user.City)) // return false; if (IsGeolocatedByGender && gender != GeolocatedGender) { return(false); } if (GeolocatedAgeMin > 0 && (!age.HasValue || age < GeolocatedAgeMin)) { return(false); } if (GeolocatedAgeMax > 0 && (!age.HasValue || age > GeolocatedAgeMax)) { return(false); } } catch (Exception ex) { ErrorLogger.Log(ex); } } return(true); }