Exemple #1
0
        public static void PreInitialize()
        {
            var webStack = new AspNetWebStack();

            WebBootstrapper.PreInitializeWebStack(webStack);

            CmsConfiguration.Current.AddMvcSupport();
            CmsConfiguration.Current.AddWebFormsSupport();
            CmsConfiguration.Current.AddStaticContentSupport();

            ToolboxPropertyFilter.BlacklistedDeclaringAssemblies.AddRange(new[]
            {
                typeof(Control).Assembly,
                typeof(Controller).Assembly,
                typeof(WarpCoreEntity).Assembly
            });



            Dependency.Register <ICosmosOrm>(typeof(InMemoryDb));

            DomainEvents.Subscribe <SiteBootCompleted>(_ =>
            {
                var demoInstaller = new DemoInstaller();
                demoInstaller.SetupDynamicTypes();
                demoInstaller.SetupCustomFields();
                demoInstaller.SetupToolbox();
                demoInstaller.SetupBackendSite();


                PublishingShortcuts.PublishSites();
                demoInstaller.SetupTestSite();
            });
        }
Exemple #2
0
        public WebPipelineAction DetermineWebPipelineActionForUrl(IHttpRequest request)
        {
            if (!WebBootstrapper.IsBooted)
            {
                WebBootstrapper.EnsureSiteBootHasBeenStarted();
                return(new BootPage());
            }

            WebPipelineAction webPipelineAction = null;

            var preRequestProcessor = new BlazorWebPipeline(request);

            webPipelineAction = preRequestProcessor.TryProcessAsBlazorRequest();

            var hasResult = webPipelineAction != null;

            if (!hasResult)
            {
                var builder     = new CmsPageRequestBuilder();
                var pageRequest = builder.Build(request);
                WebDependencies.PerRequestRouteData.DataTokens.Add(CmsRouteDataTokens.RouteDataToken, pageRequest);

                if (pageRequest.Route != null)
                {
                    var handler = new WarpCorePageRequestActionBuilder(request);
                    webPipelineAction = handler.ProcessRequest(pageRequest);
                }
                else
                {
                    return(new UnhandledRequest());
                }
            }

            return(webPipelineAction);
        }
Exemple #3
0
 /// <summary>注册全局过滤器</summary>
 public static void RegisterGlobalFilters(GlobalFilterCollection filters)
 {
     PKSMvcExtension.AuthenticationConfig.Initialize();
     filters.Add(WebBootstrapper.Get <PKSAuthorizeAttribute>());
     filters.Add(WebBootstrapper.Get <PKSExceptionFilterAttribute>());
     ViewEngines.Engines.Clear();
     ViewEngines.Engines.Add(new RazorViewEngine());
 }
        public static CustomStateDetail GetCustomState(int departmentId, int detailId)
        {
            var customStateService = WebBootstrapper.GetKernel().Resolve <ICustomStateService>();

            var stateDetail = customStateService.GetCustomDetailForDepartment(departmentId, detailId);

            return(stateDetail);
        }
Exemple #5
0
        public static ClaimsPrincipal GetClaimsPrincipal()
        {
            if (_httpContextAccessor == null)
            {
                _httpContextAccessor = WebBootstrapper.GetKernel().Resolve <IHttpContextAccessor>();
            }

            return(_httpContextAccessor.HttpContext.User);
        }
Exemple #6
0
        public TopIconsModel()
        {
            if (_messageService == null)
            {
                _messageService = WebBootstrapper.GetKernel().Resolve <IMessageService>();
            }

            if (_callsService == null)
            {
                _callsService = WebBootstrapper.GetKernel().Resolve <ICallsService>();
            }
        }
Exemple #7
0
        /// <summary>Registers the type mappings with the Unity container.</summary>
        /// <param name="container">The unity container to configure.</param>
        /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to
        /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks>
        private static void RegisterTypes(IUnityContainer container)
        {
            //  register global dependencies
            WebBootstrapper.SetupDependency(container);
            RepositoryBootstrapper.SetupDependency(container);
            ServiceBootstrapper.SetupDependency(container);

            //  register owin dependencies
            container.RegisterType <IRoleStore <Role, int>, RoleStore <Role, int, UserRoles> >();
            container.RegisterType <IUserStore <User, int>, UserStore <User, Role, int, UserLogins, UserRoles, UserClaims> >();
            container.RegisterType <IAuthenticationManager>(new InjectionFactory(c => HttpContext.Current.GetOwinContext().Authentication));

            //  register inner app dependencies
            container.RegisterType <EoraUserManager>();
            container.RegisterType <EoraSignInManager>();
        }
Exemple #8
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            var builder = AppContainer.Create();

            WebBootstrapper.InitializeProduction(builder);
            builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
            AppContainer.Factory     = builder.Build();
            AppConfiguration.Factory = AppContainer.Current.Resolve <IAppConfigurationService>();
            var loggerBuilder = new ContainerBuilder();

            loggerBuilder.RegisterModule(new LoggerContainer());
            AppContainer.UpdateContainer(loggerBuilder);
            GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(AppContainer.Current);
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
Exemple #9
0
        public void SetMessages(string userId, int departmentId)
        {
            // Trying to speed this up (may need to ditch it all together) but at times
            // this is a big hit on NewRelic, most likely because it's constructing the
            // message and call service every time. It's not an ideal solution, but hopefully
            // it will help for a bit.
            try
            {
                NewMessages = _messageService.GetUnreadMessagesCountByUserId(userId);
                NewCalls    = _callsService.GetActiveCallsForDepartment(departmentId);
            }
            catch (Exception)
            {
                _messageService = WebBootstrapper.GetKernel().Resolve <IMessageService>();
                _callsService   = WebBootstrapper.GetKernel().Resolve <ICallsService>();

                NewMessages = _messageService.GetUnreadMessagesCountByUserId(userId);
                NewCalls    = _callsService.GetActiveCallsForDepartment(departmentId);
            }
        }
        public static CustomStateDetail GetCustomUnitState(UnitState state)
        {
            if (state.State <= 25)
            {
                var detail = new CustomStateDetail();

                detail.ButtonText  = state.ToStateDisplayText();
                detail.ButtonColor = state.ToStateCss();

                if (string.IsNullOrWhiteSpace(detail.ButtonColor))
                {
                    detail.ButtonColor = "label-default";
                }

                return(detail);
            }
            else
            {
                var customStateService = WebBootstrapper.GetKernel().Resolve <ICustomStateService>();
                var stateDetail        = customStateService.GetCustomDetailForDepartment(state.Unit.DepartmentId, state.State);

                return(stateDetail);
            }
        }
        public static CustomStateDetail GetCustomPersonnelStatus(int departmentId, ActionLog state)
        {
            if (state.ActionTypeId <= 25)
            {
                var detail = new CustomStateDetail();

                detail.ButtonText  = state.GetActionText();
                detail.ButtonColor = state.GetActionCss();

                if (string.IsNullOrWhiteSpace(detail.ButtonColor))
                {
                    detail.ButtonColor = "label-default";
                }

                return(detail);
            }
            else
            {
                var customStateService = WebBootstrapper.GetKernel().Resolve <ICustomStateService>();
                var stateDetail        = customStateService.GetCustomDetailForDepartment(departmentId, state.ActionTypeId);

                return(stateDetail);
            }
        }
Exemple #12
0
 /// <summary>注册全局过滤器</summary>
 public static void RegisterGlobalFiltersForPortalMgmt(GlobalFilterCollection filters)
 {
     //filters.Clear();
     filters.Add(WebBootstrapper.Get <PKSMgmtAuthorizeAttribute>());
     filters.Add(WebBootstrapper.Get <PKSMgmtExceptionFilterAttribute>());
 }
 protected void Application_Start()
 {
     container = WebBootstrapper.Init();
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
 }
 public FubuApplication BuildApplication()
 {
     return(FubuApplication
            .For <FubuWorldRegistry>()
            .StructureMap(() => WebBootstrapper.BuildContainer()));
 }
 public static void InitializeContainer(this IApplicationBuilder app,
                                        Container container, Microsoft.Extensions.Configuration.IConfiguration configuration)
 {
     WebBootstrapper.Bootstrap(container);
 }
Exemple #16
0
 public EventingHub()
 {
     _inboundEventProvider   = WebBootstrapper.GetKernel().Resolve <IInboundEventProvider>();
     _departmentLinksService = WebBootstrapper.GetKernel().Resolve <IDepartmentLinksService>();
     _inboundEventProvider.RegisterForEvents(PersonnelStatusUpdated, UnitStatusUpdated, CallsUpdated, PersonnelStaffingUpdated);
 }
Exemple #17
0
        public static string CallPriorityToString(int departmentId, int priority)
        {
            var callsService = WebBootstrapper.GetKernel().Resolve <ICallsService>();

            return(callsService.CallPriorityToString(priority, departmentId));
        }
Exemple #18
0
 protected void Application_Start(object sender, EventArgs e)
 {
     WebBootstrapper.Bootstrap();
 }