/// <summary> /// Fill the Countries table from the Database basing on the AirlineCompanies data source /// </summary> private void AddCountries() { _currentDAO = CreateAppropriateDAO(); _currentDAO.DeleteAllNotRegardingForeignKeys(); List <string> countries_names = new List <string>(); foreach (var s_airline in _airlineCompaniesFromExternalSource) { s_airline.TryGetValue("country", out string s_airline_country_name); if (!countries_names.Contains(s_airline_country_name)) { countries_names.Add(s_airline_country_name); } } foreach (var s_country_name in countries_names) { Country country = new Country(); country.COUNTRY_NAME = _regex.Replace(s_country_name, string.Empty); country.COUNTRY_IDENTIFIER = Convert.ToInt64(Statics.GetUniqueKeyOriginal_BIASED(_rnd.Next(4, 9), Charset.OnlyNumber)); _currentDAO.Add(country as T); } }
private void GenerateUtility_class_UserPasswordAndName(out string nameCrypt, out string passwordCrypt) { string nameForEncription = Statics.GetUniqueKeyOriginal_BIASED(_rnd.Next(5, 8)); string passForEncription = Statics.GetUniqueKeyOriginal_BIASED(_rnd.Next(5, 15)); string encryptedName = Statics.Encrypt(nameForEncription, ENCRIPTION_PHRASE); string encryptedPassword = Statics.Encrypt(passForEncription, ENCRIPTION_PHRASE); nameCrypt = encryptedName; passwordCrypt = encryptedPassword; }
private void AddOneCustomer() { RandomUserAPIObject deserializedRandomUserObject = JsonConvert.DeserializeObject <RandomUserAPIObject>(Statics.ReadFromUrl(_apiUrl)); Customer customer = new Customer(); customer.FIRST_NAME = deserializedRandomUserObject.results[0].name.first; customer.LAST_NAME = deserializedRandomUserObject.results[0].name.last; customer.PHONE_NO = deserializedRandomUserObject.results[0].phone; customer.ADDRESS = $"{deserializedRandomUserObject.results[0].location.city}, {deserializedRandomUserObject.results[0].location.street} st, {deserializedRandomUserObject.results[0].location.coordinates.latitude} / {deserializedRandomUserObject.results[0].location.coordinates.longitude}"; customer.CREDIT_CARD_NUMBER = Statics.Encrypt(Statics.DashingString(Statics.GetUniqueKeyOriginal_BIASED(20, Charset.OnlyNumber), 4), ENCRIPTION_PHRASE); customer.IMAGE = ImageProvider.GetResizedCustomerImageAs64BaseString(4); _currentWithUtility_clas_UserDAO = CreateAppropriateDAO_WithUtility_class_User(); GenerateUtility_class_UserPasswordAndName(out string nameCrypt, out string passsCrypt); _currentWithUtility_clas_UserDAO.Add(customer as T, nameCrypt, passsCrypt); }
private void AddOneAirlineCompany(int index) { AirlineCompany airline = new AirlineCompany(); airline.AIRLINE_NAME = _regex.Replace(_airlineCompaniesFromExternalSource[index]["name"], string.Empty); airline.IMAGE = ImageProvider.GetResizedAirlineImageAs64BaseString(4); airline.ADORNING = _airlineCompaniesFromExternalSource[index]["adorning"] + " " + Statics.GetUniqueKeyOriginal_BIASED(_rnd.Next(2, 4), Charset.OnlyNumber); string airline_country_name = _regex.Replace(_airlineCompaniesFromExternalSource[index]["country"], string.Empty); foreach (var s_country in _countries) { if (airline_country_name.Equals(s_country.COUNTRY_NAME)) { airline.COUNTRY_CODE = s_country.ID; } } _currentWithUtility_clas_UserDAO = CreateAppropriateDAO_WithUtility_class_User(); GenerateUtility_class_UserPasswordAndName(out string nameCrypt, out string passsCrypt); _currentWithUtility_clas_UserDAO.Add(airline as T, nameCrypt, passsCrypt); }