public BasicCity[] GetCitiesByCountry(string countryCode) { BasicCountry country = GetCountry(countryCode); using (DbConnection connection = GetMySqlDbConnection()) { connection.Open(); DbCommand command = GetDbCommand( "SELECT " + cityFieldSequence + " WHERE CountryId=" + country.CountryId, connection); List <BasicCity> result = new List <BasicCity>(); using (DbDataReader reader = command.ExecuteReader()) { if (reader.Read()) { result.Add(ReadCityFromDataReader(reader)); while (reader.Read()) { result.Add(ReadCityFromDataReader(reader)); } } return(result.ToArray()); } } }
public static Person Create(string name, string email, string password, string phone, string street, string postal, string city, string countryCode, DateTime dateOfBirth, PersonGender gender) { BasicCountry country = null; if (countryCode.Length > 0) { country = Country.FromCode(countryCode); } // Clean data while (name.Contains(" ")) { name = name.Replace(" ", " "); } name = name.Trim(); email = email.ToLower().Trim(); phone = LogicServices.CleanNumber(phone); postal = postal.Replace(" ", "").Trim(); int personId = SwarmDb.GetDatabaseForWriting().CreatePerson(name, email, phone, street, postal, city, country == null ? 0 : country.Identity, dateOfBirth, gender); // Resolve the geography Person newPerson = FromIdentityAggressive(personId); // aggressive bypasses replication lag, avoids race condition newPerson.ResolveGeography(); // Generate the salted password hash and set it if (password.Length > 0) { newPerson.PasswordHash = Authentication.GenerateNewPasswordHash(personId, password); } else { newPerson.PasswordHash = string.Empty; // if no password, prevent matching to anything } // Return the finished Person object return(newPerson); }
public BasicPerson[] GetPeopleFromPhoneNumber(string countryCode, string phoneNumber) { BasicCountry country = GetCountry(countryCode); return(GetPeopleFromPhoneNumber(country.Identity, phoneNumber)); }
public static Country FromBasic(BasicCountry basic) { return(new Country(basic)); }
private Country(BasicCountry basic) : base(basic) { }