Exemplo n.º 1
0
        /// <summary>
        /// This gets a list of all menu features that need removal.
        /// </summary>
        /// <param name="allcurrentProductFeautres"></param>
        /// <param name="allfeautresAsPerMenuPath"></param>
        /// <returns></returns>
        private List <ProductFeature> getProductFeaturesThatNeedToBeRemoved(List <ProductFeature> allcurrentProductFeautres, List <MenuFeature> allfeautresAsPerMenuPath)
        {
            if (allcurrentProductFeautres.IsNullOrEmpty())
            {
                return(null);
            }

            if (allfeautresAsPerMenuPath.IsNullOrEmpty())
            {
                //remove all the features from the product
                return(allcurrentProductFeautres);
            }

            List <ProductFeature> productFeaturesNotInMenuPath = new List <ProductFeature>();

            foreach (ProductFeature pf in allcurrentProductFeautres)
            {
                MenuFeature mfFound = allfeautresAsPerMenuPath.FirstOrDefault(x => x.Name == pf.Name);
                if (mfFound.IsNull())
                {
                    //this needs removal
                    productFeaturesNotInMenuPath.Add(pf);
                }
            }

            return(productFeaturesNotInMenuPath);
        }
Exemplo n.º 2
0
        public void CreateNewFeature(CreateNewFeatureModel model)
        {
            model.SelfCheck();
            MenuFeature menuFeature = MenuFeatureBiz.FindByName(model.FeatureName);

            if (menuFeature.IsNull())
            {
                menuFeature = MenuFeatureBiz.Factory() as MenuFeature;
                menuFeature.IsNullThrowException("menuFeature");

                menuFeature.Name = model.FeatureName;
                MenuFeatureBiz.CreateAndSave(menuFeature);
                return;
            }
            //if you are here then the feature already exists
            ErrorsGlobal.Add(string.Format("'{0}' already exists!", model.FeatureName), MethodBase.GetCurrentMethod());
            throw new Exception(ErrorsGlobal.ToString());
        }
Exemplo n.º 3
0
        public void CreateNewFeature(CreateNewFeatureModel model)
        {
            model.SelfCheck();
            MenuFeature menuFeature = MenuFeatureBiz.FindByName(model.FeatureName);

            if (menuFeature.IsNull())
            {
                menuFeature = MenuFeatureBiz.Factory() as MenuFeature;
                menuFeature.IsNullThrowException("menuFeature");

                menuFeature.Name = model.FeatureName;
                MenuFeatureBiz.CreateAndSave(menuFeature);
            }
            //create the new feature.

            MenuPath3 menupath3 = Find(model.ParentId);

            menupath3.IsNullThrowException("menupath3");

            //taking a short cut.
            MenuFeatureModel menuFeatureModel = new MenuFeatureModel(model.ParentId, "", menuFeature.Id, model.ReturnUrl);

            AddFeature(menuFeatureModel);
        }