Esempio n. 1
0
        public async Task CreateMenuAsync(MenuCreateInput input)
        {
            var    useAddCondidionalApi = input.MenuMatchRule != null && !input.MenuMatchRule.CheckAllNull();
            string accessToken          = await GetAccessToken();

            //重新整理按钮信息
            WxJsonResult     result      = null;
            IButtonGroupBase buttonGroup = null;

            if (useAddCondidionalApi)
            {
                //个性化接口
                buttonGroup = CommonApi.GetMenuFromJsonResult(input.ResultFull, new ConditionalButtonGroup()).menu;

                var addConditionalButtonGroup = buttonGroup as ConditionalButtonGroup;
                addConditionalButtonGroup.matchrule = input.MenuMatchRule;
                result = CommonApi.CreateMenuConditional(accessToken, addConditionalButtonGroup);
            }
            else
            {
                //普通接口
                buttonGroup = CommonApi.GetMenuFromJsonResult(input.ResultFull, new ButtonGroup()).menu;
                result      = CommonApi.CreateMenu(accessToken, buttonGroup);
            }
        }
Esempio n. 2
0
        public ActionResult Create(MenuCreateInput input)
        {
            if (!this.ModelState.IsValid)
            {
                return this.ModelState.ToJsonResult();
            }
            if (input.ParentId == Guid.Empty)
            {
                input.ParentId = null;
            }
            AcDomain.Handle(input.ToCommand(AcSession));

            return this.JsonResult(new ResponseData { success = true, id = input.Id });
        }
Esempio n. 3
0
        public ActionResult Create(MenuCreateInput input)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.ModelState.ToJsonResult());
            }
            if (input.ParentId == Guid.Empty)
            {
                input.ParentId = null;
            }
            AcDomain.Handle(input.ToCommand(AcSession));

            return(this.JsonResult(new ResponseData {
                success = true, id = input.Id
            }));
        }
Esempio n. 4
0
            public void Handle(OntologyAddedEvent message)
            {
                var entityMenuId = new Guid("9BE27152-808E-427D-B8C6-D7ABC600A963");
                var entityMenu   = new MenuCreateInput
                {
                    Id          = entityMenuId,
                    ParentId    = null,
                    Name        = "实体管理",
                    Url         = string.Empty,
                    Icon        = string.Empty,
                    AppSystemId = _acDomain.AppSystemSet.SelfAppSystem.Id,
                    Description = string.Empty,
                    SortCode    = 0
                };
                MenuState parentMenu;

                if (!_acDomain.MenuSet.TryGetMenu(entityMenuId, out parentMenu))
                {
                    _acDomain.Handle(new AddMenuCommand(message.AcSession, entityMenu));
                }
                OntologyDescriptor ontology;

                if (_acDomain.NodeHost.Ontologies.TryGetOntology(message.Source.Id, out ontology))
                {
                    _acDomain.Handle(new AddMenuCommand(message.AcSession, new MenuCreateInput
                    {
                        Id          = ontology.Ontology.Id,// 约定
                        ParentId    = entityMenu.Id,
                        Name        = ontology.Ontology.Name + "管理",
                        Url         = string.Format("Edi/Entity/Index?ontologyCode={0}&ontologyID={1}", ontology.Ontology.Code, ontology.Ontology.Id),
                        Icon        = ontology.Ontology.Icon,
                        AppSystemId = _acDomain.AppSystemSet.SelfAppSystem.Id,
                        Description = string.Empty,
                        SortCode    = ontology.Ontology.SortCode
                    }));
                }
            }