Ejemplo n.º 1
0
      /// <summary>Creates a new <see cref="SiteInfo"/> instance from the given BPL site entity and given (optional) operator.</summary>
      public SiteInfo(Site site, Operator opco) {
         if (site == null) return;

         SiteId = Class.CreateId(site.Id.LocalId);
         Operator = opco;
         Type = site.PoiType;
         Position = site.Position;
         
         if (!site.LocalizedName.IsEmpty) {
            Name = site.LocalizedName;
         } else if (site.Name.NotEmpty()) {
            Name = new MultiString(site.Name);
         }
         
         if (!site.LocalizedAddress.IsEmpty) {
            Address = (MultiAddress)site.LocalizedAddress;
         } else if (site.Address != null) {
            Address = new MultiAddress(site.Address);
         }
         
         var biz = site.BusinessInfo;
         if (biz != null) {
            Description = biz.Description;
            WorkingHours = biz.WorkingHours;
            if (biz.RatingCount > 0) {
               RatingCount = biz.RatingCount;
               RatingScore = ((Percent)biz.RatingScore).Normalize();
            } else {
               RatingScore = Percent.Undefined;
            }
            foreach (var p in biz.PhoneNumbers) {
               Contacts.Add(new Contact { Type = ContactTypes.Phone, Value = p.ToString() });
            }
            if (biz.Email.NotEmpty()) {
               Contacts.Add(new Contact { Type = ContactTypes.Email, Value = biz.Email });
            }
            if (biz.Website.NotEmpty()) {
               Contacts.Add(new Contact { Type = ContactTypes.Website, Value = biz.Website });
            }
            CustomProperties = biz.CustomProperties;
         }
      }
Ejemplo n.º 2
0
 /// <summary>Creates a new <see cref="DrivingStep"/> instance with the given target.</summary>
 public DrivingStep(Site target) {
    Target = target;
 }
Ejemplo n.º 3
0
 /// <summary>Creates a new <see cref="Destination"/> instance from the given site.</summary>
 public Destination(Site site) {
    Steps.Add(new DestinationStep(site));
 }
Ejemplo n.º 4
0
 /// <summary>Checks whether this route has the same target as the given site.</summary>
 public bool TargetEquals(Site other) {
    if (Target == null || other == null) return false;
    if (Target == other) return true;
    return Target.IdentityEquals(other);
 }
Ejemplo n.º 5
0
 /// <summary>Creates a new <see cref="Route"/> instance for the given site.</summary>
 public Route(Site target) {
    Target = target;
 }
Ejemplo n.º 6
0
 /// <summary>Creates a new <see cref="DestinationStep"/> instance from the given site.</summary>
 public DestinationStep(Site site) {
    TargetId = site.Id;
 }
Ejemplo n.º 7
0
 /// <summary>Compares two sites for equality based on geographical position and physical address.</summary>
 public bool GeographicallyEquals(Site other) {
    if (Position.AlmostEquals(other.Position)) {
       return AddressStruct.MemberwiseEquals(Address, other.Address);
    }
    return false;
 }
Ejemplo n.º 8
0
 /// <summary>Override this method to control the site pruning operation.</summary>
 protected virtual void PruneOverride(Site clone) {
    if (Address != null) {
       clone.Address = Address.Clone();
    }
    if (BusinessInfo != null) {
       clone.BusinessInfo = BusinessInfo.Clone();
    }
 }