Exemplo n.º 1
0
        public void Copy(string newName)
        {
            CmsMenuItem newItem = base.CreateCopy <CmsMenuItem>(false);

            newItem.Name = newName;
            newItem.Save();
        }
Exemplo n.º 2
0
        internal void Copy(string newName, Guid menuId)
        {
            CmsMenuItem newItem = base.CreateCopy <CmsMenuItem>(false);

            newItem.Menu.ID = menuId;
            newItem.Name    = newName;
            newItem.Save();
        }
Exemplo n.º 3
0
        public string GetCompletePath()
        {
            string      path   = this.Name;
            CmsMenuItem parent = this.ParentMenuItem;

            while (parent != null)
            {
                //path = this.ParentGroup.Name + "/" + path;
                path   = parent.Name + "/" + path;
                parent = parent.ParentMenuItem;
            }
            return(path);
        }
Exemplo n.º 4
0
        public void MoveItems(string itemId, int newOrderingNumber)
        {
            CmsMenuItem item = BaseObject.GetById <CmsMenuItem>(new Guid(itemId));
            int         oldOrderingNumber = item.OrderingNumber;

            if (oldOrderingNumber < newOrderingNumber)
            {
                //nummer wordt hoger: alles tussen oude nummer en nieuwe nummer 1 plek lager zetten
                string sql = String.Format("UPDATE MenuItem SET OrderingNumber = OrderingNumber - 1 WHERE OrderingNumber > {0} And OrderingNumber <= {1} AND FK_Menu = '{2}' AND FK_Parent_MenuItem IS NULL", oldOrderingNumber, newOrderingNumber, this.ID);
                DataBase.Get().Execute(sql);
            }
            else if (oldOrderingNumber > newOrderingNumber)
            {
                //nummer wordt lager: alles tussen nieuwe nummer en oude nummer 1 plek verder zetten
                string sql = String.Format("UPDATE MenuItem SET OrderingNumber = OrderingNumber + 1 WHERE OrderingNumber < {0} And OrderingNumber >= {1} AND FK_Menu = '{2}' AND FK_Parent_MenuItem IS NULL", oldOrderingNumber, newOrderingNumber, this.ID);
                DataBase.Get().Execute(sql);
            }
            item.OrderingNumber = newOrderingNumber;
            item.Save();
        }