/// <summary> /// The add operation schedule. /// </summary> /// <param name="name"> /// The name. /// </param> /// <returns> /// A LocationOperationSchedule. /// </returns> public virtual LocationOperationSchedule AddOperationSchedule(string name) { Check.IsNotNullOrWhitespace(name, "LocationOperationSchedule name is required."); LocationOperationSchedule locationOperationSchedule = null; var newLocationOperatingSchedule = new LocationOperationSchedule(name); DomainRuleEngine.CreateRuleEngine(this, "AddOperationSchedule") .WithContext(newLocationOperatingSchedule) .Execute(() => { locationOperationSchedule = newLocationOperatingSchedule; locationOperationSchedule.Location = this; _locationOperationSchedules.Add(locationOperationSchedule); NotifyItemAdded(() => LocationOperationSchedules, locationOperationSchedule); }); return(locationOperationSchedule); }
/// <summary> /// The remove operation schedule. /// </summary> /// <param name="locationOperationSchedule"> /// The location operation schedule. /// </param> public virtual void RemoveOperationSchedule(LocationOperationSchedule locationOperationSchedule) { _locationOperationSchedules.Delete(locationOperationSchedule); NotifyItemRemoved(() => LocationOperationSchedules, locationOperationSchedule); }
/// <summary> /// The add operation schedule. /// </summary> /// <param name="name"> /// The name. /// </param> /// <returns> /// A LocationOperationSchedule. /// </returns> public virtual LocationOperationSchedule AddOperationSchedule(string name) { Check.IsNotNullOrWhitespace(name, "LocationOperationSchedule name is required."); LocationOperationSchedule locationOperationSchedule = null; var newLocationOperatingSchedule = new LocationOperationSchedule ( name ); DomainRuleEngine.CreateRuleEngine( this, "AddOperationSchedule" ) .WithContext(newLocationOperatingSchedule) .Execute(() => { locationOperationSchedule = newLocationOperatingSchedule; locationOperationSchedule.Location = this; _locationOperationSchedules.Add(locationOperationSchedule); NotifyItemAdded(() => LocationOperationSchedules, locationOperationSchedule); }); return locationOperationSchedule; }