public void LoadChildren()
 {
     ChildTreeItems.Clear();
     if (MenuId == 0 ||
         (MenuId >= MenuIdControlAssign.MenuFileGroupIdMin &&
          MenuId <= MenuIdControlAssign.MenuFileGroupIdMax))
     {
         var f = ServerInstanceRelation.GetInstanceRelationsByfatherId(this.InstanceId, MenuId);
         foreach (var t in f)
         {
             if (t.Id >= MenuIdControlAssign.MenuIdMin && t.Id <= MenuIdControlAssign.MenuIdMax)
             {
                 // var eng = I36N.Services.I36N.ConvertByCoding(t.Id.ToString());//
                 string name = t.Name;
                 //if (!eng.Equals("Missing")) name = eng;
                 var tt = MenuComponentHolding.GetMenuItemById(t.Id);
                 if (tt == null)
                 {
                     continue;
                 }
                 ChildTreeItems.Add(new MenuTreeItemViewModel(this, this.InstanceId, t.Id)
                 {
                     Name = name
                 });
             }
             else
             {
                 ChildTreeItems.Add(new MenuTreeItemViewModel(this, this.InstanceId, t.Id)
                 {
                     Name = t.Name
                 });
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void SaveEx()
        {
            _dtSaveEx = DateTime.Now;
            if (CurrentSelectInstancesItem == null)
            {
                return;
            }
            if (ChildTreeItems == null)
            {
                return;
            }
            int instancesId = CurrentSelectInstancesItem.Id;
            //var fff = new DataHoldingExtend.MenuInstanceRelationHoldingExtend();
            //fff.DeleteMenuInstanceRelation(instancesId);

            //Base_MenuControl.Services.ServerInstanceRelation.

            var lst   = new List <MenuInstancesRelation>();
            int index = 0;

            foreach (var t in ChildTreeItems)
            {
                if (t.MenuId != 0)
                {
                    lst.Add(new MenuInstancesRelation()
                    {
                        FatherId    = 0,
                        Id          = t.MenuId,
                        InstancesId = t.InstanceId,
                        Name        = t.Name,
                        SortIndex   = index
                    });

                    //fff.AddMenuInstanceRelation(0, t.MenuId, index, t.Name, t.InstanceId);
                    index++;
                }
                if (t.MenuId == 0 ||
                    (t.MenuId >= MenuIdControlAssign.MenuFileGroupIdMin &&
                     t.MenuId <= MenuIdControlAssign.MenuFileGroupIdMax))
                {
                    var ff = this.Ex(t);
                    foreach (var gg in ff)
                    {
                        lst.Add(gg);
                    }
                }
            }
            ServerInstanceRelation.UpdateMenuInstanceRelation(instancesId,
                                                              CurrentSelectInstancesItem.Key,
                                                              lst);
        }
Ejemplo n.º 3
0
        private void SaveEx()
        {
            _dtSaveEx = DateTime.Now;

            var lst     = new List <MenuInstancesRelation>();
            var index   = new Dictionary <int, int>();
            var lstmain = new List <int>();

            index.Add(0, 0);

            foreach (var t in TreeItems)
            {
                if (t.IsChecked)
                {
                    if (!lstmain.Contains(t.FatherId) && DicType.ContainsKey(t.FatherId))
                    {
                        lstmain.Add(t.FatherId);
                        lst.Add(new MenuInstancesRelation()
                        {
                            FatherId    = 0,
                            Id          = t.FatherId,
                            InstancesId = 2920002,
                            Name        = DicType[t.FatherId],
                            SortIndex   = index[0]
                        });
                        index[0]++;
                    }

                    if (index.ContainsKey(t.FatherId))
                    {
                        index[t.FatherId]++;
                    }
                    else
                    {
                        index.Add(t.FatherId, 0);
                    }

                    lst.Add(new MenuInstancesRelation()
                    {
                        FatherId    = t.FatherId,
                        Id          = t.Id,
                        InstancesId = 2920002,
                        Name        = t.Name,
                        SortIndex   = index[t.FatherId]
                    });
                }
            }

            ServerInstanceRelation.UpdateMenuInstanceRelation(2920002, "MainMenu", lst);
        }
 private void ExAddFolderFolder()
 {
     if (MenuId == 0 ||
         (MenuId >= MenuIdControlAssign.MenuFileGroupIdMin &&
          MenuId <= MenuIdControlAssign.MenuFileGroupIdMax))
     {
         int intAvlId = ServerInstanceRelation.GetMaxAviableMenuFileId();
         ServerInstanceRelation.AddMenuInstanceRelation(MenuId, intAvlId, 0, "New File", this.InstanceId);
         ChildTreeItems.Add(new MenuTreeItemViewModel(this, this.InstanceId, intAvlId)
         {
             Name = "New File"
         });
         this.SetSelectNode(MenuId, intAvlId);
     }
 }
        public void LoadChildren()
        {
            ChildTreeItems.Clear();

            if (_menuId <= MenuIdControlAssign.MenuIdMax && _menuId >= MenuIdControlAssign.MenuIdMin)
            {
                return;
            }
            else if (MenuId == 0 || (_menuId <= MenuIdControlAssign.MenuFileGroupIdMax &&
                                     _menuId >= MenuIdControlAssign.MenuFileGroupIdMin)) //file
            {
                var f = ServerInstanceRelation.GetInstanceRelationsByfatherId(this.InstanceId, MenuId);
                foreach (var t in f)
                {
                    if (t.Id <= MenuIdControlAssign.MenuIdMax && t.Id >= MenuIdControlAssign.MenuIdMin)
                    //menu id
                    {
                        var fff = MenuComponentHolding.GetMenuItemById(t.Id);
                        if (fff != null)
                        {
                            ChildTreeItems.Add(new ShortCutTreeItemViewModel(this, this.InstanceId, t.Id)
                            {
                                Name = t.Name
                            });
                        }
                    }
                    else
                    {
                        ChildTreeItems.Add(new ShortCutTreeItemViewModel(this, this.InstanceId, t.Id)
                        {
                            Name = t.Name
                        });
                    }
                }
            }
        }