/// <summary> /// 更新菜单实例 无则增加,回写数据库 /// </summary> /// <param name="keyId">唯一标示</param> /// <param name="name"></param> /// <param name="keyMenu"></param> /// <param name="idClassic"></param> public void UpdateMenuInstances(int keyId, string name, string keyMenu, int idClassic) { if (keyId >= MenuIdControlAssign.MenuInstanceKeyIdMin && keyId <= MenuIdControlAssign.MenuInstancesKeyIdMax) { } else { return; } if (!DicInstances.ContainsKey(keyId)) { DicInstances.Add(keyId, new MenuInstance() { Id = keyId, IdClassic = idClassic, Key = keyMenu, Name = name }); } else { DicInstances[keyId].Id = keyId; DicInstances[keyId].IdClassic = idClassic; DicInstances[keyId].Key = keyMenu; DicInstances[keyId].Name = name; } WriteUpdateDbByPrivate(keyId); var args = new PublishEventArgs() { EventId = EventIdAssign. MenuInstanceUpdate, EventType = PublishEventType.Core }; args.AddParams(keyId); EventPublish.PublishEvent(args); }
/// <summary> /// 增加菜单实例 /// </summary> /// <param name="keyId">唯一地址</param> /// <param name="name">名称</param> /// <param name="keyMenu"></param> /// <param name="idClassic"></param> private void AddMenuInstances(int keyId, string name, string keyMenu, int idClassic) { if (!DicInstances.ContainsKey(keyId)) { DicInstances.Add(keyId, new MenuInstance() { Id = keyId, IdClassic = idClassic, Key = keyMenu, Name = name }); } else { DicInstances[keyId].Id = keyId; DicInstances[keyId].IdClassic = idClassic; DicInstances[keyId].Key = keyMenu; DicInstances[keyId].Name = name; } }