private void saveFeature(MenuFeatureModel menuFeatureModel) { menuFeatureModel.SelfCheck(); MenuPath1 menuPath1 = Find(menuFeatureModel.ParentId); menuPath1.IsNullThrowException("menuPath1"); MenuFeature menuFeature = MenuFeatureBiz.Find(menuFeatureModel.FeatureId); menuFeature.IsNullThrowException("menuFeature"); if (menuFeature.MenuPath1s.IsNull()) { menuFeature.MenuPath1s = new List <MenuPath1>(); } if (menuPath1.MenuFeatures.IsNull()) { menuPath1.MenuFeatures = new List <MenuFeature>(); } menuFeature.MenuPath1s.Add(menuPath1); menuPath1.MenuFeatures.Add(menuFeature); SaveChanges(); addFeatureToEveryProductWithMenuPath1(menuPath1, menuFeature); }
public void AddFeature(MenuFeatureModel menuFeatureModel) { //first get the parent menuFeatureModel.SelfCheck(); MenuPath3 menuPath3 = Find(menuFeatureModel.ParentId); menuPath3.IsNullThrowException("menuPath3"); MenuFeature menuFeature = MenuFeatureBiz.Find(menuFeatureModel.FeatureId); menuFeature.IsNullThrowException("menuFeature"); if (menuFeature.MenuPath3s.IsNull()) { menuFeature.MenuPath3s = new List <MenuPath3>(); } if (menuPath3.MenuFeatures.IsNull()) { menuPath3.MenuFeatures = new List <MenuFeature>(); } menuFeature.MenuPath3s.Add(menuPath3); menuPath3.MenuFeatures.Add(menuFeature); SaveChanges(); }
public void AddFeature(MenuFeatureModel menuFeatureModel) { //first get the parent menuFeatureModel.SelfCheck(); MenuPath2 menuPath2 = Find(menuFeatureModel.ParentId); menuPath2.IsNullThrowException("menuPath2"); MenuFeature menuFeature = MenuFeatureBiz.Find(menuFeatureModel.FeatureId); menuFeature.IsNullThrowException("menuFeature"); if (menuFeature.MenuPath2s.IsNull()) { menuFeature.MenuPath2s = new List <MenuPath2>(); } if (menuPath2.MenuFeatures.IsNull()) { menuPath2.MenuFeatures = new List <MenuFeature>(); } menuFeature.MenuPath2s.Add(menuPath2); menuPath2.MenuFeatures.Add(menuFeature); SaveChanges(); addFeatureToEveryProductWithMenuPath2(menuPath2, menuFeature); }
public MenuFeature DeleteMenuPath2ItemFor(string menuFeatureId, string menuPath2Id) { menuFeatureId.IsNullOrWhiteSpaceThrowArgumentException(); menuPath2Id.IsNullOrWhiteSpaceThrowArgumentException(); //make sure that the menuPath is not already a part of the menuFeature MenuFeature mf = MenuFeatureBiz.Find(menuFeatureId); mf.IsNullThrowException("Not found"); //MenuPath2 mp2 = mf.MenuPath2s.FirstOrDefault(x => x.Id == menuPath2Id); //if (!mp2.IsNull()) //{ // mf.MenuPath2s.Remove(mp2); // mp2.MenuFeatures.Remove(mf); //} MenuFeatureBiz.SaveChanges(); MenuFeatureBiz.Detach(mf);//need to do this otherwise local copy (old) is delivered. //freshen the data after save mf = MenuFeatureBiz.Find(mf.Id); mf.IsNullThrowException("Menu Feauture not found!"); return(mf); }
public MenuFeature AddMenu3ItemTo_Save(string menuFeatureId, string menuPath3Id) { menuFeatureId.IsNullOrWhiteSpaceThrowArgumentException(); menuPath3Id.IsNullOrWhiteSpaceThrowArgumentException(); //make sure that the menuPath is not already a part of the menuFeature MenuFeature mf = MenuFeatureBiz.Find(menuFeatureId); mf.IsNullThrowException("Not found"); //MenuPath3 mp3 = mf.MenuPath3s.FirstOrDefault(x => x.Id == menuPath3Id); //if (mp3.IsNull()) //{ // MenuPath3 _mp3 = MenuPath3Biz.Find(menuPath3Id); // _mp3.IsNullThrowException("Menu Path not found."); // mf.MenuPath3s.Add(mp3); // _mp3.MenuFeatures.Add(mf); // MenuFeatureBiz.Update(mf); //} MenuFeatureBiz.SaveChanges(); MenuFeatureBiz.Detach(mf);//need to do this otherwise local copy (old) is delivered. //freshen the data after save mf = MenuFeatureBiz.Find(mf.Id); mf.IsNullThrowException("Menu Feauture not found!"); return(mf); }
public MenuPathMainBiz(MenuPath1Biz menupath1Biz, UserBiz userBiz, MenuPath2Biz menupath2Biz, MenuPath3Biz menupath3Biz, IRepositry <MenuPathMain> entityDal, MenuFeatureBiz menuFeatureBiz, BizParameters bizParameters) : base(entityDal, bizParameters) { _menupath1Biz = menupath1Biz; _menupath2Biz = menupath2Biz; _menupath3Biz = menupath3Biz; _menuFeatureBiz = menuFeatureBiz; _userBiz = userBiz; }
public void DeleteFeature(MenuFeatureDeleteModel menuFeatureDeleteModel) { menuFeatureDeleteModel.SelfCheckIdsAndReturnOnly(); MenuFeature menuFeature = MenuFeatureBiz.Find(menuFeatureDeleteModel.MenuFeatureId); menuFeature.IsNullThrowException("menuFeature"); MenuPath3 menuPath3 = Find(menuFeatureDeleteModel.MenuPathId); menuPath3.IsNullThrowException("menuPath3"); menuFeature.MenuPath3s.Remove(menuPath3); menuPath3.MenuFeatures.Remove(menuFeature); SaveChanges(); }
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; }
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(); }
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); }
public MenuPath3Biz(IRepositry <MenuPath3> entityDal, BizParameters bizParameters, MenuFeatureBiz menuFeatureBiz, ProductFeatureBiz productFeatureBiz) : base(entityDal, bizParameters) { _menuFeatureBiz = menuFeatureBiz; _productFeatureBiz = productFeatureBiz; }