public AnalyticDriverViewModel(DisplayEntities.Analytic entity, ModuleFeature feature, AnalyticDisplayServices analyticDisplayService) { if (entity == null) { throw new ArgumentNullException("entity"); } if (feature == null) { throw new ArgumentNullException("feature"); } if (analyticDisplayService == null) { throw new ArgumentNullException("analyticDisplayService"); } Entity = entity; SelectedFeature = feature; _analyticDisplayService = analyticDisplayService; if (entity.SelectedValueDriver != null) { //Prepare the selected driver for the bound view. entity.EnsureModeIsSelected(entity.SelectedValueDriver); entity.SetRunResultsSelectedDriverOnly(); } InitializeEventHandlers(); InitializeCommands(); }
public static string DumpAnalyticSearchEntities(this ModuleFeature feature) { StringBuilder sb = new StringBuilder(); sb.AppendLine("Sort|ParentName|SearchGroupName|ItemCount|SearchKey|Id|Name|Owner\n"); var parentGroups = feature.SearchGroups.GroupBy(i => i.ParentName); foreach (var grouping in parentGroups) { foreach (FeatureSearchGroup searchGroup in grouping) { var matchingEntities = feature.SearchableEntities.Where(item => item.SearchGroupKey == searchGroup.SearchGroupKey); foreach (ISearchableEntity entity in matchingEntities) { Analytic analytic = entity as Analytic; object[] values = { searchGroup.Sort, grouping.Key, searchGroup.Name, searchGroup.ItemCount, searchGroup.SearchGroupKey, entity.Id, analytic.Identity.Name, analytic.Identity.Owner }; sb.AppendFormat("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}\n", values); } } } string result = sb.ToString(); return(result); }
private void OnSelectedFeatureChanged(ModuleFeature feature) { this.RaisePropertyChanged("IsFeatureSelected"); this.RaisePropertyChanged("IsDetailDisplayed"); SelectedFeature = feature; }
private static List <ISearchableEntity> GetSampleSearchEntities(ModuleFeature feature) { var searchEntities = new List <ISearchableEntity>(); if (feature.TypeId == DTO.ModuleFeatureType.PlanningAnalytics) { var analytics = MockAnalyticGenerator.GetSampleAnalytics(); var entities = analytics.Cast <ISearchableEntity>(); searchEntities.AddRange(entities); } else { foreach (FeatureSearchGroup searchGroup in feature.SearchGroups) { for (int id = 0; id < searchGroup.ItemCount; id++) { ISearchableEntity entity = GetSearchEntity(feature, id); if (entity != null) { entity.SearchGroupKey = searchGroup.SearchGroupKey; searchEntities.Add(entity); } } } } return(searchEntities); }
private static void PopulateDefaultStepTypes(List <ModuleFeature> features) { //Populate the Analytics feature: ModuleFeature feature = features.Where(f => f.TypeId == DTO.ModuleFeatureType.PlanningAnalytics).FirstOrDefault(); if (feature != null) { feature.LandingStepType = DTO.ModuleFeatureStepType.PlanningAnalyticsSearchAnalytics; feature.ActionStepType = DTO.ModuleFeatureStepType.PlanningAnalyticsIdentity; } //Populate the price routine features: feature = features.Where(f => f.TypeId == DTO.ModuleFeatureType.PlanningEverydayPricing).FirstOrDefault(); if (feature != null) { feature.LandingStepType = DTO.ModuleFeatureStepType.PlanningEverydayPricingSearchEveryday; feature.ActionStepType = DTO.ModuleFeatureStepType.PlanningEverydayPricingIdentity; } feature = features.Where(f => f.TypeId == DTO.ModuleFeatureType.PlanningPromotionPricing).FirstOrDefault(); if (feature != null) { feature.LandingStepType = DTO.ModuleFeatureStepType.PlanningPromotionPricingSearchPromotions; feature.ActionStepType = DTO.ModuleFeatureStepType.PlanningPromotionPricingIdentity; } feature = features.Where(f => f.TypeId == DTO.ModuleFeatureType.PlanningKitPricing).FirstOrDefault(); if (feature != null) { feature.LandingStepType = DTO.ModuleFeatureStepType.PlanningKitPricingSearchKits; feature.ActionStepType = DTO.ModuleFeatureStepType.PlanningKitPricingIdentity; } }
public async Task <ActionResult> Integrations() { if (!await _authorizationService.AuthorizeAsync(User, OrchardCore.Features.Permissions.ManageFeatures)) // , T["Not allowed to manage features."] { return(Unauthorized()); } var enabledFeatures = await _shellFeaturesManager.GetEnabledFeaturesAsync(); // var alwaysEnabledFeatures = await _shellFeaturesManager.GetAlwaysEnabledFeaturesAsync(); // var integrationFeatures = enabledFeatures.Where(extensionDescriptor => // { // var tags = extensionDescriptor.Extension.Manifest.Tags.ToArray(); // var isIntegrationFeature = // tags.Any(x => string.Equals(x, "integration", StringComparison.OrdinalIgnoreCase)); // // return isIntegrationFeature; // }); var moduleFeatures = new List <ModuleFeature>(); foreach (var moduleFeatureInfo in _extensionManager .GetFeatures() .Where(f => !f.Extension.IsTheme() && FeatureIsAllowed(f))) { var dependentFeatures = _extensionManager.GetDependentFeatures(moduleFeatureInfo.Id); var featureDependencies = _extensionManager.GetFeatureDependencies(moduleFeatureInfo.Id); var isIntegrationFeature = IsIntegrationFeature(moduleFeatureInfo.Extension.Manifest); if (isIntegrationFeature == true) { var moduleFeature = new ModuleFeature { Descriptor = moduleFeatureInfo, IsEnabled = enabledFeatures.Contains(moduleFeatureInfo), // IsAlwaysEnabled = alwaysEnabledFeatures.Contains(moduleFeatureInfo), //IsRecentlyInstalled = _moduleService.IsRecentlyInstalled(f.Extension), //NeedsUpdate = featuresThatNeedUpdate.Contains(f.Id), EnabledDependentFeatures = dependentFeatures.Where(x => x.Id != moduleFeatureInfo.Id).ToList(), FeatureDependencies = featureDependencies.Where(d => d.Id != moduleFeatureInfo.Id).ToList() }; moduleFeatures.Add(moduleFeature); } } return(View(new FeaturesViewModel { Features = moduleFeatures, IsAllowed = FeatureIsAllowed })); }
public SearchViewModel(ModuleFeature feature, AnalyticDisplayServices analyticDisplayService) { if (feature == null) { throw new ArgumentNullException("feature"); } if (analyticDisplayService == null) { throw new ArgumentNullException("analyticDisplayServices"); } SelectedFeature = feature; _analyticDisplayService = analyticDisplayService; InitializeEventHandlers(); InitializeCommands(); }
public FilterViewModel(IFilterContainer entity, ModuleFeature feature) { if (entity == null) { throw new ArgumentNullException("entity"); } if (feature == null) { throw new ArgumentNullException("feature"); } Entity = entity; SelectedFeature = feature; if (entity.SelectedFilterGroup == null && entity.FilterGroups.Count > 0) { entity.SelectedFilterGroup = entity.FilterGroups[0]; } InitializeCommands(); }
public async Task <ActionResult> Features() { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageFeatures)) { return(Forbid()); } var enabledFeatures = await _shellFeaturesManager.GetEnabledFeaturesAsync(); var alwaysEnabledFeatures = await _shellFeaturesManager.GetAlwaysEnabledFeaturesAsync(); var moduleFeatures = new List <ModuleFeature>(); foreach (var moduleFeatureInfo in _extensionManager .GetFeatures() .Where(f => !f.Extension.IsTheme() && FeatureIsAllowed(f))) { var dependentFeatures = _extensionManager.GetDependentFeatures(moduleFeatureInfo.Id); var featureDependencies = _extensionManager.GetFeatureDependencies(moduleFeatureInfo.Id); var moduleFeature = new ModuleFeature { Descriptor = moduleFeatureInfo, IsEnabled = enabledFeatures.Contains(moduleFeatureInfo), IsAlwaysEnabled = alwaysEnabledFeatures.Contains(moduleFeatureInfo), //IsRecentlyInstalled = _moduleService.IsRecentlyInstalled(f.Extension), //NeedsUpdate = featuresThatNeedUpdate.Contains(f.Id), DependentFeatures = dependentFeatures.Where(x => x.Id != moduleFeatureInfo.Id).ToList(), FeatureDependencies = featureDependencies.Where(d => d.Id != moduleFeatureInfo.Id).ToList() }; moduleFeatures.Add(moduleFeature); } return(View(new FeaturesViewModel { Features = moduleFeatures, IsAllowed = FeatureIsAllowed })); }
/// <summary> /// Factory method for getting searchable entities. /// </summary> /// <param name="feature"></param> /// <returns>A concrete instance that implements ISearchableEntity.</returns> private static ISearchableEntity GetSearchEntity(ModuleFeature feature, int id) { ISearchableEntity result = null; switch (feature.TypeId) { case DTO.ModuleFeatureType.PlanningAnalytics: result = MockAnalyticGenerator.GetSampleAnalytic(id); break; case DTO.ModuleFeatureType.PlanningEverydayPricing: result = MockPricingEverydayGenerator.GetSamplePricingEveryday(id); break; case DTO.ModuleFeatureType.PlanningPromotionPricing: result = GetSamplePricingPromotion(id); break; case DTO.ModuleFeatureType.PlanningKitPricing: result = GetSamplePricingKits(id); break; case DTO.ModuleFeatureType.AdministrationUserMaintenance: result = GetSampleUser(id); break; default: break; } if (result != null) { result.Id = id; } return(result); }
private static List <FeatureSearchGroup> GetSampleSearchGroups(ModuleFeature feature) { var searchGroups = new List <FeatureSearchGroup>(); if (feature.TypeId == DTO.ModuleFeatureType.PlanningAnalytics) { searchGroups = MockAnalyticGenerator.GetAnalyticSearchGroups(); } else if (feature.TypeId == DTO.ModuleFeatureType.PlanningEverydayPricing || feature.TypeId == DTO.ModuleFeatureType.PlanningKitPricing || feature.TypeId == DTO.ModuleFeatureType.PlanningPromotionPricing) { string myFolders = "My Folders"; searchGroups.Add(new FeatureSearchGroup { ParentName = "Recent", Name = "Recent", SearchGroupKey = "searchKey001", Sort = 1, ItemCount = 2 }); searchGroups.Add(new FeatureSearchGroup { ParentName = myFolders, Name = "Restoration Parts", SearchGroupKey = "searchKey111", Sort = 4, ItemCount = 6 }); searchGroups.Add(new FeatureSearchGroup { ParentName = myFolders, Name = "Hi Performance & Aftermarket", SearchGroupKey = "searchKey112", Sort = 5, ItemCount = 4 }); searchGroups.Add(new FeatureSearchGroup { ParentName = myFolders, Name = "Apparel & Novelties", SearchGroupKey = "searchKey113", Sort = 6, ItemCount = 8 }); //Make "My Folder" items editable and movable. var editableSearchGroups = searchGroups.Where(group => group.ParentName == myFolders); foreach (FeatureSearchGroup searchGroup in editableSearchGroups) { searchGroup.CanNameChange = true; searchGroup.CanSearchKeyChange = true; } } return(searchGroups); }
public async Task <ActionResult> Features() { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageFeatures)) // , T["Not allowed to manage features."] { return(Unauthorized()); } //var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate(); var shellDescriptor = await _shellDescriptorManager.GetShellDescriptorAsync(); var availableFeatures = _extensionManager.GetExtensions().Features; var moduleFeatures = new List <ModuleFeature>(); foreach (var moduleFeatureInfo in availableFeatures.Where(f => !f.Extension.Manifest.IsTheme())) { var dependentFeatures = await _moduleService.GetDependentFeaturesAsync(moduleFeatureInfo.Id); var moduleFeature = new ModuleFeature { Descriptor = moduleFeatureInfo, IsEnabled = shellDescriptor.Features.Any(sf => sf.Id == moduleFeatureInfo.Id), //IsRecentlyInstalled = _moduleService.IsRecentlyInstalled(f.Extension), //NeedsUpdate = featuresThatNeedUpdate.Contains(f.Id), DependentFeatures = dependentFeatures.Where(x => x.Id != moduleFeatureInfo.Id).ToList() }; moduleFeatures.Add(moduleFeature); } return(View(new FeaturesViewModel { Features = moduleFeatures, IsAllowed = ExtensionIsAllowed })); }
private static List <ModuleFeatureStep> GetSampleSteps(string moduleName, ModuleFeature feature) { var steps = new List <ModuleFeatureStep>(); switch (feature.TypeId) { case DTO.ModuleFeatureType.PlanningAnalytics: steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "Search Analytics", Title = "Search saved Analytics", TypeId = DTO.ModuleFeatureStepType.PlanningAnalyticsSearchAnalytics, Sort = 1 }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "1) Identity", Title = "Identify Analytics with a unique name and description", TypeId = DTO.ModuleFeatureStepType.PlanningAnalyticsIdentity, Sort = 2, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "2) Filters", Title = "Configure Analytics product filters & define a product set", TypeId = DTO.ModuleFeatureStepType.PlanningAnalyticsFilters, Sort = 3, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "3) Price Lists", Title = "Configure Analytics price list metrics & aggregation", TypeId = DTO.ModuleFeatureStepType.PlanningAnalyticsPriceLists, Sort = 4, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "4) Value Drivers", Title = "Configure Analytics Value Driver metrics and optimization", TypeId = DTO.ModuleFeatureStepType.PlanningAnalyticsValueDrivers, Sort = 5, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "5) Results", Title = "Compare Analytics result set & view reports", TypeId = DTO.ModuleFeatureStepType.PlanningAnalyticsResults, Sort = 6, }); break; case DTO.ModuleFeatureType.PlanningEverydayPricing: steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "Search Everyday", Title = "Search saved Pricing campaigns", TypeId = DTO.ModuleFeatureStepType.PlanningEverydayPricingSearchEveryday, Sort = 1, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "1) Identity", Title = "Identify Price routines with a unique name and description", TypeId = DTO.ModuleFeatureStepType.PlanningEverydayPricingIdentity, Sort = 2, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "2) Filters", Title = "Configure Price routine product filters & define a product set", TypeId = DTO.ModuleFeatureStepType.PlanningEverydayPricingFilters, Sort = 3, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "3) Price Lists", Title = "Configure Price routine price lists ", TypeId = DTO.ModuleFeatureStepType.PlanningEverydayPricingPriceLists, Sort = 4, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "4) Rounding", Title = "Configure Price routine rounding", TypeId = DTO.ModuleFeatureStepType.PlanningEverydayPricingRounding, Sort = 5, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "5) Strategy", Title = "Configure Price routine optimization strategy", TypeId = DTO.ModuleFeatureStepType.PlanningEverydayPricingStrategy, Sort = 6, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "6) Results", Title = "Compare and edit Price routine results", TypeId = DTO.ModuleFeatureStepType.PlanningEverydayPricingResults, Sort = 7, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "7) Impact Analysis", Title = "Create a Price routine forecast", TypeId = DTO.ModuleFeatureStepType.PlanningEverydayPricingForecast, Sort = 8, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "8) Request Approval", Title = "Submit this Price routine for approval", TypeId = DTO.ModuleFeatureStepType.PlanningEverydayPricingApproval, Sort = 9, }); break; case DTO.ModuleFeatureType.PlanningPromotionPricing: steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "Search Promotions", Title = "Search saved Pricing campaigns", TypeId = DTO.ModuleFeatureStepType.PlanningPromotionPricingSearchPromotions, Sort = 1, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "1) Identity", Title = "Identify Price routines with a unique name and description", TypeId = DTO.ModuleFeatureStepType.PlanningPromotionPricingIdentity, Sort = 2, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "2) Filters", Title = "Configure Price routine product filters & define a product set", TypeId = DTO.ModuleFeatureStepType.PlanningPromotionPricingFilters, Sort = 3, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "3) Price Lists", Title = "Configure Price routine price lists ", TypeId = DTO.ModuleFeatureStepType.PlanningPromotionPricingPriceLists, Sort = 4, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "4) Rounding", Title = "Configure Price routine rounding", TypeId = DTO.ModuleFeatureStepType.PlanningPromotionPricingRounding, Sort = 5, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "5) Strategy", Title = "Configure Price routine optimization strategy", TypeId = DTO.ModuleFeatureStepType.PlanningPromotionPricingStrategy, Sort = 6, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "6) Results", Title = "Compare and edit Price routine results", TypeId = DTO.ModuleFeatureStepType.PlanningPromotionPricingResults, Sort = 7, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "7) Impact Analysis", Title = "Create a Price routine forecast", TypeId = DTO.ModuleFeatureStepType.PlanningPromotionPricingForecast, Sort = 8, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "8) Request Approval", Title = "Submit this Price routine for approval", TypeId = DTO.ModuleFeatureStepType.PlanningPromotionPricingApproval, Sort = 9, }); break; case DTO.ModuleFeatureType.PlanningKitPricing: steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "Search Kits", Title = "Search saved Pricing campaigns", TypeId = DTO.ModuleFeatureStepType.PlanningKitPricingSearchKits, Sort = 1, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "1) Identity", Title = "Identify Price routines with a unique name and description", TypeId = DTO.ModuleFeatureStepType.PlanningKitPricingIdentity, Sort = 2, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "2) Filters", Title = "Configure Price routine product filters & define a product set", TypeId = DTO.ModuleFeatureStepType.PlanningKitPricingFilters, Sort = 3, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "3) Price Lists", Title = "Configure Price routine price lists ", TypeId = DTO.ModuleFeatureStepType.PlanningKitPricingPriceLists, Sort = 4, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "4) Rounding", Title = "Configure Price routine rounding", TypeId = DTO.ModuleFeatureStepType.PlanningKitPricingRounding, Sort = 5, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "5) Strategy", Title = "Configure Price routine optimization strategy", TypeId = DTO.ModuleFeatureStepType.PlanningKitPricingStrategy, Sort = 6, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "6) Results", Title = "Compare and edit Price routine results", TypeId = DTO.ModuleFeatureStepType.PlanningKitPricingResults, Sort = 7, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "7) Impact Analysis", Title = "Create a Price routine forecast", TypeId = DTO.ModuleFeatureStepType.PlanningKitPricingForecast, Sort = 8, }); steps.Add(new DisplayEntities.ModuleFeatureStep { Name = "8) Request Approval", Title = "Submit this Price routine for approval", TypeId = DTO.ModuleFeatureStepType.PlanningKitPricingApproval, Sort = 9, }); break; default: break; } steps.ForEach(step => step.Actions = GetSampleActions(step)); //For demo purposes, mark all steps as completed except for the following: string[] notCompleted = { "7) Impact Analysis", "8) Request Approval", "Search Everyday" }; var incompleteSteps = from step in steps where notCompleted.Contains(step.Name) select step; foreach (ModuleFeatureStep step in steps.Except(incompleteSteps)) { step.IsCompleted = true; } return(steps); }
public PricingSearchViewModel(ModuleFeature selectedFeature) { SelectedFeature = selectedFeature; }