static model.PersonAddress MergePersonAddress(model.Person person, model.Address address, DateTime date) { Logger.generatorMergePA(); try { var personAddress = new model.PersonAddress(); if (address.City != null) { personAddress.Person = person; personAddress.Address = address; if (RandomNumber.Draw(1, 10) < 8) { personAddress.Assigned = person.BirthDate; } else { personAddress.Assigned = Date.getDate(person.BirthDate); } } return(personAddress); } catch (Exception e) { Logger.log(e); return(null); } }
static model.Address SetAddress(string street) { try { Logger.generatorSetAddress(); ClearGeoAPI geo = GetDataFromJson.getGeo("", street); try { if (geo == null) { throw new NullReferenceException(); } } catch (NullReferenceException e) { Logger.log(e); return(new model.Address()); } if (geo.City == null) { Logger.generatorSetAddressError(); return(new model.Address { City = "null", Street = "null" }); } if (geo.City == street) { Logger.generatorSetAddressTheSameError(); return(new model.Address { City = "null", Street = "null" }); } model.Address address = new model.Address { City = geo.City, Street = street + HouseNumber.GetHouseNumber(), Voivodeship = geo.Voivodeship, Location = new String($"{geo.Latiude}, {geo.Longitude}") }; return(address); } catch (Exception e) { Logger.log(e); return(null); } }