public async Task <bool> SetFutureAuctionServicedState(IAuctionInfo auction, CancellationToken ct)
        {
            await logger.Log($"Перевод аукциона {auction.Code} в обработанные");

            var result = await _setState(auction, ct, "2");

            await logger.Log($"Аукцион {auction.Code} обработан");

            return(result);
        }
        private async Task <bool> _setState(IAuctionInfo auction, CancellationToken ct, string state)
        {
            await httpClientService.PostAsync(
                $"{configService.SetFutureAuctionState}?token={configService.SecurityToken}&regNumber={auction.Code}&state={state}",
                new StringContent(""),
                ct
                );

            return(true);
        }
Example #3
0
        public string GetJob(IAuctionInfo auctionInfo, string containerTag)
        {
            var result = HttpUtility
                         .UrlDecode(configService["jobseeker.JobTemplate"])
                         .Replace("{{REGNUMBER}}", auctionInfo.Code)
                         .Replace("{{BUILDNUMBER}}", containerTag)
                         .Replace("{{AUCTIONINFO}}", JsonConvert.SerializeObject(auctionInfo).Replace("\"", "'"))
                         .Replace("{{WORKERS}}", auctionInfo.Workers.ToString());

            return(result);
        }
Example #4
0
        public SberbankConfigService(
            IConfigService configService
            )
        {
            if (configService == null)
            {
                throw new System.ArgumentNullException(nameof(configService));
            }

            AuctionInfo                = JsonConvert.DeserializeObject <AuctionInfo>(configService["sberbank.AuctionInfo"]);
            AuthStep1Url               = configService["sberbank.AuthStep1Url"];
            AuthStep2Url               = configService["sberbank.AuthStep2Url"];
            AuthStep3Url               = configService["sberbank.AuthStep3Url"];
            PurchaseRequestListUrl     = configService["sberbank.PurchaseRequestListUrl"];
            _logonRegisterDataTemplate = configService["sberbank.LogonRegisterDataTemplate"];
            _searchXmlTemplate         = configService["sberbank.SearchXmlTemplate"];
            _tradePlaceUrlTemplate     = configService["sberbank.TradePlaceUrlTemplate"];
            _tradePlaceBidUrlTemplate  = configService["sberbank.TradePlaceBidUrlTemplate"];
            _bidDataTemplate           = configService["sberbank.BidDataTemplate"];
            _asyncRefreshDataTemplate  = configService["sberbank.AsyncRefreshDataTemplate"];

            IsDebug = string.Equals(configService["sberbank.debug"], "true", System.StringComparison.InvariantCultureIgnoreCase);
        }
Example #5
0
        private static void _initContainer()
        {
            Container.Init(sc =>
            {
                Container.Registration.Register(sc);
                sc.AddSingleton <ISberbankActionsService, SberbankActionsService>();
                sc.AddSingleton <ISberbankHttpClientService, SberbankHttpClientService>();
                sc.AddSingleton <ISberbankDataProvider, SberbankDataProvider>();
                sc.AddSingleton <ISberbankConfigService, SberbankConfigService>();
                sc.AddSingleton <ISberbankDeserializationService, SberbankDeserializationService>();
                sc.AddSingleton <IAPIDataProviderService, APIDataProviderService>();
                sc.AddSingleton <IAPIConfigService, APIConfigService>();
                sc.AddSingleton <IAPIHttpClientService, APIHttpClientService>();
                sc.AddSingleton <ILoggerService, LoggerService>();
                sc.AddSingleton <IProxyService, ProxyService>();
            });

            actionsService  = Container.GetService <ISberbankActionsService>();
            configService   = Container.GetService <ISberbankConfigService>();
            apiDataProvider = Container.GetService <IAPIDataProviderService>();
            logger          = Container.GetService <ILoggerService>();
            auctionInfo     = configService.AuctionInfo;
        }