public override void Execute(TaskArgument <HttpApplication> context)
        {
            ICategoryService             categoryService         = IoC.Container.Resolve <ICategoryService>();
            List <CreateCategoryRequest> createCategoriesRequest = this.GetCreateCategoriesRequest();

            categoryService.CreateIfNotExist(createCategoriesRequest);
        }
Пример #2
0
        public override void Execute(TaskArgument <HttpApplication> context)
        {
            IPermissionService perService        = IoC.Container.Resolve <IPermissionService>();
            IList <CreatePermissionRequest> pers = this.GetPermissions();

            perService.CreateIfNotExist(pers);
        }
Пример #3
0
        private void StartTask()
        {
            progressLongTask.Value = progressLongTask.Minimum;
            projectMigrationWizzard.NextEnabled = false;
            projectMigrationWizzard.BackEnabled = false;

            var selectedDestinationStudioVersionsGeneric = chkDestinationStudioVersion.CheckedObjects;
            var selectedSourceStudioVersionsGeneric      = chkSourceStudioVersions.CheckedObjects;
            var selectedProjectsToBeMoved = projectsToBeMoved.CheckedObjects;
            var projects = projectsToBeMoved.Objects;
            var selectedPluginsToBeMoved = installedPluginsListView.CheckedObjects;

            var taskArgument = new TaskArgument
            {
                Projects                   = projects.Cast <Project>().ToList(),
                ProjectToBeMoved           = selectedProjectsToBeMoved.Cast <Project>().ToList(),
                DestinationStudioVersion   = (StudioVersion)selectedDestinationStudioVersionsGeneric[0],
                SourceStudioVersion        = (StudioVersion)selectedSourceStudioVersionsGeneric[0],
                MigrateTranslationMemories = chkTranslationMemories.Checked,
                MigrateCustomers           = chkCustomers.Checked,
                PluginsToBeMoved           = selectedPluginsToBeMoved.Cast <Model.PluginInfo>().ToList()
            };

            _bw.RunWorkerAsync(taskArgument);
        }
Пример #4
0
        public void OnApplicationRequestExecuting()
        {
            TaskArgument <TContext> taskArg = new TaskArgument <TContext>(this.Context, this.Type);

            AssemblyHelper.ExecuteTasks <IApplicationRequestExecutingTask <TaskArgument <TContext> >, TaskArgument <TContext> >(taskArg);
            //AssemblyHelper.ExecuteTasks<IApplicationRequestExecutingTask, HttpContext>(httpContext);
        }
Пример #5
0
        public void OnUnHandledError()
        {
            TaskArgument <TContext> taskArg = new TaskArgument <TContext>(this.Context, this.Type);

            AssemblyHelper.ExecuteTasks <IUnHandledErrorTask <TaskArgument <TContext> >, TaskArgument <TContext> >(taskArg);
            //AssemblyHelper.ExecuteTasks<IUnHandledErrorTask, HttpContext>(httpContext);
        }
Пример #6
0
        public void OnRouteConfigured()
        {
            //AssemblyHelper.ExecuteTasks<IRouteConfiguredTask, RouteCollection>(RouteTable.Routes);
            TaskArgument <RouteCollection> taskArg = new TaskArgument <RouteCollection>(RouteTable.Routes, this.Type);

            AssemblyHelper.ExecuteTasks <IRouteConfiguredTask, TaskArgument <RouteCollection> >(taskArg);
        }
        public override void Execute(TaskArgument <HttpApplication> context)
        {
            IRoleService roleService = IoC.Container.Resolve <IRoleService>();
            IList <Role> roles       = GetRoles();

            roleService.CreateIfNotExist(roles);
        }
Пример #8
0
        public virtual void OnApplicationStarted()
        {
            TaskArgument <TContext> taskArg = new TaskArgument <TContext>(this.Context, this.Type);

            AssemblyHelper.ExecuteTasks <IApplicationStartedTask <TaskArgument <TContext> >, TaskArgument <TContext> >(taskArg, true);
            AssemblyHelper.ExecuteTasks <IApplicationReadyTask <TaskArgument <TContext> >, TaskArgument <TContext> >(taskArg, true);
        }
 public override void Execute(TaskArgument <RouteCollection> arg)
 {
     if (!this.IsValid(arg.Type))
     {
         return;
     }
 }
 public override void Execute(TaskArgument <HttpApplication> arg)
 {
     if (!this.IsValid(arg.Type))
     {
         return;
     }
     new DefaultLogger().Info("New request Ended: {0}", arg.Data.Context.Request.RawUrl);
 }
Пример #11
0
 public override void Execute(TaskArgument <System.Web.HttpApplication> arg)
 {
     if (!this.IsValid(arg.Type) || arg.Data.Context.Error == null)
     {
         return;
     }
     logger.Error(arg.Data.Context.Error.ToString());
 }
Пример #12
0
        /// <summary>
        /// this method must call after App.Common.Application.OnApplicationStarted(HttpContext.Current) called
        /// </summary>
        /// <param name="servicesContainer"></param>
        public void ConfigServiceContainer()
        {
            TaskArgument <ServicesContainer> taskArg = new TaskArgument <ServicesContainer>(GlobalConfiguration.Configuration.Services, this.Type);

            AssemblyHelper.ExecuteTasks <IServiceContainerConfiguredTask <TaskArgument <ServicesContainer> >, TaskArgument <ServicesContainer> >(taskArg);

            //AssemblyHelper.ExecuteTasks<IServiceContainerConfiguredTask, System.Web.Http.Controllers.ServicesContainer>(servicesContainer);
        }
        public override void Execute(TaskArgument <RouteCollection> arg)
        {
            if (!this.IsValid(arg.Type))
            {
                return;
            }

            GlobalConfiguration.Configure(WebApiConfig.Register);
        }
        public override void Execute(TaskArgument <System.Web.HttpApplication> arg)
        {
            if (!this.IsValid(arg.Type))
            {
                return;
            }
            var maps = AssemblyHelper.GetAllMappingRegistrations();

            this.ConfigStandardMappings(maps.ToArray());
        }
        public override void Execute(TaskArgument <HttpApplication> context)
        {
            CreateLanguages();
            IList <Entity.Registration.User> users = new List <Entity.Registration.User>();

            users.Add(new Entity.Registration.User("*****@*****.**", "123456", "TU", "Tran"));
            IUserService userService = IoC.Container.Resolve <IUserService>();

            userService.CreateIfNotExist(users);
        }
        public override void Execute(TaskArgument <ServicesContainer> arg)
        {
            if (!this.IsValid(arg.Type))
            {
                return;
            }
            ServicesContainer servicesContainer = arg.Data;

            servicesContainer.Replace(typeof(IHttpControllerActivator), new App.Common.DI.Castle.HttpControllerActivator(IoC.Container.Instance as IWindsorContainer));
        }
        public override void Execute(TaskArgument <System.Web.HttpApplication> context)
        {
            ICommandHandlerStrategy commandHandlerStrategy = CommandHandlerStrategyFactory.Create <User>();
            CreateUserCommand       request = this.CreateUserCommand();

            commandHandlerStrategy.Execute(request);

            ILogger logger = IoC.Container.Resolve <ILogger>();

            logger.Info("New user created with Id:{0}", request.Result);
        }
        public override void Execute(TaskArgument <RouteCollection> arg)
        {
            //return;
            if (!this.IsValid(arg.Type))
            {
                return;
            }
            HttpConfiguration config = GlobalConfiguration.Configuration;
            var corsAttr             = new EnableCorsAttribute("*", "*", "*");

            config.EnableCors(corsAttr);
        }
Пример #19
0
        public override void Execute(TaskArgument <System.Web.HttpApplication> arg)
        {
            if (!this.IsValid(arg.Type))
            {
                return;
            }
            var formatters    = GlobalConfiguration.Configuration.Formatters;
            var jsonFormatter = formatters.JsonFormatter;
            var settings      = jsonFormatter.SerializerSettings;

            settings.ContractResolver = new CamelCasePropertyNamesContractResolver();
        }
Пример #20
0
 public override void Execute(TaskArgument <RouteCollection> arg)
 {
     if (!this.IsValid(arg.Type))
     {
         return;
     }
     GlobalConfiguration.Configure((HttpConfiguration config) =>
     {
         config.Services.Replace(typeof(IHttpControllerTypeResolver), new App.Common.MVC.Resolver.HttpControllerTypeResolver());
         config.MapHttpAttributeRoutes();
     });
 }
Пример #21
0
        public override void Execute(TaskArgument <RouteCollection> arg)
        {
            if (!this.IsValid(arg.Type))
            {
                return;
            }

            RouteCollection routes = arg.Data;

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("favicon.ico");
        }
Пример #22
0
        public override void Execute(TaskArgument <System.Web.HttpApplication> arg)
        {
            if (!this.IsValid(arg.Type))
            {
                return;
            }

            var types = AssemblyHelper.GetAllApplicationTypes();

            //var types = Assembly.Load("Application.Common").GetTypes().ToList();
            //types.AddRange(Assembly.Load("Omega.Context").GetTypes());
            ConfigStandardMappings(types.ToArray());
        }
Пример #23
0
        public override void Execute(TaskArgument <System.Web.HttpApplication> taskArg)
        {
            IWindsorContainer windsorContainer = new WindsorContainer();

            this.RegisterInjector(windsorContainer);
            this.RegisterControllerFactory(windsorContainer);

            IBaseContainer baseContainer = new CastleContainer(windsorContainer);

            IoC.CreateInstance(baseContainer);

            AssemblyHelper.ExecuteTasks <IBootstrapper, IBaseContainer>(IoC.Container);
        }
Пример #24
0
        public override void Execute(TaskArgument <HttpApplication> context)
        {
            if (!this.IsValid(context.Type))
            {
                return;
            }
            IList <CreateContentTypeRequest> request = new List <CreateContentTypeRequest>();

            request.Add(new CreateContentTypeRequest("Product", "product", "Product desc"));
            request.Add(new CreateContentTypeRequest("Article", "article", "Article desc"));
            request.Add(new CreateContentTypeRequest("News", "news", "News desc"));
            IContentTypeService service = IoC.Container.Resolve <IContentTypeService>();

            service.CreateIfNotExist(request);
        }
Пример #25
0
        public override void Execute(TaskArgument <RouteCollection> arg)
        {
            if (!this.IsValid(arg.Type))
            {
                return;
            }

            RouteCollection routes = arg.Data;

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("favicon.ico");

            routes.MapRoute(
                "Default",                    // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );
        }
Пример #26
0
        public override void Execute(TaskArgument <RouteCollection> arg)
        {
            if (!this.IsValid(arg.Type))
            {
                return;
            }

            HttpConfiguration config = GlobalConfiguration.Configuration;

            //config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { controller = "users", id = RouteParameter.Optional });

            RouteCollection routes = arg.Data;

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("favicon.ico");
        }
        public override void Execute(TaskArgument <System.Web.HttpApplication> arg)
        {
            if (!this.IsValid(arg.Type))
            {
                return;
            }
            ILogger      logger   = IoC.Container.Resolve <ILogger>();
            string       baseUri  = Configuration.Current.Setting.BaseUri;
            IList <Type> handlers = AssemblyHelper.GetTypes <RemoteEventSubcriberHandler>().ToList();
            IList <EventRegistration> registrations = EventHelper.GetSubcriberRequests(handlers);
            IConnector restConnector = ConnectorFactory.Create(ConnectorType.REST);

            foreach (EventRegistration registration in registrations)
            {
                string fullUri = String.Format("{0}/{1}", baseUri, registration.Uri);
                RegisterEventSubcriber subcriberEvent = new RegisterEventSubcriber(registration.EventClassName, registration.ModuleName, fullUri);
                restConnector.Post <RegisterEventSubcriber, string>(Configurations.Configuration.Current.MessageBus.RegisterEventSubciberUri, subcriberEvent);
                logger.Info("Register uri \'{0}\' to \'{1}\'", subcriberEvent, Configurations.Configuration.Current.MessageBus.RegisterEventSubciberUri);
            }
        }
        public override void Execute(TaskArgument <IAppBuilder> arg)
        {
            if (!this.IsValid(arg.Type) || !AuthType.Owin.IsIncludedIn(Configuration.Current.Authentication.AuthType))
            {
                return;
            }
            AuthType authType = Configuration.Current.Authentication.AuthType;

            switch (authType)
            {
            case AuthType.OwinTokenBase:
                ConfigOwinTokenBase(arg.Data);
                break;

            case AuthType.OwinBasic:
                ConfigBasicAuth(arg.Data);
                break;

            default:
                throw new ValidationException("common.authentication.invalidAuthType");
            }
        }
Пример #29
0
 protected override void OnEnterTask(TaskArgument args)
 {
     accessMe = args.AccessMe;
 }
Пример #30
0
        public virtual void OnUnHandledError()
        {
            TaskArgument <TContext> taskArg = new TaskArgument <TContext>(this.Context, this.Type);

            AssemblyHelper.ExecuteTasks <IUnHandledErrorTask <TaskArgument <TContext> >, TaskArgument <TContext> >(taskArg, true);
        }