Ejemplo n.º 1
0
        public void Test()
        {
            var mgr = CreateManager() as IUserManager;

            BLHelper.FillInitialCaches();
            var res = mgr.GetUserRights("DEBUG");
        }
Ejemplo n.º 2
0
        protected override void DoHostInternal(object context)
        {
            // выставим среду, если указана
            var env = Context.Get(ConfigBase.EnvironmentParam);

            ConfigurationManager.AppSettings["BLToolkit.DefaultConfiguration"] = string.IsNullOrEmpty(env) ? "DEV" : env;

            // явно инициализируем Oracle - чтобы не было ни каких накладок
            BLHelper.InitBL(dalType: DALType.Oracle);

            // аутентифицируемся
            var auth = IoC.Instance.Resolve <IAuthenticationProvider>();

            auth.Authenticate(ConfigurationManager.AppSettings["Login"], ConfigurationManager.AppSettings["Password"]);

            // запрашиваем данные сразу
            BLHelper.FillInitialCaches();

            FreeScheduler();
            _scheduler = new EpsScheduler();

            FreeTimer();
            _timer = new Timer(Tick);

            _date0 = DateTime.Now;
            Log.Info("Service was initialized");

            _timer.Change(0, _timerPeriod); // стартуем сразу, а потом через период
            Log.Info("Service was started");
        }
Ejemplo n.º 3
0
        protected override void DoHostInternal(object context)
        {
            if (_config == null)
            {
                throw new OperationException("Сервис не был сконфигурирован");
            }

            BLHelper.InitBL(dalType: DALType.Oracle);
            Authenticate();
            BLHelper.FillInitialCaches();

            CreateReportDirectoryIfNotExists();
            CreateArchiveDirectoryIfNotExists();

            if (!EPS.wmsEPS.Properties.Settings.Default.UseLocalReport)
            {
                Log.Info("CheckOut reports to local directory");
                var checkOut = new EpsCheckOut();
                checkOut.CheckOut();
            }

            var schedulerFactory = new StdSchedulerFactory();

            _scheduler = schedulerFactory.GetScheduler();
            _scheduler.Start();

            AddProcessOutputQueueJob();

            Log.Info("EPSService started");
        }
Ejemplo n.º 4
0
        public virtual void Initialize(IDictionary parameters)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            XmlConfigurator.Configure();
            ExceptionPolicy.Instance.Init();
            BLHelper.InitBL(dalType: DALType.Service);
            BLHelper.RegisterServiceClient("Auto", ClientTypeCode.DCL, null);
            var auth = IoC.Instance.Resolve <IAuthenticationProvider>();

            auth.Authenticate("TECH_AUTOTEST", "dVAdfX0iqheq4yd");
            BLHelper.FillInitialCaches();
        }
Ejemplo n.º 5
0
        private async Task DoClearCacheAsync()
        {
            var mgr = IoC.Instance.Resolve <ISysObjectManager>();

            await Task.Factory.StartNew(() =>
            {
                mgr.ClearCache();

                //Загрузим начальные кэши
                BLHelper.FillInitialCaches();
            });
        }
Ejemplo n.º 6
0
        public void RunBeforeAnyTests()
        {
            BLHelper.InitBL(dalType: DALType.Oracle);

            //BLHelper.InitBL(dalType: DALType.Service);
            //BLHelper.RegisterServiceClient("Auto", ClientTypeCode.DCL, Properties.Settings.Default.SDCL_Endpoint);

            var auth = IoC.Instance.Resolve <IAuthenticationProvider>();

            auth.Authenticate("TECH_AUTOTEST", "dVAdfX0iqheq4yd");

            BLHelper.FillInitialCaches();

            FillTestData(true);
        }
Ejemplo n.º 7
0
        protected override void InitSettings()
        {
            base.InitSettings();

            // выставим среду, если указана
            var env = Context.Get(ConfigBase.EnvironmentParam);

            ConfigurationManager.AppSettings["BLToolkit.DefaultConfiguration"] = string.IsNullOrEmpty(env) ? "DEV" : env;

            // TODO: убрать использование HandlerId
            SDCL.HandlerId = Context.Get(ConfigBase.HandlerParam);

            // явно инициализируем Oracle - чтобы не было ни каких накладок
            BLHelper.InitBL(dalType: DALType.Oracle);

            // аутентифицируемся
            var auth = IoC.Instance.Resolve <IAuthenticationProvider>();

            auth.Authenticate(ConfigurationManager.AppSettings["Login"], ConfigurationManager.AppSettings["Password"]);

            //Загрузим начальные кэши
            BLHelper.FillInitialCaches();
        }
Ejemplo n.º 8
0
        protected override void InitSettings()
        {
            base.InitSettings();

            // выставим среду, если указана
            var env = Config.Environment;

            ConfigurationManager.AppSettings["BLToolkit.DefaultConfiguration"] = string.IsNullOrEmpty(env) ? "DEV" : env;

            // явно инициализируем Oracle - чтобы не было ни каких накладок
            BLHelper.InitBL(dalType: DALType.Oracle);

            // аутентифицируемся
            var auth = IoC.Instance.Resolve <IAuthenticationProvider>();

            auth.Authenticate(ConfigurationManager.AppSettings["Login"], ConfigurationManager.AppSettings["Password"]);

            //Загрузим начальные кэши
            BLHelper.FillInitialCaches();

            //Выставляем значения параметров
            //_apiUri = Context.Get("apiendpoint");
            _apiUri      = ConfigurationManager.AppSettings["APIEndPoint"]; //Значение _apiUri считываем из app.config
            _inbound     = Context.Get("smbinbound");
            _imported    = Context.Get("smbimported");
            _timerPeriod = Context.Get("watchdog").To(MinTimerPeriod) * 1000;
            if (_timerPeriod < MinTimerPeriod)
            {
                _timerPeriod = MinTimerPeriod;
            }

            //Запускаем таймер
            FreeTimer();
            _periodTimer = new Timer(DeliveryTime);
            _periodTimer.Change(0, _timerPeriod); // стартуем сразу, а потом через период
        }