static MrCMSApp() { AllApps.ForEach(app => { HashSet <Type> webpageTypes = TypeHelper.GetAllConcreteTypesAssignableFrom <Webpage>() .FindAll(type => CheckIsInApp(type, app)); webpageTypes.ForEach(type => AppWebpages[type] = app.AppName); HashSet <Type> widgetTypes = TypeHelper.GetAllConcreteTypesAssignableFrom <Widget>() .FindAll(type => CheckIsInApp(type, app)); widgetTypes.ForEach(type => AppWidgets[type] = app.AppName); HashSet <Type> userProfileTypes = TypeHelper.GetAllConcreteTypesAssignableFrom <UserProfileData>() .FindAll(type => CheckIsInApp(type, app)); userProfileTypes.ForEach(type => AppUserProfileDatas[type] = app.AppName); HashSet <Type> entities = TypeHelper.GetAllConcreteMappedClassesAssignableFrom <SystemEntity>() .FindAll(type => CheckIsInApp(type, app)); entities.ForEach(type => AppEntities[type] = app.AppName); IEnumerable <Type> types = TypeHelper.GetAllTypes() .Where( type => !string.IsNullOrWhiteSpace(type.Namespace) && CheckIsInApp(type, app)); types.ForEach(type => AllAppTypes[type] = app.AppName); }); }
protected override void ConcreteExecute(IJobExecutionContext context) { if (AllApps == null) { return; } var commands = new List <PatchCommandData>(); for (int index = 0; index < AllApps.Count(); index++) { var app = AllApps[index]; var isActive = AllActiveAppIds.Contains(app.AppId.ToString()); if (app.IsActive != isActive) { var cmd = new PatchCommandData() { Key = app.Id, Patches = new[] { new PatchRequest { Name = "IsActive", Value = RavenJToken.FromObject(isActive) } } }; commands.Add(cmd); } } if (commands.Count > 0) { const int batchSize = 512; int handled = 0; do { var commandsToSave = commands .Skip(handled) .Take(batchSize) .ToList(); Store.DatabaseCommands.Batch(commandsToSave); handled += commandsToSave.Count(); Console.WriteLine("Saving {0} {1}/{2} applications", commandsToSave.Count(), handled, commands.Count); Thread.Sleep(5000); } while (handled < commands.Count); } }
public MultiSelector <ISelectable> GetAppSelector(int labelId) { var apps = NewItemApps[labelId]; return(new MultiSelector <ISelectable>() { Prompt = "Apps:", PrimaryFieldName = "ApplicationId", RelatedFieldName = "LabelId", PostUrl = "/Update/NewItemAppLabel", RelatedId = labelId, Items = AllApps.Select(t => new Team() { Id = t.Id, Name = t.Name, Selected = apps.Contains(t) }) }); }
public static void RegisterAllServices(IKernel kernel) { AllApps.ForEach(app => app.RegisterServices(kernel)); }
private static void RegisterAllApps(RouteCollection routes, object state) { AllApps.ForEach(app => app.CreateContext(routes, state)); }