Beispiel #1
0
        public AnalyticPriceListViewModel(Display.Analytic entity, Display.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.PriceListGroups.Count > 0 && Entity.SelectedPriceListGroup == null)
            {
                Entity.SelectedPriceListGroup = Entity.PriceListGroups[0];
            }

            InitializeCommands();
        }
        public IdentityViewModel(ISearchableEntity entity)
        {
            Analytic = entity as Display.Analytic;

            //SelectedAnalytic = (Domain.Analytic)entity;
            ////Tags2 = SelectedAnalytic.Tags;
            //Tags = new ReactiveList<Domain.Tag>(){
            //    new Domain.Tag{Value="tag-ut"}
            //};

            //this.WhenAny(x => x.SelectedAnalytic, x => x).Subscribe( a => {
            //    TagsToSuggest = ((HomeSearchViewModel)MainViewModel.SubModuleCache[Domain.SubModuleType.Search]).Tags.Select(t => new Domain.Tag { Value = t.ToString() }).ToList();
            //        //TagsToSuggest = SelectedAnalytic.Tags.Select(t => new Domain.Tag { Value = t.ToString() }).ToList();
            //        SelectedTags.Clear();
            //        SelectedTags.AddRange( SelectedAnalytic.Tags.Select(t => new Domain.Tag { Value = t.ToString() }));
            //    });
        }
Beispiel #3
0
        public static Display.Analytic ToDisplayEntity(this DTO.Analytic dto)
        {
            var displayEntity = new Display.Analytic();

            displayEntity.SearchGroupKey = dto.SearchGroupKey;
            displayEntity.SearchGroupId  = dto.SearchGroupId;
            displayEntity.Id             = dto.Id;

            if (dto.Identity != null)
            {
                displayEntity.Identity = dto.Identity.ToDisplayEntity();
            }

            if (dto.FilterGroups != null)
            {
                foreach (DTO.FilterGroup filterGroup in dto.FilterGroups)
                {
                    displayEntity.FilterGroups.Add(filterGroup.ToDisplayEntity());
                }
            }

            if (dto.ValueDrivers != null)
            {
                foreach (DTO.AnalyticValueDriver driver in dto.ValueDrivers)
                {
                    displayEntity.ValueDrivers.Add(driver.ToDisplayEntity());
                }
            }

            if (dto.PriceListGroups != null)
            {
                foreach (DTO.AnalyticPriceListGroup priceListGroup in dto.PriceListGroups)
                {
                    displayEntity.PriceListGroups.Add(priceListGroup.ToDisplayEntity());
                }
            }

            displayEntity.IsDirty = false;

            return(displayEntity);
        }
Beispiel #4
0
        public AnalyticResultsViewModel(Display.Analytic entity, AnalyticDisplayServices analyticDisplayService)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (analyticDisplayService == null)
            {
                throw new ArgumentNullException("analyticDisplayService");
            }

            Entity = entity;
            _analyticDisplayService = analyticDisplayService;

            SelectAllDriversCommand       = ReactiveCommand.Create();
            _selectAllDriversSubscription = SelectAllDriversCommand.Subscribe(v => SelectAllDriversExecuted(v));

            _itemChangedSubscription = Entity.ValueDrivers.ItemChanged.Subscribe(d => OnValueDriverChanged(d));

            //By default, select all drivers to re-run.
            SelectAllDriversExecuted(true);
        }
Beispiel #5
0
        public AnalyticIdentityViewModel(Display.Analytic analytic, Display.ModuleFeature feature, AnalyticDisplayServices analyticDisplayService)
        {
            if (analytic == null)
            {
                throw new ArgumentNullException("analytic");
            }
            if (feature == null)
            {
                throw new ArgumentNullException("feature");
            }
            if (analyticDisplayService == null)
            {
                throw new ArgumentNullException("analyticDisplayService");
            }

            Analytic                = analytic;
            base.SelectedFeature    = feature;
            _analyticDisplayService = analyticDisplayService;

            InitializeEventHandlers();
            InitializeCommands();
        }
Beispiel #6
0
        public static DTO.Analytic ToDto(this Display.Analytic displayEntity)
        {
            DTO.AnalyticIdentity identity = displayEntity.Identity.ToDto();

            var filterGroups = new List <DTO.FilterGroup>();

            foreach (Display.FilterGroup filterGroup in displayEntity.FilterGroups)
            {
                filterGroups.Add(filterGroup.ToDto());
            }

            var drivers = new List <DTO.AnalyticValueDriver>();

            foreach (Display.AnalyticValueDriver driver in displayEntity.ValueDrivers)
            {
                drivers.Add(driver.ToDto());
            }

            var priceListGroups = new List <DTO.AnalyticPriceListGroup>();

            foreach (Display.AnalyticPriceListGroup priceListGroup in displayEntity.PriceListGroups)
            {
                priceListGroups.Add(priceListGroup.ToDto());
            }

            var dto = new DTO.Analytic(
                displayEntity.Id,
                displayEntity.SearchGroupId,
                displayEntity.SearchGroupKey,
                identity,
                drivers,
                priceListGroups,
                filterGroups);

            return(dto);
        }
Beispiel #7
0
 public PriceListViewModel(Display.Analytic entity, List <Display.AnalyticPriceListGroup> priceListGroups)
 {
     Entity          = entity;
     PriceListGroups = priceListGroups;
 }