Exemplo n.º 1
0
        /// <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;
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 4
0
        /// <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;
        }