Пример #1
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);
        }
Пример #2
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);
        }