Example #1
0
        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();
        }
Example #2
0
        private void fixall(GlobalComment gc)
        {
            if (gc.Comment.IsNullOrWhiteSpace())
            {
                return;
            }

            gc.UserId.IsNullOrWhiteSpaceThrowException("User is not logged in");

            if (!gc.UserId.IsNullOrWhiteSpace())
            {
                ApplicationUser user = _userBiz.Find(gc.UserId);
                user.IsNullThrowException();
                //user.GlobalComments.Add(gc);
                gc.Name = UserName;
            }



            if (!gc.MenuPath1Id.IsNullOrWhiteSpace())
            {
                MenuPath1 m1 = _menuPathMainBiz.MenuPath1Biz.Find(gc.MenuPath1Id);
                m1.IsNullThrowException();
                m1.GlobalComments.Add(gc);
                return;
            }


            if (!gc.MenuPath2Id.IsNullOrWhiteSpace())
            {
                MenuPath2 m2 = _menuPathMainBiz.MenuPath2Biz.Find(gc.MenuPath2Id);
                m2.IsNullThrowException();
                m2.GlobalComments.Add(gc);
                return;
            }


            if (!gc.MenuPath3Id.IsNullOrWhiteSpace())
            {
                MenuPath3 m3 = _menuPathMainBiz.MenuPath3Biz.Find(gc.MenuPath3Id);
                m3.IsNullThrowException();
                m3.GlobalComments.Add(gc);
            }


            if (!gc.ProductId.IsNullOrWhiteSpace())
            {
                Product p = _productBiz.Find(gc.ProductId);
                p.IsNullThrowException();
                p.GlobalComments.Add(gc);
            }


            if (!gc.ProductChildId.IsNullOrWhiteSpace())
            {
                ProductChild pc = _productBiz.ProductChildBiz.Find(gc.ProductChildId);
                pc.IsNullThrowException();
                pc.GlobalComments.Add(gc);
            }
        }
        public override void Event_ModifyIndexItem(IndexListVM indexListVM, IndexItemVM indexItem, InterfacesLibrary.SharedNS.ICommonWithId icommonWithId)
        {
            base.Event_ModifyIndexItem(indexListVM, indexItem, icommonWithId);
            MenuPath3 mp3 = icommonWithId as MenuPath3;

            mp3.IsNullThrowException("Unable to unbox");
            //send in a MenuPathMain that is a part of this MenuPath3
            MenuPathMain mpm = mp3.MenuPathMains.FirstOrDefault();

            indexItem.MenuManager = new MenuManager(mpm, null, null, MenuENUM.EditMenuPath3, BreadCrumbManager, null, UserId, indexListVM.MenuManager.ReturnUrl, UserName);


            indexItem.MenuManager.PictureAddresses = GetCurrItemsPictureList(mp3);
        }
Example #4
0
        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();
        }
Example #5
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);
        }
Example #6
0
        public bool AddAndSaveComment(GlobalComment gc)
        {
            if (gc.Comment.IsNullOrWhiteSpace())
            {
                return(false);
            }

            gc.UserId.IsNullOrWhiteSpaceThrowException("No user is logged in!");


            if (!gc.MenuPath1Id.IsNullOrWhiteSpace())
            {
                MenuPath1 m1 = _menuPathMainBiz.MenuPath1Biz.Find(gc.MenuPath1Id);
                m1.IsNullThrowException();
                m1.GlobalComments.Add(gc);
            }


            if (!gc.MenuPath2Id.IsNullOrWhiteSpace())
            {
                MenuPath2 m2 = _menuPathMainBiz.MenuPath2Biz.Find(gc.MenuPath2Id);
                m2.IsNullThrowException();
                m2.GlobalComments.Add(gc);
            }


            if (!gc.MenuPath3Id.IsNullOrWhiteSpace())
            {
                MenuPath3 m3 = _menuPathMainBiz.MenuPath3Biz.Find(gc.MenuPath3Id);
                m3.IsNullThrowException();
                m3.GlobalComments.Add(gc);
            }


            if (!gc.ProductId.IsNullOrWhiteSpace())
            {
                Product p = _productBiz.Find(gc.ProductId);
                p.IsNullThrowException();
                p.GlobalComments.Add(gc);
            }


            if (!gc.ProductChildId.IsNullOrWhiteSpace())
            {
                ProductChild pc = _productBiz.ProductChildBiz.Find(gc.ProductChildId);
                pc.IsNullThrowException();
                pc.GlobalComments.Add(gc);
            }

            if (!gc.UserId.IsNullOrWhiteSpace())
            {
                ApplicationUser user = _userBiz.Find(gc.UserId);
                user.IsNullThrowException();
                //user.GlobalComments.Add(gc);
            }

            gc.Name = UserName;

            ControllerCreateEditParameter parm = new ControllerCreateEditParameter();

            parm.Entity = gc as ICommonWithId;

            CreateAndSave(parm);
            return(true);
        }
Example #7
0
        public LikeUnlikeParameters AddLikeAndReturnCount(string menuPath1Id, string menuPath2Id, string menuPath3Id, string productId, string productChildId, string userId, bool isLike, string comment)
        {
            userId.IsNullOrWhiteSpaceThrowException("No user is logged in!");
            Person person = UserBiz.GetPersonFor(userId);

            person.IsNullThrowException("Person");
            string personId = person.Id;

            personId.IsNullOrWhiteSpaceThrowException("personId");

            LikeUnlike likeUnlike = Factory() as LikeUnlike;

            likeUnlike.Initialize(menuPath1Id, menuPath2Id, menuPath3Id, productId, productChildId, personId, isLike, comment);

            if (!menuPath1Id.IsNullOrWhiteSpace())
            {
                likeUnlike.MenuPath1Id = menuPath1Id;
                MenuPath1 m1 = _menuPathMainBiz.MenuPath1Biz.Find(menuPath1Id);
                m1.IsNullThrowException();
                m1.LikeUnlikes.Add(likeUnlike);
            }


            if (!menuPath2Id.IsNullOrWhiteSpace())
            {
                likeUnlike.MenuPath2Id = menuPath2Id;
                MenuPath2 m2 = _menuPathMainBiz.MenuPath2Biz.Find(menuPath2Id);
                m2.IsNullThrowException();
                m2.LikeUnlikes.Add(likeUnlike);
            }


            if (!menuPath3Id.IsNullOrWhiteSpace())
            {
                likeUnlike.MenuPath3Id = menuPath3Id;
                MenuPath3 m3 = _menuPathMainBiz.MenuPath3Biz.Find(menuPath3Id);
                m3.IsNullThrowException();
                m3.LikeUnlikes.Add(likeUnlike);
            }


            if (!productId.IsNullOrWhiteSpace())
            {
                likeUnlike.ProductId = productId;
            }
            else
            {
                productId = null;
            }

            if (!productChildId.IsNullOrWhiteSpace())
            {
                likeUnlike.ProductChildId = productChildId;
            }
            else
            {
                productChildId = null;
            }

            if (!personId.IsNullOrWhiteSpace())
            {
                likeUnlike.PersonId = personId;
                person.IsNullThrowException();
                person.LikeUnlikes.Add(likeUnlike);
            }
            //if it is a like delete the similar dislike. If it is a dislike delete the similar like
            bool relatedOppoisteDeleted = deleteTheRelatedLikeUnlike(menuPath1Id, menuPath2Id, menuPath3Id, productId, productChildId, personId, isLike);

            CreateAndSave(CreateControllerCreateEditParameter(likeUnlike as ICommonWithId));

            return(Count(
                       menuPath1Id,
                       menuPath2Id,
                       menuPath3Id,
                       productId,
                       productChildId,
                       userId,
                       relatedOppoisteDeleted));
        }