Ejemplo n.º 1
0
        public void Move()
        {
            base.ThrowIfCannotActAsOwner();
            StoreObjectId nodeId  = (StoreObjectId)base.GetParameter("srcNId");
            StoreObjectId nodeId2 = (StoreObjectId)base.GetParameter("tgtid");
            int           num     = base.IsParameterSet("mt") ? ((int)base.GetParameter("mt")) : 0;
            NavigationNodeGroupSection navigationNodeGroupSection = (NavigationNodeGroupSection)base.GetParameter("GS");
            NavigationNodeCollection   navigationNodeCollection   = NavigationNodeCollection.TryCreateNavigationNodeCollection(base.UserContext, base.UserContext.MailboxSession, navigationNodeGroupSection);
            NavigationNode             navigationNode             = navigationNodeCollection.RemoveFolderOrGroupByNodeId(nodeId);

            if (navigationNode == null)
            {
                base.RenderPartialFailure(-289549140, OwaEventHandlerErrorCode.NotSet);
            }
            else
            {
                int num2;
                int num3;
                if (navigationNodeCollection.TryFindGroupAndNodeIndexByNodeId(nodeId2, out num2, out num3))
                {
                    if (navigationNode is NavigationNodeGroup)
                    {
                        if (num3 >= 0)
                        {
                            throw new OwaInvalidRequestException("The target node must be a navigation node group");
                        }
                        if (num != 1 && num != 2)
                        {
                            throw new OwaInvalidRequestException("Can only move a group before or after another group");
                        }
                        navigationNodeCollection.Insert((num == 2) ? (num2 + 1) : num2, navigationNode as NavigationNodeGroup);
                    }
                    else if (navigationNode is NavigationNodeFolder)
                    {
                        if (num3 >= 0)
                        {
                            if (num != 1 && num != 2)
                            {
                                throw new OwaInvalidRequestException("Can only move a folder before or after another folder");
                            }
                            navigationNodeCollection[num2].Children.Insert((num == 2) ? (num3 + 1) : num3, navigationNode as NavigationNodeFolder);
                        }
                        else
                        {
                            navigationNodeCollection[num2].Children.Add(navigationNode as NavigationNodeFolder);
                        }
                    }
                }
                else
                {
                    base.RenderPartialFailure((navigationNodeGroupSection == NavigationNodeGroupSection.First) ? 817935633 : 444965652, OwaEventHandlerErrorCode.NotSet);
                }
                navigationNodeCollection.Save(base.UserContext.MailboxSession);
            }
            NavigationHost.RenderFavoritesAndNavigationTrees(this.Writer, base.UserContext, null, new NavigationNodeGroupSection[]
            {
                navigationNodeGroupSection
            });
        }