/// <summary>
        /// Changes default configuration for DocumentDB data adapters.
        /// </summary>
        /// <param name="defaults">New default configuration.</param>
        public static void SetCurrent(IDefaults defaults)
        {
            Guard.NotNull("defaults", defaults);

            lock (updateLock)
                current = defaults;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Instance a new Stack Client plugin container.
 /// </summary>
 /// <param name="defaults">Defaults values for queries executed against this client.</param>
 /// <param name="handler">A request handler for this client.</param>
 /// <param name="logger">Event log message dispatcher.</param>
 /// <param name="cache">API Response cache store.</param>
 /// <param name="throttler">Request throttler.</param>
 public StackClientPlugins(IDefaults defaults, IRequestHandler handler, IEventLog logger, IResponseCache cache, IRequestThrottler throttler)
 {
     if (defaults == null)
     {
         throw new ArgumentNullException("defaults");
     }
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     if (cache == null)
     {
         throw new ArgumentNullException("cache");
     }
     if (throttler == null)
     {
         throw new ArgumentNullException("throttler");
     }
     Default = defaults;
     RequestHandler = handler;
     EventLog = logger;
     Cache = cache;
     Throttler = throttler;
 }
        private static IDefaults GetCurrent()
        {
            if (current == null) lock (updateLock) if (current == null)
                        current = new LibraryDefaults();

            return current;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Updates query string parameters with defaults values, if not overridden.
 /// </summary>
 /// <param name="query">The query string parameters object.</param>
 /// <param name="defaults">The client defaults.</param>
 /// <returns>The query string parameters with default values applied.</returns>
 public static IQuery WithDefault(this IQuery query, IDefaults defaults)
 {
     if (query is ISiteQuery)
     {
         ((ISiteQuery)query).Site = ((ISiteQuery)query).Site ?? defaults.Site;
     }
     if (query is IPagedQuery)
     {
         ((IPagedQuery)query).PageSize = ((IPagedQuery)query).PageSize ?? defaults.PageSize;
     }
     if (query is IFilteredQuery)
     {
         ((IFilteredQuery)query).Filter = ((IFilteredQuery)query).Filter ?? defaults.Filter;
     }
     return query;
 }
Exemplo n.º 5
0
 /// <summary>
 /// The Work Order controller is responsible for handling all REST actions related to the
 /// creation, modification, processing and retaining of Work Orders created by staff or
 /// employers (hirers/2.0).
 /// </summary>
 /// <param name="woServ">Work Order service</param>
 /// <param name="reqServ">Req serv</param>
 /// <param name="defaults">Default config values</param>
 /// <param name="map">AutoMapper service</param>
 /// <param name="adaptor"></param>
 /// <param name="tenantService"></param>
 public WorkOrderController(
     IWorkOrderService woServ,
     IWorkerRequestService reqServ,
     IDefaults defaults,
     IMapper map,
     IModelBindingAdaptor adaptor,
     ITenantService tenantService
     )
 {
     _woServ             = woServ;
     _reqServ            = reqServ;
     _map                = map;
     _adaptor            = adaptor;
     _defaults           = defaults;
     _clientTimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(tenantService.GetCurrentTenant().Timezone);
 }
Exemplo n.º 6
0
        public WorkAssignmentController(IWorkAssignmentService workAssignmentService,
                                        IWorkerService workerService,
                                        IWorkOrderService workOrderService,
                                        IWorkerSigninService signinService,
                                        ILookupCache lc,
                                        IDefaults def,
                                        IMapper map)

        {
            this.waServ  = workAssignmentService;
            this.wkrServ = workerService;
            this.woServ  = workOrderService;
            this.wsiServ = signinService;
            this.lcache  = lc;
            this.map     = map;
            this.def     = def;
        }
Exemplo n.º 7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="woServ">Work Order service</param>
 /// <param name="waServ">Work Assignment service</param>
 /// <param name="eServ">Employer service</param>
 /// <param name="wServ">Worker service</param>
 /// <param name="wrServ">Worker request service</param>
 /// <param name="lcache">Lookup cache</param>
 public WorkOrderController(IWorkOrderService woServ,
                            IWorkAssignmentService waServ,
                            IEmployerService eServ,
                            IWorkerService wServ,
                            IWorkerRequestService wrServ,
                            ILookupCache lcache,
                            IDefaults def,
                            IMapper map)
 {
     this.woServ = woServ;
     this.eServ  = eServ;
     this.wServ  = wServ;
     this.waServ = waServ;
     this.wrServ = wrServ;
     this.lcache = lcache;
     this.map    = map;
     this.def    = def;
 }
 public WorkAssignmentController(
     IWorkAssignmentService workAssignmentService,
     IWorkOrderService workOrderService,
     IWorkerSigninService signinService,
     IDefaults defaults,
     IMapper map,
     IModelBindingAdaptor adaptor,
     ITenantService tenantService
     )
 {
     waServ              = workAssignmentService;
     woServ              = workOrderService;
     wsiServ             = signinService;
     this.map            = map;
     _defaults           = defaults;
     _adaptor            = adaptor;
     _clientTimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(tenantService.GetCurrentTenant().Timezone);
 }
        public GetAssetGroupedTransactionsQueryHandler(IUserCacheService cacheService,
                                                       IAssetRepository assetRepository,
                                                       ITransactionRepository transactionRepository,
                                                       IForexService forexService,
                                                       IUserRepository userRepository,
                                                       ICurrencyRepository currencyRepository,
                                                       IDefaults defaults,
                                                       IMapper mapper)
            : base(cacheService)
        {
            _assetRepository       = assetRepository;
            _transactionRepository = transactionRepository;
            _forexService          = forexService;
            _userRepository        = userRepository;
            _currencyRepository    = currencyRepository;
            _defaults = defaults;
            _mapper   = mapper;

            cacheService.SetSlidingExpiration(TimeSpan.FromMinutes(10));
        }
Exemplo n.º 10
0
            /// <summary>
            /// Initializes a new instance of the <see cref="SettingsStorage" /> class.
            /// </summary>
            /// <param name="path">The registry path.</param>
            /// <param name="defaults">The default values.</param>
            public SettingsStorage(string path, IDefaults defaults)
            {
                if (path == null)
                {
                    throw new ArgumentNullException(nameof(path));
                }

                if (defaults == null)
                {
                    throw new ArgumentNullException(nameof(defaults));
                }

                try
                {
                    this.registry = Registry.CurrentUser.CreateSubKey(path);
                    this.displayMode = DisplayMode.Select(this[nameof(DisplayMode)]);
                    this.useVerticalSync = this[nameof(UseVerticalSync)].ParseAsBoolean(defaults.UseVerticalSync);
                    this.useFrameRateLimit = this[nameof(UseFrameRateLimit)].ParseAsBoolean(defaults.UseFrameRateLimit);
                }
                catch (Exception error)
                {
                    Trace.TraceError("Failed to open the registry key '{0}'. {1}", path, error);
                }
            }