/// <summary> /// Initializes geo location using entity data. /// </summary> /// <param name="entity">Entity data.</param> private void _InitGeoLocation(DataModel.Locations entity) { if (entity.X != null && entity.Y != null) { _geoLocation = new Point(entity.X.Value, entity.Y.Value); } }
/// <summary> /// Initializes TimeWindow2 usind entity data. /// </summary> /// <param name="entity">Entity data.</param> private void _InitTimeWindow2(DataModel.Locations entity) { if (entity.OpenFrom2 != null && entity.OpenTo2 != null) { _SetTimeWindow2(entity); } else { _ClearTimeWindow2(); } _timeWindow2.PropertyChanged += new PropertyChangedEventHandler(_TimeWindow2PropertyChanged); }
/// <summary> /// Initializes a new instance of the <c>Location</c> class. /// </summary> /// <param name="entity">Entity data.</param> internal Location(DataModel.Locations entity) : base(entity) { Debug.Assert(0 < entity.CreationTime); // NOTE: must be inited // Enable address validation. IsAddressValidationEnabled = true; // init holder objects _InitTimeWindow(entity); _InitTimeWindow2(entity); _InitAddress(entity); _InitGeoLocation(entity); }
/// <summary> /// Initializes Address property using entity data. /// </summary> /// <param name="entity">Entity data.</param> private void _InitAddress(DataModel.Locations entity) { Address.FullAddress = entity.FullAddress; Address.Unit = entity.Unit; Address.AddressLine = entity.AddressLine; Address.Locality1 = entity.Locality1; Address.Locality2 = entity.Locality2; Address.Locality3 = entity.Locality3; Address.CountyPrefecture = entity.CountyPrefecture; Address.PostalCode1 = entity.PostalCode1; Address.PostalCode2 = entity.PostalCode2; Address.StateProvince = entity.StateProvince; Address.Country = entity.Country; Address.MatchMethod = entity.Locator; // ToDo rename MatchMethod _SubscribeToAddressEvent(); }
/// <summary> /// Sets time window 2 using data from database. /// </summary> /// <param name="entity">Entity object Locations.</param> private void _SetTimeWindow2(DataModel.Locations entity) { _timeWindow2 = TimeWindow.CreateFromEffectiveTimes(new TimeSpan((long)entity.OpenFrom2), new TimeSpan((long)entity.OpenTo2)); }
/// <summary> /// Deprecated Method for adding a new object to the Locations EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToLocations(Locations locations) { base.AddObject("Locations", locations); }
/// <summary> /// Create a new Locations object. /// </summary> /// <param name="id">Initial value of the Id property.</param> public static Locations CreateLocations(global::System.Guid id) { Locations locations = new Locations(); locations.Id = id; return locations; }