internal static Tuple<string, string> GetAddress(PersonAddressDO personAddress, INomRepository nomRepository) { List<string> addressData = new List<string>(); List<string> addressDataAlt = new List<string>(); if (personAddress.SettlementId.HasValue) { NomValue settlement = nomRepository.GetNomValue("cities", personAddress.SettlementId.Value); NomValue country = nomRepository.GetNomValue("countries", settlement.ParentValueId.Value); addressDataAlt.Add(country.NameAlt); addressDataAlt.Add(settlement.NameAlt); addressData.Add(country.Name); addressData.Add(settlement.Name); } if (personAddress != null) { if (!string.IsNullOrEmpty(personAddress.AddressAlt)) { addressDataAlt.Add(personAddress.AddressAlt); } if (!string.IsNullOrEmpty(personAddress.Address)) { addressData.Add(personAddress.Address); } } return new Tuple<string, string>(string.Join(", ", addressDataAlt), string.Join(", ", addressData)); }
private object GetPersonData(PersonDataDO personData, PersonAddressDO personAddress) { NomValue placeOfBirth = null; NomValue country = null; NomValue nationality = null; if (personData.PlaceOfBirthId.HasValue) { placeOfBirth = this.nomRepository.GetNomValue("cities", personData.PlaceOfBirthId.Value); country = this.nomRepository.GetNomValue("countries", placeOfBirth.ParentValueId.Value); nationality = this.nomRepository.GetNomValue("countries", personData.CountryId.Value); } var address = Utils.GetAddress(personAddress, this.nomRepository); return new { FAMILY_BG = personData.LastName.ToUpper(), FAMILY_TRANS = personData.LastNameAlt.ToUpper(), FIRST_NAME_BG = personData.FirstName.ToUpper(), FIRST_NAME_TRANS = personData.FirstNameAlt.ToUpper(), SURNAME_BG = personData.MiddleName.ToUpper(), SURNAME_TRANS = personData.MiddleNameAlt.ToUpper(), DATEPLACE_OF_BIRTH = new { DATE_OF_BIRTH = personData.DateOfBirth, PLACE_OF_BIRTH = new { COUNTRY_NAME = country != null ? country.Name : null, TOWN_VILLAGE_NAME = placeOfBirth != null? placeOfBirth.Name : null }, PLACEBIRTH_TRANS = new { COUNTRY_NAME = country != null ? country.NameAlt : null, TOWN_VILLAGE_NAME = placeOfBirth != null ? placeOfBirth.NameAlt : null } }, ADDRESS_BG = address.Item2, ADDRESS_TRANS = address.Item1, NATIONALITY = new { COUNTRY_NAME_BG = nationality != null? nationality.Name : null, COUNTRY_CODE = nationality != null? nationality.TextContent.Get<string>("nationalityCodeCA") : null } }; }
private object GetPersonData(PersonDataDO personData, PersonAddressDO personAddress) { var address = Utils.GetAddress(personAddress, this.nomRepository); var placeOfBirth = Utils.GetPlaceOfBirth(personData, nomRepository); return new { FAMILY_BG = personData.LastName.ToUpper(), FAMILY_TRANS = personData.LastNameAlt.ToUpper(), FIRST_NAME_BG = personData.FirstName.ToUpper(), FIRST_NAME_TRANS = personData.FirstNameAlt.ToUpper(), SURNAME_BG = personData.MiddleName.ToUpper(), SURNAME_TRANS = personData.MiddleNameAlt.ToUpper(), DATE_OF_BIRTH = personData.DateOfBirth, PLACE_OF_BIRTH = placeOfBirth.Item2, PLACE_OF_BIRTH_TRAN = placeOfBirth.Item1, ADDRESS = address.Item2, ADDRESS_TRANS = address.Item1 }; }
private object GetPersonData(PersonDataDO personData, PersonAddressDO personAddress) { NomValue placeOfBirth = null; NomValue country = null; NomValue nationality = null; if (personData.PlaceOfBirthId.HasValue) { placeOfBirth = this.nomRepository.GetNomValue("cities", personData.PlaceOfBirthId.Value); country = this.nomRepository.GetNomValue("countries", placeOfBirth.ParentValueId.Value); nationality = this.nomRepository.GetNomValue("countries", personData.CountryId.Value); } NomValue settlement = null; if (personAddress.SettlementId.HasValue) { settlement = this.nomRepository.GetNomValue("cities", personAddress.SettlementId.Value); } return new { FAMILY_BG = personData.LastName.ToUpper(), FAMILY_TRANS = personData.LastNameAlt.ToUpper(), FIRST_NAME_BG = personData.FirstName.ToUpper(), FIRST_NAME_TRANS = personData.FirstNameAlt.ToUpper(), SURNAME_BG = personData.MiddleName.ToUpper(), SURNAME_TRANS = personData.MiddleNameAlt.ToUpper(), DATE_PLACE_OF_BIRTH = new { DATE_OF_BIRTH = personData.DateOfBirth, PLACE_OF_BIRTH = new { COUNTRY_NAME = country != null ? country.Name : null, TOWN_VILLAGE_NAME = placeOfBirth != null ? placeOfBirth.Name : null, }, PLACE_OF_BIRTH_TRANS = new { COUNTRY_NAME = country != null ? country.NameAlt : null, TOWN_VILLAGE_NAME = placeOfBirth != null ? placeOfBirth.NameAlt : null, } }, ADDRESS = string.Format( "{0}, {1}", settlement != null ? settlement.Name : null, personAddress.Address), ADDRESS_TRANS = string.Format( "{0}, {1}", personAddress.AddressAlt, settlement != null ? settlement.NameAlt : null), NATIONALITY = new { COUNTRY_NAME_BG = country.Name, COUNTRY_CODE = nationality.TextContent.Get<string>("nationalityCodeCA"), } }; }
internal static object GetLicenceHolder(PersonDataDO personData, PersonAddressDO personAddress, INomRepository nomRepository) { var address = GetAddress(personAddress, nomRepository).Item2; return new { NAME = string.Format( "{0} {1} {2}", personData.FirstName, personData.MiddleName, personData.LastName).ToUpper(), LIN = personData.Lin, EGN = personData.Uin, ADDRESS = address, TELEPHONE = GetPhonesString(personData) }; }