Exemplo n.º 1
0
        /// <summary>
        /// Agrega un  MenuItem de negocio.
        /// </summary>
        /// <date>2008-07-13T00:00:00</date>
        /// <author>moviedo</author>
        private void AddMenuItem()
        {
            if (Menu == null || Menu.ItemList == null)
            {
                return;
            }
            if (_MenuItemSelected == null)
            {
                if (Menu.ItemList.Count == 0)
                {
                    fwkMessageView_Warning.Show("Please.. You must first create a root menu");
                    return;
                }
                fwkMessageView_Warning.Show("Please.. select any menu to execute this option.-");
                return;
            }
            // Esto hace que solo se desarrolle hasta arbol de nivel dos.
            int parentId = 0;

            if (_MenuItemSelected.ParentID == 0)
            {
                parentId = _MenuItemSelected.ID;
            }
            else
            {
                parentId = _MenuItemSelected.ParentID;
            }

            Fwk.UI.Controls.Menu.Tree.MenuItem wMenuItemNew = new Fwk.UI.Controls.Menu.Tree.MenuItem();
            wMenuItemNew.ParentID = parentId;
            using (FRM_EditMenu wFrm = new FRM_EditMenu(Menu, wMenuItemNew, Action.New, this.AssemblybaseType))
            {
                wFrm.ImageList = this.imageList2;
                if (wFrm.ShowDialog() == DialogResult.OK)
                {
                    if (_MenuItemSelected != null)
                    {
                        wMenuItemNew.ID = Menu.GetNewID();
                    }

                    Menu.ItemList.Add(wMenuItemNew);
                    treeList1.RefreshDataSource();
                    treeList1.ExpandAll();
                }
            }

            _Saved = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Edita un  MenuItem de negocio.
        /// </summary>
        /// <date>2008-07-13T00:00:00</date>
        /// <author>moviedo</author>
        private void EditMenuItem()
        {
            if (Menu == null || Menu.ItemList == null)
            {
                return;
            }

            if (_MenuItemSelected == null)
            {
                if (Menu.ItemList.Count == 0)
                {
                    fwkMessageView_Warning.Show("Please.. You must first create a root menu");
                    return;
                }
                fwkMessageView_Warning.Show("Please.. select any menu to execute this option.-");
                return;
            }
            //Load del Pelsoftulario de edicion de menues
            using (FRM_EditMenu frm = new FRM_EditMenu(Menu, _MenuItemSelected, Action.Edit, this.AssemblybaseType))
            {
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    treeList1.RefreshDataSource();
                    treeList1.ExpandAll();
                    //Si la categoria cambio. hay que cambiar la categoria de los hijos inmediatos que no son categorias .-
                    //if (frm.CategoryChange)
                    //{
                    //    foreach (Fwk.UI.Controls.Menu.Tree.MenuItem menuChild in menu.ItemList)
                    //    {
                    //        if (menuChild.ParentID == _MenuItemSelected.ID && !menuChild.IsCategory)
                    //            menuChild.Category = _MenuItemSelected.Category;
                    //    }
                    //}
                }
            }

            _Saved = false;
        }