public FrmSeleccionarLibroPresupuesto(IClock clock, IFormFactory formFactory,
                                   IRepository<TituloStockMigracion> migracionRepo,
                                   ILaPazUow uow,
                                   ITituloNegocio tituloNegocio,
                                   IMessageBoxDisplayService messageBoxDisplayService,
                                   Guid id)
        {
            FormFactory = formFactory;
            Uow = uow;
            _clock = clock;
            InitializeComponent();

            _migracionRepo = migracionRepo;
            _messageBoxDisplayService = messageBoxDisplayService;
            _tituloNegocio = tituloNegocio;
            _Tituloid = id;

            ConfigurarColumnas();

            this.MainGrid = GridTitulos;
            this.MainPager = TitulosPager;

            this.UcFiltrosLibros.CkbEliminados.Visible = false;

            InicializarPaginador();
        }
Esempio n. 2
0
        public PostPartHandler(IRepository<PostPartRecord> repository, 
            IPostService postService, 
            IThreadService threadService, 
            IForumService forumService,
            IClock clock) {
            _postService = postService;
            _threadService = threadService;
            _forumService = forumService;
            _clock = clock;

            Filters.Add(StorageFilter.For(repository));

            OnGetDisplayShape<PostPart>(SetModelProperties);
            OnGetEditorShape<PostPart>(SetModelProperties);
            OnUpdateEditorShape<PostPart>(SetModelProperties);

            OnCreated<PostPart>((context, part) => UpdateCounters(part));
            OnPublished<PostPart>((context, part) => { 
                UpdateCounters(part);
                UpdateThreadVersioningDates(part);
            });
            OnUnpublished<PostPart>((context, part) => UpdateCounters(part));
            OnVersioned<PostPart>((context, part, newVersionPart) => UpdateCounters(newVersionPart));
            OnRemoved<PostPart>((context, part) => UpdateCounters(part));

            OnRemoved<ThreadPart>((context, b) =>
                _postService.Delete(context.ContentItem.As<ThreadPart>()));

            OnIndexing<PostPart>((context, postPart) => context.DocumentIndex
                                                    .Add("body", postPart.Record.Text).RemoveTags().Analyze()
                                                    .Add("format", postPart.Record.Format).Store());
        }
 public FrmCajaResumida(IFormFactory formFactory, IGestionAdministrativaUow uow, IReporteNegocio reporteNegocio, IClock clock)
 {
     Uow = uow;
     _reporteNegocio = reporteNegocio;
     _clock = clock;
     InitializeComponent();
 }
 public DefaultVirtualPathMonitor(IClock clock, IVirtualPathProvider virtualPathProvider)
 {
     _clock = clock;
     _virtualPathProvider = virtualPathProvider;
     _thunk = new Thunk(this);
     Logger = NullLogger.Instance;
 }
        public OutputCacheFilter(
            ICacheManager cacheManager,
            IOutputCacheStorageProvider cacheStorageProvider,
            ITagCache tagCache,
            IDisplayedContentItemHandler displayedContentItemHandler,
            IWorkContextAccessor workContextAccessor,
            IThemeManager themeManager,
            IClock clock,
            ICacheService cacheService,
            ISignals signals,
            ShellSettings shellSettings) {

            _cacheManager = cacheManager;
            _cacheStorageProvider = cacheStorageProvider;
            _tagCache = tagCache;
            _displayedContentItemHandler = displayedContentItemHandler;
            _workContextAccessor = workContextAccessor;
            _themeManager = themeManager;
            _clock = clock;
            _cacheService = cacheService;
            _signals = signals;
            _shellSettings = shellSettings;

            Logger = NullLogger.Instance;
        }
 public CreateAccountForm(ParkingDatabase db, IClock clock, IMailer mailer)
 {
     Database = db;
     FormClock = clock;
     Mailer = mailer;
     InitializeComponent();
 }
Esempio n. 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AccountServer"/> class.
        /// </summary>
        public AccountServer(IClock clock)
        {
            this.clock = clock;

            this.activeAccounts = new Dictionary<int, ActiveAccount>(256);
            this.currentSessionId = new AtomicInteger(0);
        }
Esempio n. 8
0
 // on click
 private void rbDigital_CheckedChanged(object sender, EventArgs e)
 {
     mainClock.HideClock();
     mainClock = new DigitalClock(lblDigital, timer1);
     mainClock.UpdateTimeDisplay();
     mainClock.ShowClock();
 }
 public DatabaseLock(
     ILifetimeScope lifetimeScope,
     IClock clock)
 {
     _lifetimeScope = lifetimeScope;
     _clock = clock;
 }
        public static CommandMetrics GetInstance(string name,  CommandProperties properties, IClock clock)
        {
            Contract.Assert(!String.IsNullOrEmpty(name));
            Contract.Assert(properties != null);

            return _metrics.GetOrAdd(name, n => new CommandMetrics(n, properties, clock));
        }
Esempio n. 11
0
        public CASClient(
            ShellSettings settings, 
            ITicketValidatorFactory ticketValidatorFactory,
            IRequestEvaluator requestEvaluator,
            IClock clock,
            IUrlUtil urlUtil,
            IAuthenticationService authenticationService,
            ICasServices casServices) {
            _settings = settings;
            _ticketValidatorFactory = ticketValidatorFactory;
            _requestEvaluator = requestEvaluator;
            _clock = clock;
            _urlUtil = urlUtil;
            _authenticationService = authenticationService;
            _casServices = casServices;

            _xmlNamespaceManager = new XmlNamespaceManager(_xmlNameTable);
            _xmlNamespaceManager.AddNamespace("cas", "http://www.yale.edu/tp/cas");
            _xmlNamespaceManager.AddNamespace("saml", "urn: oasis:names:tc:SAML:1.0:assertion");
            _xmlNamespaceManager.AddNamespace("saml2", "urn: oasis:names:tc:SAML:1.0:assertion");
            _xmlNamespaceManager.AddNamespace("samlp", "urn: oasis:names:tc:SAML:1.0:protocol");

            Logger = NullLogger.Instance;
            T = NullLocalizer.Instance;
        }
Esempio n. 12
0
 public RecordPhonecall(IPayAsYouGoAccountRepository payAsYouGoAccountRepository,
                    IDocumentSession unitOfWork, IClock clock)
 {
     _payAsYouGoAccountRepository = payAsYouGoAccountRepository;
     _unitOfWork = unitOfWork;
     _clock = clock;
 }
 public AdvancedSitemapService(
     IRepository<SitemapRouteRecord> routeRepository, 
     IRepository<SitemapSettingsRecord> settingsRepository,
     IRepository<SitemapCustomRouteRecord> customRouteRepository,
     IContentManager contentManager,
     ICacheManager cacheManager,
     ISignals signals,
     IClock clock,
     IContentDefinitionManager contentDefinitionManager,
     IEnumerable<ISitemapRouteFilter> routeFilters,
     IEnumerable<ISitemapRouteProvider> routeProviders, 
     ISiteService siteService, 
     IEnumerable<ISpecializedSitemapProvider> specializedSitemapProviders)
 {
     _routeRepository = routeRepository;
     _settingsRepository = settingsRepository;
     _customRouteRepository = customRouteRepository;
     _contentManager = contentManager;
     _cacheManager = cacheManager;
     _signals = signals;
     _clock = clock;
     _contentDefinitionManager = contentDefinitionManager;
     _routeFilters = routeFilters;
     _routeProviders = routeProviders;
     _siteService = siteService;
     _specializedSitemapProviders = specializedSitemapProviders;
 }
Esempio n. 14
0
        public ActionResult Index(IClock clock, IDocumentSession session)
        {
            if (clock == null) throw new ArgumentNullException("clock");
            ViewBag.Message = "Welcome to Highway Christian Church!";

            return View();
        }
Esempio n. 15
0
 private void rb_Digital_CheckedChanged(object sender, EventArgs e)
 {
     clock = new Digital_Clock(lbl_DigitalClock, timer1);
     lbl_DigitalClock.Visible = true;
     analogClock.Visible = false;
     analogClock.Enabled = false;
 }
Esempio n. 16
0
 public UsersService(
     IContentManager contentManager, 
     IOrchardServices orchardServices, 
     IRoleService roleService, 
     IMessageManager messageManager, 
     IScheduledTaskManager taskManager, 
     IRepository<EmailPartRecord> emailRepository, 
     ShellSettings shellSettings, 
     IRepository<UserRolesPartRecord> userRolesRepository, 
     ICacheManager cache, 
     IClock clock, 
     ISignals signals) 
 {
     _signals = signals;
     _clock = clock;
     _cache = cache;
     _emailRepository = emailRepository;
     _orchardServices = orchardServices;
     _contentManager = contentManager;
     _roleService = roleService;
     _messageManager = messageManager;
     _taskManager = taskManager;
     _shellSettings = shellSettings;
     _userRolesRepository = userRolesRepository;
     T = NullLocalizer.Instance;
     Logger = NullLogger.Instance;            
 }
 public ContentHub(Work<IContentManager> workContentManager,
     Work<IAuthenticationService> workAuthenticationService,
     IClock clock) {
     _workContentManager = workContentManager;
     _workAuthenticationService = workAuthenticationService;
     _clock = clock;
 }
        /// <summary>
        /// Filters the by occurrence start date between now and 90 days from now.
        /// </summary>
        /// <param name="objectSet">The object set.</param>
        /// <param name="startDate">The start date.</param>
        /// <param name="endDate">The end date.</param>
        /// <param name="clock">The clock.</param>
        /// <returns>The modified query.</returns>
        public static IQueryable<EventCacheView> AddOccurrenceDatesConditions(this IQueryable<EventCacheView> objectSet, DateTime? startDate, DateTime? endDate, IClock clock)
        {
            if (!startDate.HasValue)
            {
                startDate = clock.Now;
            }

            if (!endDate.HasValue)
            {

                return objectSet.Where(e => e.Occurrences.Count() > 0 &&
                                        e.Occurrences.Any(o => (o.OccurrenceDates.Count() > 0 && o.OccurrenceDates.All(d => d.StartDate >= startDate)) ||
                                                                (o.OccurrenceDates.Count() == 0))
                                      );

            }
            else
            {
                endDate = endDate.Value.Date.AddDays(1);
            }

            return objectSet.Where(e => e.Occurrences.Count() > 0 &&
                e.Occurrences.Any(o => (o.OccurrenceDates.Count() > 0 &&
                                        o.OccurrenceDates.All(d => d.StartDate >= startDate && d.StartDate <= endDate))));
        }
Esempio n. 19
0
 public CookieCultureSelector(IHttpContextAccessor httpContextAccessor,
     IClock clock,
     ShellSettings shellSettings) {
     _httpContextAccessor = httpContextAccessor;
     _clock = clock;
     _shellSettings = shellSettings;
 }
Esempio n. 20
0
 internal BuildHeaderWriter(IClock clock, IBuildEnvironment buildEnvironment, IOutput output, ICmdArguments cmdArguments)
 {
     _clock = clock;
     _buildEnvironment = buildEnvironment;
     _output = output;
     _cmdArguments = cmdArguments;
 }
Esempio n. 21
0
 public BidOnAuction(IAuctionRepository auctionRepository, IBidHistoryRepository bidHistoryRepository, IUnitOfWork unitOfWork, IClock clock)
 {
     _auctionRepository = auctionRepository;
     _bidHistoryRepository = bidHistoryRepository;
     _unitOfWork = unitOfWork;
     _clock = clock;
 }
        // fill the database with fake data for last month, using a test clock
        public static void FillLastMonthData(ParkingDatabase database, IClock testClock)
        {
            try
            {
                // fill with database with fake data
                for (int i = 0; i < 80; i++)
                {
                    CustomerAccount testAccount = new CustomerAccount(RandomString(), RandomString(), "555-555-5555",
                        RandomString() + "@tester.com", "password");
                    Billing.CreditCard.CreditCardType randomCardType = (Billing.CreditCard.CreditCardType)random.Next(3);
                    Billing.CreditCard testCard = new Billing.CreditCard(1234123412349876, Billing.CreditCard.CreditCardType.MASTERCARD);
                    Accounts.Vehicle testVehicle = new Accounts.Vehicle(RandomString() + " " + RandomString(),
                        RandomString());
                    DateTime startDate = new DateTime(2012, 11, 25, 10, 0, 0); // 11-25-12 @ 10a
                    DateTime testResDate = RandomTime(startDate);
                    database.AddAccount(testAccount);
                    database.AddCreditCard(testCard, testAccount.CustomerID);
                    database.AddVehicle(testVehicle, testAccount.CustomerID);
                    ParkingReservation testReservation = new ParkingReservation(testAccount, testVehicle,
                        testResDate, 120);

                    // generate a random transaction date in the past
                    int hours = random.Next(1, 500);
                    TimeSpan timeSpan = new TimeSpan(hours, 0, 0);
                    DateTime transactionDate = testResDate.Subtract(timeSpan);

                    // add reservation (and transaction) to database
                    database.AddReservation(testReservation, testCard.CardID, transactionDate);
                }
            }
            catch (Exception)
            { } // confict when adding reservation (ignore)
        }
Esempio n. 23
0
 public void SetUp()
 {
     _testDuration = new ClockDuration(  workDuration: _testTimeSpan_2ms,
                                         shortBreak: _testTimeSpan_2ms,
                                         longBreak: _testTimeSpan_2ms);
     _testClock = new Clock(_testDuration);
 }
Esempio n. 24
0
 static Chronometer()
 {
     if (RuntimeInformation.IsWindows() && WindowsClock.IsAvailable)
         BestClock = WindowsClock;
     else
         BestClock = Stopwatch;
 }
 public PaypalApiService(
     IPaypalSettingsService settingsService,
     IClock clock) {
     _settingsService = settingsService;
     _clock = clock;
     T = NullLocalizer.Instance;
 }
Esempio n. 26
0
 public Post(string username, IList<string> messages, IUserRepository userRepository, IClock clock)
 {
     Username = username;
     Messages = messages;
     _userRepository = userRepository;
     _clock = clock;
 }
        public FrmVentasReservadasListado(IClock clock, IFormFactory formFactory, IMessageBoxDisplayService messageBoxDisplayService, ILaPazUow uow,
            IVentaReservadaNegocio ventaReservadaNegocio,
                             IFormRegistry formRegistry)
        {
            Uow = uow;

            SortColumn = "FechaAlta";
            SortDirection = "DESC";

            SortColumnMappings = new Dictionary<string, string>();
            //SortColumnMappings["TipoDocumentoDi"] = "TiposDocumentosIdentidad.Abreviatura";

            FormFactory = formFactory;
            Uow = uow;
            FormRegistry = formRegistry;

            _clock = clock;
            _messageBoxDisplayService = messageBoxDisplayService;
            _ventaReservadaNegocio = ventaReservadaNegocio;
            InitializeComponent();

            InicializarPaginador();

            //Fix para centrar columnas.
            this.GrillaFacturasReservadas.CellFormatting += this.Grilla_CellFormatting;
            MainGrid = GrillaFacturasReservadas;
            this.MainPager = FacturaPager;
            this.Spinner = ucProgressSpinner1;
            
        }
Esempio n. 28
0
        public void Init() {
            var builder = new ContainerBuilder();

            builder.RegisterType<MembershipService>().As<IMembershipService>();
            builder.RegisterType<UserService>().As<IUserService>();
            builder.RegisterInstance(_clock = new StubClock()).As<IClock>();
            builder.RegisterType<DefaultContentQuery>().As<IContentQuery>();
            builder.RegisterType<DefaultContentManager>().As<IContentManager>();
            builder.RegisterType(typeof(SettingsFormatter)).As<ISettingsFormatter>();
            builder.RegisterType<ContentDefinitionManager>().As<IContentDefinitionManager>();
            builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
            builder.RegisterType<UserPartHandler>().As<IContentHandler>();
            builder.RegisterType<StubWorkContextAccessor>().As<IWorkContextAccessor>();
            builder.RegisterType<OrchardServices>().As<IOrchardServices>();
            builder.RegisterAutoMocking(MockBehavior.Loose);
            builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
            builder.RegisterInstance(new Mock<IMessageEventHandler>().Object);
            builder.RegisterType<DefaultMessageManager>().As<IMessageManager>();
            builder.RegisterInstance(_channel = new MessagingChannelStub()).As<IMessagingChannel>();
            builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
            builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
            builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
            builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();

            builder.RegisterType<DefaultEncryptionService>().As<IEncryptionService>();
            builder.RegisterInstance(ShellSettingsUtility.CreateEncryptionEnabled());

            _session = _sessionFactory.OpenSession();
            builder.RegisterInstance(new TestSessionLocator(_session)).As<ISessionLocator>();
            _container = builder.Build();
            _membershipService = _container.Resolve<IMembershipService>();
            _userService = _container.Resolve<IUserService>();
        }
Esempio n. 29
0
        public MultiClampCommander(uint serialNumber, uint channel, IClock clock)
        {
            SerialNumber = serialNumber;
            Channel = channel;
            Clock = clock;

            UInt32 lParam = MulticlampInterop.MCTG_Pack700BSignalIDs(this.SerialNumber, this.Channel); // Pack the above two into an UInt32
            int result = Win32Interop.PostMessage(Win32Interop.HWND_BROADCAST, MulticlampInterop.MCTG_OPEN_MESSAGE, (IntPtr)Win32Interop.MessageEvents.WindowHandle, (IntPtr)lParam);

            Win32Interop.MessageEvents.WatchMessage(Win32Interop.WM_COPYDATA, (sender, evtArgs) =>
            {
                // WM_COPYDATA LPARAM is a pointer to a COPYDATASTRUCT structure
                Win32Interop.COPYDATASTRUCT cds;
                cds = (Win32Interop.COPYDATASTRUCT)
                    Marshal.PtrToStructure(evtArgs.Message.LParam, typeof(Win32Interop.COPYDATASTRUCT));

                // WM_COPYDATA structure (COPYDATASTRUCT)
                // dwData -- RegisterWindowMessage(MCTG_REQUEST_MESSAGE_STR)
                // cbData -- size (in bytes) of the MC_TELEGRAPH_DATA structure being sent
                // lpData -- MC_TELEGRAPH_DATA*
                MulticlampInterop.MC_TELEGRAPH_DATA mtd;
                mtd = (MulticlampInterop.MC_TELEGRAPH_DATA)Marshal.PtrToStructure(cds.lpData, typeof(MulticlampInterop.MC_TELEGRAPH_DATA));
                var md = new MulticlampInterop.MulticlampData(mtd);

                OnParametersChanged(md);
            });
        }
Esempio n. 30
0
        /// <inheritdoc/>
        /// <remarks>
        /// Based on <c>Microsoft.AspNetCore.Http.StreamCopyOperationInternal.CopyToAsync</c>.
        /// See: <see href="https://github.com/dotnet/aspnetcore/blob/080660967b6043f731d4b7163af9e9e6047ef0c4/src/Http/Shared/StreamCopyOperationInternal.cs"/>.
        /// </remarks>
        public static async ValueTask <(StreamCopyResult, Exception?)> CopyAsync(bool isRequest, Stream input, Stream output, IClock clock, CancellationToken cancellation)
        {
            _ = input ?? throw new ArgumentNullException(nameof(input));
            _ = output ?? throw new ArgumentNullException(nameof(output));

            var telemetryEnabled = ForwarderTelemetry.Log.IsEnabled();

            var buffer = ArrayPool <byte> .Shared.Rent(DefaultBufferSize);

            var reading = true;

            long contentLength = 0;
            long iops          = 0;
            var  readTime      = TimeSpan.Zero;
            var  writeTime     = TimeSpan.Zero;
            var  firstReadTime = TimeSpan.FromMilliseconds(-1);

            try
            {
                var lastTime = TimeSpan.Zero;
                var nextTransferringEvent = TimeSpan.Zero;

                if (telemetryEnabled)
                {
                    ForwarderTelemetry.Log.ForwarderStage(isRequest ? ForwarderStage.RequestContentTransferStart : ForwarderStage.ResponseContentTransferStart);

                    lastTime = clock.GetStopwatchTime();
                    nextTransferringEvent = lastTime + TimeBetweenTransferringEvents;
                }

                while (true)
                {
                    if (cancellation.IsCancellationRequested)
                    {
                        return(StreamCopyResult.Canceled, new OperationCanceledException(cancellation));
                    }

                    reading = true;
                    var read = 0;
                    try
                    {
                        read = await input.ReadAsync(buffer.AsMemory(), cancellation);
                    }
                    finally
                    {
                        if (telemetryEnabled)
                        {
                            contentLength += read;
                            iops++;

                            var readStop        = clock.GetStopwatchTime();
                            var currentReadTime = readStop - lastTime;
                            lastTime  = readStop;
                            readTime += currentReadTime;
                            if (firstReadTime.Ticks < 0)
                            {
                                firstReadTime = currentReadTime;
                            }
                        }
                    }

                    // End of the source stream.
                    if (read == 0)
                    {
                        return(StreamCopyResult.Success, null);
                    }

                    if (cancellation.IsCancellationRequested)
                    {
                        return(StreamCopyResult.Canceled, new OperationCanceledException(cancellation));
                    }

                    reading = false;
                    try
                    {
                        await output.WriteAsync(buffer.AsMemory(0, read), cancellation);
                    }
                    finally
                    {
                        if (telemetryEnabled)
                        {
                            var writeStop = clock.GetStopwatchTime();
                            writeTime += writeStop - lastTime;
                            lastTime   = writeStop;
                            if (lastTime >= nextTransferringEvent)
                            {
                                ForwarderTelemetry.Log.ContentTransferring(
                                    isRequest,
                                    contentLength,
                                    iops,
                                    readTime.Ticks,
                                    writeTime.Ticks);

                                // Avoid attributing the time taken by logging ContentTransferring to the next read call
                                lastTime = clock.GetStopwatchTime();
                                nextTransferringEvent = lastTime + TimeBetweenTransferringEvents;
                            }
                        }
                    }
                }
            }
            catch (OperationCanceledException oex)
            {
                return(StreamCopyResult.Canceled, oex);
            }
            catch (Exception ex)
            {
                return(reading ? StreamCopyResult.InputError : StreamCopyResult.OutputError, ex);
            }
            finally
            {
                // We can afford the perf impact of clearArray == true since we only do this twice per request.
                ArrayPool <byte> .Shared.Return(buffer, clearArray : true);

                if (telemetryEnabled)
                {
                    ForwarderTelemetry.Log.ContentTransferred(
                        isRequest,
                        contentLength,
                        iops,
                        readTime.Ticks,
                        writeTime.Ticks,
                        Math.Max(0, firstReadTime.Ticks));
                }
            }
        }
 public VideoFrameStreamer(IVideoSource videoSource, IClock clock, IStreamConsumer <Timestamped <IVideoFrame> > consumer) : this(videoSource, clock) => Attach(consumer);
 /// <inheritdoc />
 public MemoryContentLocationDatabase(IClock clock, MemoryContentLocationDatabaseConfiguration configuration, Func <IReadOnlyList <MachineId> > getInactiveMachines)
     : base(clock, configuration, getInactiveMachines)
 {
 }
Esempio n. 33
0
 public DownloadJob(IDownloader downloader, IClock clock)
 {
     _downloader = downloader;
     _clock      = clock;
 }
Esempio n. 34
0
        public static IAsyncObserver <TSource> TimeInterval <TSource>(IAsyncObserver <TimeInterval <TSource> > observer, IClock clock)
        {
            if (observer == null)
            {
                throw new ArgumentNullException(nameof(observer));
            }
            if (clock == null)
            {
                throw new ArgumentNullException(nameof(clock));
            }

            var last = clock.Now;

            return(Select <TSource, TimeInterval <TSource> >(observer, x =>
            {
                var now = clock.Now;
                var interval = now - last;
                last = now;

                return new TimeInterval <TSource>(x, interval);
            }));
        }
Esempio n. 35
0
        public static IAsyncObservable <TimeInterval <TSource> > TimeInterval <TSource>(this IAsyncObservable <TSource> source, IClock clock)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (clock == null)
            {
                throw new ArgumentNullException(nameof(clock));
            }

            return(Create <TimeInterval <TSource> >(observer => source.SubscribeSafeAsync(AsyncObserver.TimeInterval(observer, clock))));
        }
Esempio n. 36
0
 public Handler(ICratesDbContext context, IClock clock)
 {
     _context = context;
     _clock   = clock;
 }
 public IStreamer Create(IDevice device, IClock clock) => new VideoFrameStreamer((IVideoSource)device, clock);
Esempio n. 38
0
 public WorkflowFactory(IClock clock, IIdGenerator idGenerator)
 {
     _clock       = clock;
     _idGenerator = idGenerator;
 }
 public VideoFrameStreamer(IVideoSource videoSource, IClock clock) : base(nameof(GazePointStreamer), clock)
 {
     VideoSource = videoSource;
     Started    += (sender, e) => videoSource.Open();
     Stopped    += (sender, e) => videoSource.Shutdown();
 }
Esempio n. 40
0
 public DefaultUserService(IRepository <User> userRepo,
                           UserManager <User> userManager,
                           IEmailDeliveryMethod emailDeliveryMethod,
                           IUrlHelper urlHelper,
                           IConfirmationEmailBuilder confirmationEmailBuilder,
                           IResetPasswordEmailBuilder resetPasswordEmailBuilder,
                           IPhoneNumberVerificationService phoneNumberVerificationService,
                           IRepository <VerifiedPhoneNumber> verifiedPhoneNumberRepo, IClock clock)
 {
     _userRepo                       = userRepo;
     _userManager                    = userManager;
     _emailDeliveryMethod            = emailDeliveryMethod;
     _resetPasswordEmailBuilder      = resetPasswordEmailBuilder;
     _urlHelper                      = urlHelper;
     _confirmationEmailBuilder       = confirmationEmailBuilder;
     _phoneNumberVerificationService = phoneNumberVerificationService;
     _verifiedPhoneNumberRepo        = verifiedPhoneNumberRepo;
     _clock = clock;
 }
Esempio n. 41
0
 public TransformFloat(IClock clock)
     : base(clock)
 {
 }
 public static StartedClock Start(this IClock clock)
 {
     return(new StartedClock(clock, clock.GetTimestamp()));
 }
Esempio n. 43
0
 public TimeScheduler(ITimeBudgetScheduler timeBudgetScheduler, IClock clock)
 {
     TimeBudgetScheduler = timeBudgetScheduler;
     Clock = clock ?? SystemClockUtc.Default;
 }
Esempio n. 44
0
 public TransformRotation(IClock clock) : base(clock)
 {
 }
Esempio n. 45
0
 public HibernateDbMigrator(Configuration cfg, IClock clock, ILogger <HibernateDbMigrator> logger)
 {
     _cfg        = cfg;
     _clock      = clock;
     this.Logger = logger;
 }
Esempio n. 46
0
        public RuleDequeuer(RuleService ruleService, IRuleEventRepository ruleEventRepository, ISemanticLog log, IClock clock)
        {
            Guard.NotNull(ruleEventRepository, nameof(ruleEventRepository));
            Guard.NotNull(ruleService, nameof(ruleService));
            Guard.NotNull(clock, nameof(clock));
            Guard.NotNull(log, nameof(log));

            this.ruleEventRepository = ruleEventRepository;
            this.ruleService         = ruleService;

            this.clock = clock;

            this.log = log;

            requestBlock =
                new ActionBlock <IRuleEventEntity>(HandleAsync,
                                                   new ExecutionDataflowBlockOptions {
                MaxDegreeOfParallelism = 32, BoundedCapacity = 32
            });

            timer = new CompletionTimer(5000, QueryAsync);
        }
 public static TimeInterval GetResolution(this IClock clock)
 {
     return(clock.Frequency.ToResolution());
 }
Esempio n. 48
0
 public OrderService(IOrchardServices services, IClock clock, IContentManager contentManager)
 {
     _orchardServices = services;
     _clock           = clock;
     _contentManager  = contentManager;
 }
Esempio n. 49
0
 public Discount(IWorkContextAccessor wca, IClock clock)
 {
     _wca   = wca;
     _clock = clock;
 }
Esempio n. 50
0
        public FrmActualizarStockLibro(ILaPazUow uow, IFormFactory formFactory, IRepository <TituloStockMigracion> tituloStockMigracionRepo, IClock clock, Guid id)
        {
            Uow         = uow;
            FormFactory = formFactory;

            _tituloId = id;
            _tituloStockMigracionRepo = tituloStockMigracionRepo;
            _clock = clock;

            InitializeComponent();
        }
        public StrategyPatchViewModelValidator(IClock clock)
        {
            RuleFor(x => x.UtcStartDateTime)
            .Must(startTime => startTime.HasValue)
            .When(x => x.BudgetPeriodId.HasValue);

            RuleFor(x => x.UtcEndDateTime)
            .Must((model, endTime) => endTime.HasValue && endTime.Value >= model.UtcStartDateTime)
            .When(x => x.BudgetPeriodId == (int)StrategyTypeEnum.SingleFlight);

            RuleFor(x => x.UtcEndDateTime.Value)
            .Must(endTime => endTime > clock.UtcNow)
            .When(x => x.UtcEndDateTime.HasValue);

            When(x => x.GoalTypeId.HasValue, () =>
            {
                RuleFor(x => x.BudgetAmount)
                .NotNull();

                RuleFor(x => x.GoalTargetRate)
                .NotNull()
                .InclusiveBetween(MinGoalTargetRate, MaxGoalTargetRate)
                .LessThanOrEqualTo(model => model.BudgetAmount);

                RuleFor(x => x.GoalTargetQuantity)
                .NotNull();
            });

            RuleFor(x => x.GoalTargetQuantity)
            .GreaterThanOrEqualTo(MinGoalTargetQuantityCpm)
            .When(x => x.GoalTypeId == (int)GoalTypeEnum.Impressions);
            RuleFor(x => x.GoalTargetQuantity)
            .GreaterThanOrEqualTo(MinGoalTargetQuantityCpc)
            .When(x => x.GoalTypeId == (int)GoalTypeEnum.Clicks);
            RuleFor(x => x.GoalTargetQuantity)
            .GreaterThanOrEqualTo(MinGoalTargetQuantityCpa)
            .When(x => x.GoalTypeId == (int)GoalTypeEnum.Actions);

            When(x => x.MaxBidCpm.HasValue || x.MinBidCpm.HasValue, () =>
            {
                RuleFor(x => x.MaxBidCpm)
                .NotNull()
                .GreaterThanOrEqualTo(MinGoalTargetRate);

                RuleFor(x => x.MinBidCpm)
                .NotNull()
                .LessThanOrEqualTo(x => x.MaxBidCpm)
                .GreaterThanOrEqualTo(0);
            });

            When(x => x.UseBinomialFilter == true && x.GoalTypeId == (int)GoalTypeEnum.Clicks, () =>
            {
                RuleFor(x => x.MinSloRate)
                .NotNull()
                .InclusiveBetween(0, 1);

                RuleFor(x => x.MaxSloRate)
                .NotNull()
                .InclusiveBetween(0, 1)
                .GreaterThanOrEqualTo(x => x.MinSloRate);
            });

            When(x => x.UseBinomialFilter == true && x.GoalTypeId == (int)GoalTypeEnum.Actions, () =>
            {
                RuleFor(x => x.MinSloRate)
                .NotNull()
                .InclusiveBetween(0, 1);
            });

            RuleFor(x => x.SpendConstraintAmount)
            .ExclusiveBetween(0, MaxSpendConstraintAmount)
            .When(x => x.PacingStyleId == (int)PacingStyleEnum.Fixed);

            RuleFor(x => x.UniqueConstraintAmount)
            .LessThanOrEqualTo(MaxFrequencyAmount)
            .When(x => x.UniqueConstraintAmount.HasValue);
        }
Esempio n. 52
0
 /// <inheritdoc />
 public ITimerMetric Build(IHistogramMetric histogram, IMeterMetric meter, IClock clock)
 {
     return(new DefaultTimerMetric(histogram, meter, clock));
 }
Esempio n. 53
0
 public AdminService(FantasyCriticService fantasyCriticService, IFantasyCriticRepo fantasyCriticRepo, IMasterGameRepo masterGameRepo,
                     InterLeagueService interLeagueService, IOpenCriticService openCriticService, IClock clock, ILogger <AdminService> logger, IRDSManager rdsManager,
                     RoyaleService royaleService, PythonRunner pythonRunner)
 {
     _fantasyCriticService = fantasyCriticService;
     _fantasyCriticRepo    = fantasyCriticRepo;
     _masterGameRepo       = masterGameRepo;
     _interLeagueService   = interLeagueService;
     _openCriticService    = openCriticService;
     _clock         = clock;
     _logger        = logger;
     _rdsManager    = rdsManager;
     _royaleService = royaleService;
     _pythonRunner  = pythonRunner;
 }
Esempio n. 54
0
 public static bool IsInTrialPeriod(TimeSpan trialTime, IClock clock = null, IInstallationDateFetcher installationDateFetcher = null)
 {
     return(GetRemainingTrialTime(trialTime, clock, installationDateFetcher) > TimeSpan.Zero);
 }
Esempio n. 55
0
        /// <inheritdoc />
        public ITimerMetric Build(Func <IReservoir> setupReservoir, IMeterMetric meter, IClock clock)
        {
            if (setupReservoir == null)
            {
                setupReservoir = _defaultSamplingReservoirProvider.Instance;
            }

            var reservoir = setupReservoir() ?? _defaultSamplingReservoirProvider.Instance();

            return(new DefaultTimerMetric(reservoir, meter, clock));
        }
Esempio n. 56
0
 public DefaultVirtualPathMonitor(IClock clock)
 {
     _clock = clock;
     _thunk = new Thunk(this);
     Logger = LoggingUtilities.Resolve();
 }
Esempio n. 57
0
 public AnswerAQuestionService(IQuestionRepository questions, IClock clock)
 {
     _questions = questions;
     _clock     = clock;
 }
Esempio n. 58
0
 public ProgTxDetailSerializer(IAuditEventRepository auditEventRepository, IClock clock)
     : base(auditEventRepository)
 {
     _clock = clock;
 }
Esempio n. 59
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            _logger.LogInformation("Initializing services.");

            int    validMinutes = Convert.ToInt32(Configuration["Tokens:ValidMinutes"]);
            var    keyString    = Configuration["Tokens:Key"];
            var    issuer       = Configuration["Tokens:Issuer"];
            var    audience     = Configuration["Tokens:Audience"];
            IClock clock        = NodaTime.SystemClock.Instance;
            string pythonPath   = Configuration["Python:PythonPath"];

            var rdsInstanceName = Configuration["AWS:rdsInstanceName"];

            // Add application services.

            var tokenService = new TokenService(keyString, issuer, audience, validMinutes);
            SendGridEmailSender sendGridEmailSender = new SendGridEmailSender();

            services.AddHttpClient();

            //Repository Setup. Uncomment either the MySQL section OR the fake repo section. Not both.
            //MySQL Repos
            string connectionString = Configuration.GetConnectionString("DefaultConnection");
            var    userStore        = new MySQLFantasyCriticUserStore(connectionString, clock);
            var    roleStore        = new MySQLFantasyCriticRoleStore(connectionString);

            services.AddScoped <IFantasyCriticUserStore>(factory => userStore);
            services.AddScoped <IFantasyCriticRoleStore>(factory => roleStore);
            services.AddScoped <IMasterGameRepo>(factory => new MySQLMasterGameRepo(connectionString, userStore));
            services.AddScoped <IFantasyCriticRepo>(factory => new MySQLFantasyCriticRepo(connectionString, userStore, new MySQLMasterGameRepo(connectionString, userStore)));
            services.AddScoped <IRoyaleRepo>(factory => new MySQLRoyaleRepo(connectionString, userStore, new MySQLMasterGameRepo(connectionString, userStore),
                                                                            new MySQLFantasyCriticRepo(connectionString, userStore, new MySQLMasterGameRepo(connectionString, userStore))));
            services.AddScoped <IUserStore <FantasyCriticUser> >(factory => userStore);
            services.AddScoped <IRoleStore <FantasyCriticRole> >(factory => roleStore);

            //Fake Repos (for testing without a database)
            //var userStore = new FakeFantasyCriticUserStore(clock);
            //var roleStore = new FakeFantasyCriticRoleStore();
            //services.AddScoped<IFantasyCriticUserStore>(factory => userStore);
            //services.AddScoped<IFantasyCriticRoleStore>(factory => roleStore);
            //services.AddScoped<IMasterGameRepo>(factory => new FakeMasterGameRepo(userStore));
            //services.AddScoped<IFantasyCriticRepo>(factory => new FakeFantasyCriticRepo(userStore, new FakeMasterGameRepo(userStore)));
            //services.AddScoped<IRoyaleRepo>(factory => new FakeRoyaleRepo(userStore, new FakeMasterGameRepo(userStore)));
            //services.AddScoped<IUserStore<FantasyCriticUser>>(factory => userStore);
            //services.AddScoped<IRoleStore<FantasyCriticRole>>(factory => roleStore);

            services.AddScoped <PythonRunner>(factory => new PythonRunner(pythonPath));
            services.AddScoped <IRDSManager>(factory => new RDSManager(rdsInstanceName));
            services.AddScoped <FantasyCriticUserManager>();
            services.AddScoped <FantasyCriticRoleManager>();
            services.AddScoped <GameAcquisitionService>();
            services.AddScoped <LeagueMemberService>();
            services.AddScoped <PublisherService>();
            services.AddScoped <InterLeagueService>();
            services.AddScoped <DraftService>();
            services.AddScoped <GameSearchingService>();
            services.AddScoped <ActionProcessingService>();
            services.AddScoped <FantasyCriticService>();
            services.AddScoped <RoyaleService>();

            services.AddTransient <IEmailSender>(factory => sendGridEmailSender);
            services.AddTransient <ISMSSender, SMSSender>();
            services.AddTransient <ITokenService>(factory => tokenService);
            services.AddTransient <IClock>(factory => clock);
            services.AddHttpClient <IOpenCriticService, OpenCriticService>();

            services.AddHttpClient <IOpenCriticService, OpenCriticService>(client =>
            {
                client.BaseAddress = new Uri("https://api.opencritic.com/api/");
            });

            services.AddScoped <AdminService>();

            //Add scheduled tasks & scheduler
            services.AddSingleton <IScheduledTask, RefreshDataTask>();
            services.AddScheduler((sender, args) =>
            {
                _logger.LogError(args.Exception.Message);
                args.SetObserved();
            });

            services.AddIdentity <FantasyCriticUser, FantasyCriticRole>(options =>
            {
                options.Password.RequireDigit           = false;
                options.Password.RequiredLength         = 8;
                options.Password.RequireLowercase       = false;
                options.Password.RequireNonAlphanumeric = false;
                options.Password.RequireUppercase       = false;
            })
            .AddDefaultTokenProviders();

            services.ConfigureApplicationCookie(opt =>
            {
                opt.ExpireTimeSpan = TimeSpan.FromMinutes(validMinutes);
                opt.Events.OnRedirectToAccessDenied = ReplaceRedirector(HttpStatusCode.Forbidden, opt.Events.OnRedirectToAccessDenied);
                opt.Events.OnRedirectToLogin        = ReplaceRedirector(HttpStatusCode.Unauthorized, opt.Events.OnRedirectToLogin);
            });

            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(cfg =>
            {
                cfg.TokenValidationParameters = new TokenValidationParameters()
                {
                    ValidIssuer      = issuer,
                    ValidAudience    = audience,
                    IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(keyString))
                };

                // We have to hook the OnMessageReceived event in order to
                // allow the JWT authentication handler to read the access
                // token from the query string when a WebSocket or
                // Server-Sent Events request comes in.
                cfg.Events = new JwtBearerEvents
                {
                    OnMessageReceived = context =>
                    {
                        var accessToken = context.Request.Query["access_token"];

                        // If the request is for our hub...
                        var path = context.HttpContext.Request.Path;
                        if (!string.IsNullOrEmpty(accessToken) &&
                            (path.StartsWithSegments("/updatehub")))
                        {
                            // Read the token out of the query string
                            context.Token = accessToken;
                        }
                        return(Task.CompletedTask);
                    }
                };
            });

            services.AddHsts(options =>
            {
                options.Preload           = true;
                options.IncludeSubDomains = true;
                options.MaxAge            = TimeSpan.FromDays(60);
            });

            services.AddHttpsRedirection(options =>
            {
                options.RedirectStatusCode = StatusCodes.Status307TemporaryRedirect;
                options.HttpsPort          = 443;
            });

            services.AddControllers()
            .AddNewtonsoftJson(options =>
            {
                options.SerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
            });

            services.AddSignalR();

            // In production, the Vue files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });
        }
Esempio n. 60
-1
 public Heartbeat(HeartbeatIntervalSetting heartbeatInterval, IClock clock, IEventSender eventSender, ILogger logger)
 {
     _heartbeatInterval = heartbeatInterval;
     _eventSender = eventSender;
     _logger = logger;
     _clock = clock;
 }