Example #1
0
        private List <ProductFeature> getProductFeaturesWhichAreInMenuPathButNotInProduct(
            List <ProductFeature> allcurrentProductFeautres,
            List <MenuFeature> allfeautresAsPerMenuPath, IProduct iproduct)
        {
            //if (allcurrentProductFeautres.IsNullOrEmpty())
            //    return null;
            iproduct.IsNullThrowException("iproduct");
            if (allfeautresAsPerMenuPath.IsNullOrEmpty())
            {
                return(null);
            }

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



            foreach (MenuFeature mf in allfeautresAsPerMenuPath)
            {
                ProductFeature pf = null;

                //check to see if mf is part of the current features
                if (!allcurrentProductFeautres.IsNull())
                {
                    //locate if mf is part of the ProductFeatures
                    pf = allcurrentProductFeautres.FirstOrDefault(x => x.Name == mf.Name);
                }


                if (pf.IsNull())
                {
                    pf = ProductFeatureBiz.Factory() as ProductFeature;
                    pf.MenuFeatureId = mf.Id;
                    pf.ProductId     = iproduct.Id;

                    pf.MenuFeature = mf;
                    pf.Product     = iproduct as Product;

                    pf.Name          = pf.MakeUniqueName();
                    pf.IsMenuFeature = true;
                    prodFeaturesInMenuButNotInProduct.Add(pf);
                }
            }

            return(prodFeaturesInMenuButNotInProduct);
        }
Example #2
0
        private void addFeatureToEveryProductWithMenuPath2(MenuPath2 menuPath2, MenuFeature menuFeature)
        {
            //Now add the feature to every product that has menu1 as its path.
            //first find all the menuMains that contain MenuPath1
            if (menuPath2.MenuPathMains.IsNullOrEmpty())
            {
                return;
            }

            List <MenuPathMain> menuPathMainList = menuPath2.MenuPathMains.ToList();
            //Now get all the products that have theseMenuPaths as their path.
            HashSet <Product> productHashList = new HashSet <Product>();

            foreach (var menuPathMain in menuPathMainList)
            {
                if (!menuPathMain.Products_Fixed.IsNullOrEmpty())
                {
                    List <Product> menuPathMainProductList = menuPathMain.Products_Fixed.ToList();
                    foreach (var prod in menuPathMainProductList)
                    {
                        productHashList.Add(prod);
                    }
                }
            }

            if (productHashList.IsNullOrEmpty())
            {
                return;
            }

            foreach (var prod2 in productHashList)
            {
                ProductFeature pf = new ProductFeature();
                pf.ProductId     = prod2.Id;
                pf.Product       = prod2;
                pf.MenuFeatureId = menuFeature.Id;
                pf.MenuFeature   = menuFeature;
                pf.Name          = menuFeature.Name;

                ProductFeatureBiz.CreateAndSave(pf);
            }
            SaveChanges();
        }
Example #3
0
 public MyWorkClassesProduct(
     UomVolumeBiz uomVolumeBiz,
     UomLengthBiz uomLengthBiz,
     UomQuantityBiz uomQuantityBiz,
     UomWeightBiz uomWeightBiz,
     MenuPathMainBiz menuPathMainBiz,
     ProductIdentifierBiz productIdentifierBiz,
     //ProductChildBiz productChildBiz,
     ProductFeatureBiz productFeatureBiz,
     MenuFeatureBiz menuFeatureBiz)
 {
     _uomVolumeBiz         = uomVolumeBiz;
     _uomLengthBiz         = uomLengthBiz;
     _uomQuantityBiz       = uomQuantityBiz;
     _uomWeightBiz         = uomWeightBiz;
     _menuPathMainBiz      = menuPathMainBiz;
     _productIdentifierBiz = productIdentifierBiz;
     //_productChildBiz = productChildBiz;
     _productFeatureBiz = productFeatureBiz;
     _menuFeatureBiz    = menuFeatureBiz;
 }
Example #4
0
        private void saveFeature(ProductFeatureModel productFeatureModel)
        {
            productFeatureModel.SelfCheck();

            Product product = Find(productFeatureModel.ParentId);

            product.IsNullThrowException("product");

            MenuFeature menuFeature = MenuFeatureBiz.Find(productFeatureModel.MenuFeatureId);

            menuFeature.IsNullThrowException("Menu feature not found.");

            //create a new product Feature and add it
            ProductFeature productFeature = ProductFeatureBiz.Factory() as ProductFeature;

            productFeature.ProductId     = product.Id;
            productFeature.MenuFeatureId = menuFeature.Id;
            productFeature.Comment       = productFeatureModel.Description;
            productFeature.Name          = menuFeature.FullName();

            product.ProductFeatures.Add(productFeature);
            SaveChanges();
        }
Example #5
0
        public void CreateNewFeature(CreateNewFeatureModel model)
        {
            model.SelfCheck();
            ProductFeature productFeature = ProductFeatureBiz.FindByName(model.FeatureName);

            if (productFeature.IsNull())
            {
                productFeature = ProductFeatureBiz.Factory() as ProductFeature;
                productFeature.IsNullThrowException("productFeature");

                productFeature.Name = model.FeatureName;
                ProductFeatureBiz.CreateAndSave(productFeature);
            }

            //create the new feature.
            Product product = Find(model.ParentId);

            product.IsNullThrowException("product");

            //taking a short cut.
            ProductFeatureModel productFeatureModel = new ProductFeatureModel(model.ParentId, "", productFeature.Id, model.ReturnUrl, model.Description);

            AddFeature(productFeatureModel);
        }
Example #6
0
 public MenuPath3Biz(IRepositry <MenuPath3> entityDal, BizParameters bizParameters, MenuFeatureBiz menuFeatureBiz, ProductFeatureBiz productFeatureBiz)
     : base(entityDal, bizParameters)
 {
     _menuFeatureBiz    = menuFeatureBiz;
     _productFeatureBiz = productFeatureBiz;
 }