/// <summary> /// Initializes a new instance of the <see cref="Location"/> class. /// </summary> /// <param name="agency">The agency.</param> /// <param name="locationProfile">The location profile.</param> protected internal Location(Agency agency, LocationProfile locationProfile) : this() { Check.IsNotNull(agency, () => Agency); Check.IsNotNull(locationProfile, () => LocationProfile); _agency = agency; _locationProfile = locationProfile; }
/// <summary> /// Creates the location. /// </summary> /// <param name="agency">The agency.</param> /// <param name="locationProfile">The location profile.</param> /// <returns> /// A Location. /// </returns> public Location CreateLocation(Agency agency, LocationProfile locationProfile) { Check.IsNotNull(agency, "agency is required."); Check.IsNotNull(locationProfile, "locationProfile is required."); var newLocation = new Location(agency, locationProfile); Location createdLocation = null; DomainRuleEngine.CreateRuleEngine(newLocation, "CreateLocationRuleSet") .Execute(() => { _locationRepository.MakePersistent(newLocation); createdLocation = newLocation; }); return(createdLocation); }
/// <summary> /// Determines if the values are equal. /// </summary> /// <param name="otherLocationProfile">The other location profile.</param> /// <param name="otherLocationProfileAgency">The other location profile agency.</param> /// <returns> /// A boolean denoting equality of the values. /// </returns> public virtual bool ValuesEqual(LocationProfile otherLocationProfile, Agency otherLocationProfileAgency) { return(LocationProfile.LocationName.Name.Equals(otherLocationProfile.LocationName.Name) && Agency.Key == otherLocationProfileAgency.Key); }
/// <summary> /// The revise location profile. /// </summary> /// <param name="locationProfile"> /// The location profile. /// </param> public virtual void ReviseLocationProfile(LocationProfile locationProfile) { Check.IsNotNull(locationProfile, () => LocationProfile); LocationProfile = locationProfile; }