コード例 #1
0
        public SelectList MenuPath2_SelectList_FilteredFor(MenuPath1ENUM menuPath1Enum)
        {
            var allMenuPathMainsForMp1Lst = FindAllMenuPathMainsFor(menuPath1Enum)
                                            .ToList();

            if (allMenuPathMainsForMp1Lst.IsNull())
            {
                return(new SelectList(null));
            }

            HashSet <string> hashMp2Id = new HashSet <string>();

            foreach (MenuPathMain mpm in allMenuPathMainsForMp1Lst)
            {
                hashMp2Id.Add(mpm.MenuPath2Id);
            }

            if (hashMp2Id.IsNullOrEmpty())
            {
                return(new SelectList(null));
            }

            List <MenuPath2> Mp2Lst = new List <MenuPath2>();

            foreach (var mp2Id in hashMp2Id)
            {
                MenuPath2 mp2 = _menupath2Biz.Find(mp2Id);
                mp2.IsNullThrowException();
                Mp2Lst.Add(mp2);
            }

            SelectList selectList = _menupath2Biz.SelectList_Engine(Mp2Lst.AsQueryable());

            return(selectList);
        }
コード例 #2
0
        private List <string> picturesForMenuPath(MenuPath1 mp1, MenuPath2 mp2)
        {
            //get all menupaths with mp1 and mp2
            mp1.IsNullThrowException();
            mp2.IsNullThrowException();

            List <MenuPathMain> mpmList = MenuPathMainBiz.FindAll().Where(x => x.MenuPath1Id == mp1.Id && x.MenuPath2Id == mp2.Id).ToList();

            if (mpmList.IsNullOrEmpty())
            {
                return(null);
            }

            List <string> picList = new List <string>();

            foreach (MenuPathMain mpm in mpmList)
            {
                List <string> picListFromMpm = picturesForMenuPath(mpm);
                if (!picListFromMpm.IsNullOrEmpty())
                {
                    picList = picList.Concat(picListFromMpm).ToList();
                }
            }

            return(picList);
        }
コード例 #3
0
ファイル: AddFeature.cs プロジェクト: dovanduy/Library
        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);
        }
コード例 #4
0
ファイル: Fix.cs プロジェクト: dovanduy/Library
        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);
            }
        }
コード例 #5
0
        public override void Event_ModifyIndexItem(IndexListVM indexListVM, IndexItemVM indexItem, InterfacesLibrary.SharedNS.ICommonWithId icommonWithId)
        {
            base.Event_ModifyIndexItem(indexListVM, indexItem, icommonWithId);
            MenuPath2 mp2 = icommonWithId as MenuPath2;

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

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


            indexItem.MenuManager.PictureAddresses = GetCurrItemsPictureList(mp2);
        }
コード例 #6
0
ファイル: AddFeature.cs プロジェクト: dovanduy/Library
        public void DeleteFeature(MenuFeatureDeleteModel menuFeatureDeleteModel)
        {
            menuFeatureDeleteModel.SelfCheckIdsAndReturnOnly();

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

            menuFeature.IsNullThrowException("menuFeature");

            MenuPath2 menuPath2 = Find(menuFeatureDeleteModel.MenuPathId);

            menuPath2.IsNullThrowException("menuPath2");



            menuFeature.MenuPath2s.Remove(menuPath2);
            menuPath2.MenuFeatures.Remove(menuFeature);
            SaveChanges();
        }
コード例 #7
0
ファイル: AddFeature.cs プロジェクト: dovanduy/Library
        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.

            MenuPath2 menupath2 = Find(model.ParentId);

            menupath2.IsNullThrowException("menupath2");

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

            AddFeature(menuFeatureModel);
        }
コード例 #8
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);
        }
コード例 #9
0
ファイル: Add.cs プロジェクト: dovanduy/Library
        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));
        }