public Analytic SaveFilters(DisplayEntities.Analytic analytic) { var payload = analytic.ToPayload(); payload.FilterGroups = analytic.FilterGroups; var session = CreateRequest(payload); var response = _analyticService.SaveFilters(session); Analytic data = null; if (response.SessionOk) { data = response.Data.ToDisplayEntity(); data.SessionOk = response.SessionOk; } else { data = new Analytic { SessionOk = response.SessionOk, ClientMessage = response.ClientMessage, ServerMessage = response.ServerMessage, }; } return(data); }
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 Analytic LoadAnalytic(DisplayEntities.Analytic analytic, int entityId, int searchGroupId, int commandId) { if (analytic != null) { analytic.Id = entityId; analytic.SearchGroupId = searchGroupId; } var session = CreateRequest(analytic); session.ClientCommand = commandId; var response = _analyticService.Load(session); Analytic data = null; if (response.SessionOk) { data = response.Data.ToDisplayEntity(); data.SessionOk = response.SessionOk; } else { data = new Analytic { SessionOk = response.SessionOk, ClientMessage = response.ClientMessage, ServerMessage = response.ServerMessage, }; } return(data); }
//TODO: flesh out implementation. This is a starting point only. private void HandleSelectedAction(DisplayEntities.Action action) { switch (action.TypeId) { //Create a new current entity. case DTO.ModuleFeatureStepActionType.PlanningAnalyticsSearchAnalyticsNew: //Create a new (blank) entity. TODO: refactor. var newAnalytic = new DisplayEntities.Analytic(); newAnalytic.Identity.Name = "Analytic name (new)"; newAnalytic.Identity.Description = "Description (new)"; newAnalytic.IsDirty = true; SelectedAnalytic = newAnalytic; SelectedFeature.SelectedStep = SelectedFeature.DefaultActionStep; SelectedFeature.DisableRemainingSteps(); break; case DTO.ModuleFeatureStepActionType.PlanningEverydayPricingSearchEverydayNew: case DTO.ModuleFeatureStepActionType.PlanningPromotionPricingSearchPromotionsNew: case DTO.ModuleFeatureStepActionType.PlanningKitPricingSearchKitsNew: //Create a new (blank) entity. TODO: refactor. var newPriceRoutine = new DisplayEntities.Pricing(); newPriceRoutine.Identity.Name = "Analytic name (new)"; newPriceRoutine.Identity.Description = "Description (new)"; newPriceRoutine.IsDirty = true; SelectedPriceRoutine = newPriceRoutine; SelectedFeature.SelectedStep = SelectedFeature.DefaultActionStep; SelectedFeature.DisableRemainingSteps(); break; case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningAnalyticsSearchAnalyticsEdit: SelectedFeature.SelectedStep = SelectedFeature.DefaultActionStep; ExecuteAsyncCommand(LoadAnalyticCommand, x => SelectedFeatureViewModel = GetViewModel(SelectedStep), "Retrieving analytic...", "Analytic was successfully retrieved."); break; case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningEverydayPricingSearchEverydayEdit: case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningPromotionPricingSearchPromotionsEdit: case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningKitPricingSearchKitsEdit: //TODO: get the full entity from the server and load edit screen. //This is a simulation only. SelectedPriceRoutine = SelectedEntity as DisplayEntities.Pricing; SelectedFeature.SelectedStep = SelectedFeature.DefaultActionStep; break; //Copy current entity. case DTO.ModuleFeatureStepActionType.PlanningAnalyticsSearchAnalyticsCopy: //Create a copy of the existing entity and load edit screen. SelectedAnalytic = SelectedAnalytic.Copy(); SelectedFeature.SelectedStep = SelectedFeature.DefaultActionStep; SelectedFeature.DisableRemainingSteps(); break; case DTO.ModuleFeatureStepActionType.PlanningPromotionPricingSearchPromotionsCopy: case DTO.ModuleFeatureStepActionType.PlanningEverydayPricingSearchEverydayCopy: case DTO.ModuleFeatureStepActionType.PlanningKitPricingSearchKitsCopy: //Create a copy of the existing entity and load edit screen. SelectedPriceRoutine = SelectedPriceRoutine.Copy(); SelectedFeature.SelectedStep = SelectedFeature.DefaultActionStep; SelectedFeature.DisableRemainingSteps(); break; //Save the current entity. case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningAnalyticsIdentitySave: //TODO: call analytic save method on service. ExecuteAsyncCommand(SaveAnalyticIdentityCommand, x => SelectedFeatureViewModel = GetViewModel(SelectedStep), "Identity saving...", "Identity saved."); SelectedAnalytic.IsDirty = false; SelectedFeature.EnableRemainingSteps(); break; case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningEverydayPricingIdentitySave: case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningPromotionPricingIdentitySave: case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningKitPricingIdentitySave: //TODO: call price routine save method on service. SelectedPriceRoutine.IsDirty = false; SelectedFeature.EnableRemainingSteps(); break; case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningAnalyticsFiltersSave: ExecuteAsyncCommand(SaveFiltersCommand, x => SelectedFeatureViewModel = GetViewModel(SelectedStep), "Filters saving...", "Filters saved."); break; case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningAnalyticsPriceListsSave: ExecuteAsyncCommand(SavePriceListsCommand, x => SelectedFeatureViewModel = GetViewModel(SelectedStep), "Price Lists saving...", "Price Lists saved."); break; case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningAnalyticsValueDriversSave: ExecuteAsyncCommand(SaveValueDriversCommand, x => SelectedFeatureViewModel = GetViewModel(SelectedStep), "Value Drivers saving...", "Value Drivers saved."); break; case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningEverydayPricingPriceListsSave: case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningPromotionPricingPriceListsSave: case APLPX.Client.Entity.ModuleFeatureStepActionType.PlanningKitPricingPriceListsSave: break; } }