Ejemplo n.º 1
0
 internal void Handle(SiteAvailabilityRequest request) {
    var resp = new SiteAvailabilityResponse();
    if (MockupHelpers.IsActivated(request.DriverId)) {
       var res = new List<SiteAvailability>();
       foreach (var id in request.SiteIds) {
          if (SitesUpdateHandler.SitesCache.Select(s => s.Id).Contains(id)) {
             var r = new SiteAvailability {
                Availability = new Percent(_rndSiteAvailability.NextDouble()),
                SiteId = id,
                StdDev = Percent.Undefined,
                TimeFrame = TimeFrame.Unbounded,
             };
             res.Add(r);
          }
       }
       resp.Result.AddRange(res);
    }
    Reply(resp);
 }
Ejemplo n.º 2
0
 private IEnumerable<SiteAvailability> _toAvailabilities(G.SiteAvailability sa) {
    var res = new List<SiteAvailability>();
    if (sa != null && sa.AvailabilityList != null) {
       foreach (var sai in sa.AvailabilityList) {
          var a = new SiteAvailability {
             SiteId = BplIdentity.Get(sa.SiteId),
             TimeFrame = _toTimeFrame(sai.DateTimeFrame),
             Availability = new Percent(sai.Availability1)
          };
          res.Add(a);
       }
    }
    return res;
 }