Пример #1
0
        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);
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        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);
        }