コード例 #1
0
        public static void Configure()
        {
            DbRegistry.Configure();

            PrepareRedisSessionProvider();

            if (HttpContext.Current != null && HttpContext.Current.Request != null)
            {
                var url = HttpContext.Current.Request.GetUrlRewriter();
                CommonLinkUtility.Initialize(new UriBuilder(url.Scheme, url.Host, url.Port).Uri.ToString());
            }

            ConfigureWebApi();

            if (DBResourceManager.ResourcesFromDataBase)
            {
                DBResourceManager.WhiteLableEnabled = true;
                DBResourceManager.PatchAssemblies();
            }

            AjaxSecurityChecker.Instance.CheckMethodPermissions += AjaxCheckMethodPermissions;
            AppDomain.CurrentDomain.AssemblyResolve             += CurrentDomainOnAssemblyResolve;

            //try
            //{
            //    AmiPublicDnsSyncService.Synchronize();
            //}
            //catch { }

            NotifyConfiguration.Configure();

            WebItemManager.Instance.LoadItems();

            SearchHandlerManager.Registry(new StudioSearchHandler());

            StorageFactory.InitializeHttpHandlers();

            BundleConfig.Configure();

            WhiteLabelHelper.ApplyPartnerWhiteLableSettings();

            LdapNotifyHelper.RegisterAll();

            try
            {
                new S3UploadGuard().DeleteExpiredUploadsAsync(TimeSpan.FromDays(1));//todo:
            }
            catch (Exception)
            {
            }

            try
            {
                Core.WarmUp.Instance.Start();
            }
            catch (Exception ex)
            {
                LogManager.GetLogger("ASC").Error("Start Warmup", ex);
            }
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: yulifengwx/CommunityServer
        public static void Configure(HttpApplication application)
        {
            XmlConfigurator.Configure();

            DbRegistry.Configure();

            ConfigureWebApi();

            if (ConfigurationManager.AppSettings["resources.from-db"] == "true")
            {
                AssemblyWork.UploadResourceData(AppDomain.CurrentDomain.GetAssemblies());
                AppDomain.CurrentDomain.AssemblyLoad += (sender, args) => AssemblyWork.UploadResourceData(AppDomain.CurrentDomain.GetAssemblies());
            }

            AjaxSecurityChecker.Instance.CheckMethodPermissions += AjaxCheckMethodPermissions;

            try
            {
                AmiPublicDnsSyncService.Synchronize();
            }
            catch { }

            NotifyConfiguration.Configure();

            WebItemManager.Instance.LoadItems();

            SearchHandlerManager.Registry(new StudioSearchHandler());

            StorageFactory.InitializeHttpHandlers();
            (new S3UploadGuard()).DeleteExpiredUploads(TimeSpan.FromDays(1));

            BundleConfig.Configure();
        }
コード例 #3
0
        public RouteListWorkingJournalViewModel(
            RouteListJournalFilterViewModel filterViewModel,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IRouteListRepository routeListRepository,
            IFuelRepository fuelRepository,
            ICallTaskRepository callTaskRepository,
            BaseParametersProvider baseParametersProvider,
            IExpenseParametersProvider expenseParametersProvider,
            ISubdivisionRepository subdivisionRepository,
            IAccountableDebtsRepository accountableDebtsRepository,
            IGtkTabsOpener gtkTabsOpener)
            : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            TabName = "Работа кассы с МЛ";

            _routeListRepository        = routeListRepository ?? throw new ArgumentNullException(nameof(routeListRepository));
            _fuelRepository             = fuelRepository ?? throw new ArgumentNullException(nameof(fuelRepository));
            _callTaskRepository         = callTaskRepository ?? throw new ArgumentNullException(nameof(callTaskRepository));
            _baseParametersProvider     = baseParametersProvider ?? throw new ArgumentNullException(nameof(baseParametersProvider));
            _expenseParametersProvider  = expenseParametersProvider ?? throw new ArgumentNullException(nameof(expenseParametersProvider));
            _subdivisionRepository      = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _accountableDebtsRepository = accountableDebtsRepository ?? throw new ArgumentNullException(nameof(accountableDebtsRepository));
            _gtkTabsOpener = gtkTabsOpener ?? throw new ArgumentNullException(nameof(gtkTabsOpener));

            UseSlider = false;

            NotifyConfiguration.Enable();
            NotifyConfiguration.Instance.BatchSubscribeOnEntity <RouteList>(OnRouteListChanged);

            InitPopupActions();
        }
コード例 #4
0
        public override void Init()
        {
            List <string> adminOpportunities() => (CoreBaseSettings.CustomMode
                                                               ? CustomModeResource.ProductAdminOpportunitiesCustomMode
                                                               : FilesCommonResource.ProductAdminOpportunities).Split('|').ToList();

            List <string> userOpportunities() => (CoreBaseSettings.CustomMode
                                         ? CustomModeResource.ProductUserOpportunitiesCustomMode
                                         : FilesCommonResource.ProductUserOpportunities).Split('|').ToList();

            _productContext =
                new ProductContext
            {
                DisabledIconFileName = "product_disabled_logo.png",
                IconFileName         = "images/files.menu.svg",
                LargeIconFileName    = "images/files.svg",
                DefaultSortOrder     = 10,
                //SubscriptionManager = SubscriptionManager,
                //SpaceUsageStatManager = FilesSpaceUsageStatManager,
                AdminOpportunities = adminOpportunities,
                UserOpportunities  = userOpportunities,
                CanNotBeDisabled   = true,
            };

            if (NotifyConfiguration != null)
            {
                NotifyConfiguration.Configure();
            }
            //SearchHandlerManager.Registry(new SearchHandler());
        }
コード例 #5
0
        public RouteListWorkingJournalViewModel(
            RouteListJournalFilterViewModel filterViewModel,
            IUnitOfWorkFactory unitOfWorkFactory,
            ICommonServices commonServices,
            IRouteListRepository routeListRepository,
            FuelRepository fuelRepository,
            CallTaskRepository callTaskRepository,
            BaseParametersProvider baseParametersProvider,
            SubdivisionRepository subdivisionRepository) :
            base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            TabName = "Работа кассы с МЛ";

            this.routeListRepository    = routeListRepository;
            this.fuelRepository         = fuelRepository;
            this.callTaskRepository     = callTaskRepository;
            this.baseParametersProvider = baseParametersProvider;
            this.subdivisionRepository  = subdivisionRepository;

            UseSlider = false;

            NotifyConfiguration.Enable();
            NotifyConfiguration.Instance.BatchSubscribeOnEntity <RouteList>(OnRouteListChanged);

            InitPopupActions();
        }
コード例 #6
0
 private void InitializeNotifySchedulers()
 {
     NotifyConfiguration.Configure();
     foreach (var pair in NotifyServiceCfg.Schedulers.Where(r => r.MethodInfo != null))
     {
         Log.DebugFormat("Start scheduler {0} ({1})", pair.Name, pair.MethodInfo);
         pair.MethodInfo.Invoke(null, null);
     }
 }
コード例 #7
0
 public ServiceLauncher(
     WebItemManager webItemManager,
     StudioNotifyServiceSender studioNotifyServiceSender,
     NotifyConfiguration notifyConfiguration)
 {
     WebItemManager            = webItemManager;
     StudioNotifyServiceSender = studioNotifyServiceSender;
     NotifyConfiguration       = notifyConfiguration;
 }
コード例 #8
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            NotifyConfiguration.Configure(ServiceProvider);
            WebItemManager.LoadItems();

            StudioNotifyServiceSender.RegisterSendMethod();

            return(Task.CompletedTask);
        }
コード例 #9
0
 protected void Application_Start(object sender, EventArgs e)
 {
     XmlConfigurator.Configure();
     DbRegistry.Configure();
     InitializeDbResources();
     AjaxSecurityChecker.Instance.CheckMethodPermissions += AjaxCheckMethodPermissions;
     NotifyConfiguration.Configure();
     WebItemManager.Instance.LoadItems();
     SearchHandlerManager.Registry(new StudioSearchHandler());
     SearchHandlerManager.Registry(new EmployeeSearchHendler());
 }
コード例 #10
0
 private void InitializeNotifySchedulers()
 {
     CommonLinkUtility.Initialize(NotifyServiceCfg.ServerRoot);
     DbRegistry.Configure();
     NotifyConfiguration.Configure();
     WebItemManager.LoadItems();
     foreach (var pair in NotifyServiceCfg.Schedulers.Where(r => r.MethodInfo != null))
     {
         LogManager.GetLogger("ASC.Notify").DebugFormat("Start scheduler {0} ({1})", pair.Name, pair.MethodInfo);
         pair.MethodInfo.Invoke(null, null);
     }
 }
コード例 #11
0
 private void InitializeNotifySchedulers()
 {
     CommonLinkUtility.Initialize(NotifyServiceCfg.ServerRoot);
     DbRegistry.Configure();
     InitializeDbResources();
     NotifyConfiguration.Configure();
     WebItemManager.Instance.LoadItems();
     foreach (var pair in NotifyServiceCfg.Schedulers)
     {
         LogManager.GetLogger("ASC.Notify").DebugFormat("Start scheduler {0} ({1})", pair.Key, pair.Value);
         pair.Value.Invoke(null, null);
     }
 }
コード例 #12
0
        private static void GenerateBearerTokens(IntTestContext context, IOptions <AzureAdConfiguration> azureOptions,
                                                 NotifyConfiguration notifyConfiguration)
        {
            context.Tokens.NotificationApiBearerToken = new AzureTokenProvider(azureOptions).GetClientAccessToken(
                azureOptions.Value.ClientId, azureOptions.Value.ClientSecret,
                context.Config.ServicesConfig.VhNotificationApiResourceId);
            context.Tokens.NotificationApiBearerToken.Should().NotBeNullOrEmpty();

            context.Tokens.NotificationCallbackBearerToken =
                new CustomJwtTokenProvider().GenerateTokenForCallbackEndpoint(notifyConfiguration.CallbackSecret, 60);
            context.Tokens.NotificationCallbackBearerToken.Should().NotBeNullOrWhiteSpace();

            Zap.SetAuthToken(context.Tokens.NotificationApiBearerToken);
        }
コード例 #13
0
 public BackupServiceLauncher(
     BackupCleanerService cleanerService,
     BackupSchedulerService schedulerService,
     BackupWorker backupWorker,
     ConfigurationExtension configuration,
     BackupListener backupListener,
     NotifyConfiguration notifyConfiguration)
 {
     CleanerService      = cleanerService;
     SchedulerService    = schedulerService;
     BackupWorker        = backupWorker;
     Configuration       = configuration;
     BackupListener      = backupListener;
     NotifyConfiguration = notifyConfiguration;
 }
コード例 #14
0
 public ProductEntryPoint(
     //            FilesSpaceUsageStatManager filesSpaceUsageStatManager,
     CoreBaseSettings coreBaseSettings,
     AuthContext authContext,
     UserManager userManager,
     NotifyConfiguration notifyConfiguration
     //            SubscriptionManager subscriptionManager
     )
 {
     //            FilesSpaceUsageStatManager = filesSpaceUsageStatManager;
     CoreBaseSettings    = coreBaseSettings;
     AuthContext         = authContext;
     UserManager         = userManager;
     NotifyConfiguration = notifyConfiguration;
     //SubscriptionManager = subscriptionManager;
 }
コード例 #15
0
 private void Application_StartDelayed(object sender, EventArgs e)
 {
     XmlConfigurator.Configure();
     DbRegistry.Configure();
     InitializeDbResources();
     AjaxSecurityChecker.Instance.CheckMethodPermissions += AjaxCheckMethodPermissions;
     try
     {
         AmiPublicDnsSyncService.Synchronize();
     }
     catch { }
     NotifyConfiguration.Configure();
     WebItemManager.Instance.LoadItems();
     SearchHandlerManager.Registry(new StudioSearchHandler());
     (new S3UploadGuard()).DeleteExpiredUploads(TimeSpan.FromDays(1));
     BundleConfig.Configure();
 }
コード例 #16
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            NotifyConfiguration.Configure(ServiceProvider);

            var settings = Configuration.GetSetting <BackupSettings>("backup");

            BackupWorker.Start(settings);
            BackupListener.Start();

            CleanerService.Period = settings.Cleaner.Period;
            CleanerService.Start();

            SchedulerService.Period = settings.Scheduler.Period;
            SchedulerService.Start();

            return(Task.CompletedTask);
        }
コード例 #17
0
        public static void Configure()
        {
            XmlConfigurator.Configure();

            DbRegistry.Configure();

            PrepareRedisSessionProvider();

            if (HttpContext.Current != null && HttpContext.Current.Request != null)
            {
                var url = HttpContext.Current.Request.GetUrlRewriter();
                CommonLinkUtility.Initialize(new UriBuilder(url.Scheme, url.Host, url.Port).Uri.ToString());
            }

            ConfigureWebApi();

            if (ConfigurationManager.AppSettings["resources.from-db"] == "true")
            {
                DBResourceManager.PatchAssemblies();
            }

            AjaxSecurityChecker.Instance.CheckMethodPermissions += AjaxCheckMethodPermissions;

            try
            {
                AmiPublicDnsSyncService.Synchronize();
            }
            catch { }

            NotifyConfiguration.Configure();

            WebItemManager.Instance.LoadItems();

            SearchHandlerManager.Registry(new StudioSearchHandler());

            StorageFactory.InitializeHttpHandlers();
            (new S3UploadGuard()).DeleteExpiredUploads(TimeSpan.FromDays(1));

            BundleConfig.Configure();

            if (CoreContext.Configuration.Standalone)
            {
                WarmUp.Instance.Start();
            }
        }
コード例 #18
0
 public NotifyServiceLauncher(
     IOptions <NotifyServiceCfg> notifyServiceCfg,
     NotifySender notifySender,
     NotifyService notifyService,
     NotifyCleaner notifyCleaner,
     WebItemManager webItemManager,
     IServiceProvider serviceProvider,
     NotifyConfiguration notifyConfiguration,
     IOptionsMonitor <ILog> options)
 {
     NotifyServiceCfg    = notifyServiceCfg.Value;
     NotifyService       = notifyService;
     NotifySender        = notifySender;
     NotifyCleaner       = notifyCleaner;
     WebItemManager      = webItemManager;
     ServiceProvider     = serviceProvider;
     NotifyConfiguration = notifyConfiguration;
     Log = options.Get("ASC.Notify");
 }
コード例 #19
0
        static void CreateBaseConfig()
        {
            logger.Info("Настройка параметров базы...");

            // Настройка ORM
            var db = FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard
                     .Dialect <MySQL57ExtendedDialect>()
                     .ConnectionString(QSProjectsLib.QSMain.ConnectionString)
                     .AdoNetBatchSize(100)
                     .ShowSql()
                     .FormatSql();

            OrmConfig.ConfigureOrm(db, new System.Reflection.Assembly[] {
                System.Reflection.Assembly.GetAssembly(typeof(MainClass)),
                System.Reflection.Assembly.GetAssembly(typeof(MeasurementUnits)),
                System.Reflection.Assembly.GetAssembly(typeof(UserBase)),
                System.Reflection.Assembly.GetAssembly(typeof(HistoryMain)),
            });

                        #if DEBUG
            NLog.LogManager.Configuration.RemoveRuleByName("HideNhibernate");
                        #endif

            //Настраиваем классы сущностей
            OrmMain.AddObjectDescription(MeasurementUnitsOrmMapping.GetOrmMapping());
            //Спецодежда
            OrmMain.AddObjectDescription <RegulationDoc>().Dialog <RegulationDocDlg>().DefaultTableView().SearchColumn("Документ", i => i.Title).OrderAsc(i => i.Name).End();
            //Общее
            OrmMain.AddObjectDescription <UserBase>().DefaultTableView().Column("Имя", e => e.Name).End();
            OrmMain.AddObjectDescription <UserSettings>();
            //Склад
            OrmMain.AddObjectDescription <Income>().Dialog <Dialogs.Stock.IncomeDocDlg>();

            NotifyConfiguration.Enable();
            BuisnessLogicGlobalEventHandler.Init(new GtkQuestionDialogsInteractive());
            JournalsColumnsConfigs.RegisterColumns();
        }
コード例 #20
0
        public RouteListJournalViewModel(
            RouteListJournalFilterViewModel filterViewModel,
            IRouteListRepository routeListRepository,
            IFuelRepository fuelRepository,
            ISubdivisionRepository subdivisionRepository,
            ICategoryRepository categoryRepository,
            ITrackRepository trackRepository,
            IUndeliveredOrdersRepository undeliveredOrdersRepository,
            IDeliveryShiftRepository deliveryShiftRepository,
            IUnitOfWorkFactory unitOfWorkFactory,
            IRouteListParametersProvider routeListParametersProvider,
            ICallTaskWorker callTaskWorker,
            IWarehouseRepository warehouseRepository,
            ICarJournalFactory carJournalFactory,
            IEmployeeJournalFactory employeeJournalFactory,
            IEmployeeRepository employeeRepository,
            IGtkTabsOpener gtkTabsOpener,
            IOrderSelectorFactory orderSelectorFactory,
            ICounterpartyJournalFactory counterpartyJournalFactory,
            IDeliveryPointJournalFactory deliveryPointJournalFactory,
            ISubdivisionJournalFactory subdivisionJournalFactory,
            IUndeliveredOrdersJournalOpener undeliveredOrdersJournalOpener,
            IStockRepository stockRepository,
            IReportPrinter reportPrinter,
            ITerminalNomenclatureProvider terminalNomenclatureProvider,
            IEmployeeSettings employeeSettings,
            ICommonServices commonServices)
            : base(filterViewModel, unitOfWorkFactory, commonServices)
        {
            _routeListRepository         = routeListRepository ?? throw new ArgumentNullException(nameof(routeListRepository));
            _fuelRepository              = fuelRepository ?? throw new ArgumentNullException(nameof(fuelRepository));
            _subdivisionRepository       = subdivisionRepository ?? throw new ArgumentNullException(nameof(subdivisionRepository));
            _categoryRepository          = categoryRepository ?? throw new ArgumentNullException(nameof(categoryRepository));
            _trackRepository             = trackRepository ?? throw new ArgumentNullException(nameof(trackRepository));
            _undeliveredOrdersRepository =
                undeliveredOrdersRepository ?? throw new ArgumentNullException(nameof(undeliveredOrdersRepository));
            _deliveryShiftRepository     = deliveryShiftRepository ?? throw new ArgumentNullException(nameof(deliveryShiftRepository));
            _routeListParametersProvider =
                routeListParametersProvider ?? throw new ArgumentNullException(nameof(routeListParametersProvider));
            _callTaskWorker              = callTaskWorker ?? throw new ArgumentNullException(nameof(callTaskWorker));
            _warehouseRepository         = warehouseRepository ?? throw new ArgumentNullException(nameof(warehouseRepository));
            _carJournalFactory           = carJournalFactory ?? throw new ArgumentNullException(nameof(carJournalFactory));
            _employeeJournalFactory      = employeeJournalFactory ?? throw new ArgumentNullException(nameof(employeeJournalFactory));
            _employeeRepository          = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
            _gtkTabsOpener               = gtkTabsOpener ?? throw new ArgumentNullException(nameof(gtkTabsOpener));
            _orderSelectorFactory        = orderSelectorFactory ?? throw new ArgumentNullException(nameof(orderSelectorFactory));
            _counterpartyJournalFactory  = counterpartyJournalFactory ?? throw new ArgumentNullException(nameof(counterpartyJournalFactory));
            _deliveryPointJournalFactory =
                deliveryPointJournalFactory ?? throw new ArgumentNullException(nameof(deliveryPointJournalFactory));
            _subdivisionJournalFactory      = subdivisionJournalFactory ?? throw new ArgumentNullException(nameof(subdivisionJournalFactory));
            _undeliveredOrdersJournalOpener =
                undeliveredOrdersJournalOpener ?? throw new ArgumentNullException(nameof(undeliveredOrdersJournalOpener));
            _stockRepository = stockRepository ?? throw new ArgumentNullException(nameof(stockRepository));
            _reportPrinter   = reportPrinter ?? throw new ArgumentNullException(nameof(reportPrinter));
            _terminalNomenclatureProvider = terminalNomenclatureProvider ?? throw new ArgumentNullException(nameof(terminalNomenclatureProvider));
            _employeeSettings             = employeeSettings ?? throw new ArgumentNullException(nameof(employeeSettings));
            TabName = "Журнал МЛ";

            NotifyConfiguration.Enable();
            NotifyConfiguration.Instance.BatchSubscribeOnEntity <RouteList>(changeEvents => Refresh());

            InitPopupActions();
        }
コード例 #21
0
 public void Init()
 {
     ConfigureOneTime.ConfigureNh();
     InitialiseUowFactory();
     NotifyConfiguration.Enable();
 }
コード例 #22
0
 public void Init()
 {
     InitialiseNHibernate(typeof(RootDeleteItem).Assembly);
     NotifyConfiguration.Enable();
 }
コード例 #23
0
 public void Init()
 {
     InitialiseNHibernate(typeof(SimpleEntity).Assembly);
     NotifyConfiguration.Enable();
 }