当前位置: 首页>>代码示例>>C#>>正文


C# ObjectAndControlData.GetAction方法代码示例

本文整理汇总了C#中NakedObjects.Web.Mvc.Models.ObjectAndControlData.GetAction方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectAndControlData.GetAction方法的具体用法?C# ObjectAndControlData.GetAction怎么用?C# ObjectAndControlData.GetAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NakedObjects.Web.Mvc.Models.ObjectAndControlData的用法示例。


在下文中一共展示了ObjectAndControlData.GetAction方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyAction

        private ActionResult ApplyAction(ObjectAndControlData controlData) {
            var targetNakedObject = FilterCollection(controlData.GetNakedObject(Facade), controlData);
            var targetAction = controlData.GetAction(Facade);

            CheckConcurrency(targetNakedObject, null, controlData, (z, x, y) => IdHelper.GetConcurrencyActionInputId(x, targetAction, y));

            if (targetNakedObject.IsNotPersistent) {
                RefreshTransient(targetNakedObject, controlData.Form);
            }

            // do after any parameters set by contributed action so this takes priority
            SetSelectedParameters(targetAction);

            var ac = GetParameterValues(targetAction, controlData);
            ActionResultContextFacade ar;

            if (targetNakedObject.Specification.IsCollection && !targetNakedObject.Specification.IsParseable) {
                var oids = targetNakedObject.ToEnumerable().Select(no => Facade.OidTranslator.GetOidTranslation(no)).ToArray();
                var spec = targetNakedObject.ElementSpecification;

                ar = Facade.ExecuteListAction(oids, spec, targetAction.Id, ac);
            }
            else {
                var oid = Facade.OidTranslator.GetOidTranslation(targetNakedObject);
                ar = Facade.ExecuteObjectAction(oid, targetAction.Id, ac);
            }

            if (!HasError(ar)) {
                targetNakedObject.SetIsNotQueryableState(targetAction.IsContributed);
                return AppropriateView(controlData, GetResult(ar), targetAction);
            }

            foreach (var parm in ar.ActionContext.VisibleParameters) {
                if (!string.IsNullOrEmpty(parm.Reason)) {
                    ModelState.AddModelError(IdHelper.GetParameterInputId(targetAction, parm.Parameter), parm.Reason);
                }
            }

            if (!(string.IsNullOrEmpty(ar.ActionContext.Reason))) {
                ModelState.AddModelError("", ar.ActionContext.Reason);
            }

            var property = DisplaySingleProperty(controlData, controlData.DataDict);
            return View(property == null ? "ActionDialog" : "PropertyEdit", new FindViewModel {ContextObject = targetNakedObject.GetDomainObject(), ContextAction = targetAction, PropertyName = property});
        }
开发者ID:priaonehaha,项目名称:NakedObjectsFramework,代码行数:45,代码来源:GenericControllerImpl.cs

示例2: SelectOnAction

        private ActionResult SelectOnAction(ObjectAndControlData controlData) {
            var nakedObjectAction = controlData.GetAction(Facade);
            var contextNakedObject = FilterCollection(controlData.GetNakedObject(Facade), controlData);

            return SelectSingleItem(contextNakedObject, nakedObjectAction, controlData, controlData.DataDict);
        }
开发者ID:priaonehaha,项目名称:NakedObjectsFramework,代码行数:6,代码来源:GenericControllerImpl.cs

示例3: Action

        public virtual ActionResult Action(ObjectAndControlData controlData) {
            var no = controlData.GetNakedObject(Facade);
            var action = controlData.GetAction(Facade);

            return View("ActionDialog", new FindViewModel {
                ContextObject = no.GetDomainObject(),
                ContextAction = action
            });
        }
开发者ID:priaonehaha,项目名称:NakedObjectsFramework,代码行数:9,代码来源:GenericControllerImpl.cs

示例4: InitialAction

 private ActionResult InitialAction(ObjectAndControlData controlData) {
     var nakedObject = controlData.GetNakedObject(Facade);
     var nakedObjectAction = controlData.GetAction(Facade);
     CheckConcurrency(nakedObject, null, controlData, (z, x, y) => IdHelper.GetConcurrencyActionInputId(x, nakedObjectAction, y));
     return ExecuteAction(controlData, nakedObject, nakedObjectAction);
 }
开发者ID:priaonehaha,项目名称:NakedObjectsFramework,代码行数:6,代码来源:GenericControllerImpl.cs

示例5: GetPageSize

        internal int GetPageSize(ObjectAndControlData controlData) {
            if (controlData.DataDict.ContainsKey(IdConstants.PageSizeKey)) {
                return int.Parse(controlData.DataDict[IdConstants.PageSizeKey]);
            }
            if (!string.IsNullOrEmpty(controlData.PageSize)) {
                return int.Parse(controlData.PageSize);
            }

            var action = controlData.GetAction(Facade);
            return action != null ? action.PageSize : 0;
        }
开发者ID:priaonehaha,项目名称:NakedObjectsFramework,代码行数:11,代码来源:NakedObjectsController.cs

示例6: DisplaySingleProperty

        protected string DisplaySingleProperty(ObjectAndControlData controlData, IDictionary<string, string> data) {
            if (Request.IsAjaxRequest()) {
                var nakedObject = controlData.GetNakedObject(Facade);
                if (controlData.SubAction == ObjectAndControlData.SubActionType.Redisplay) {
                    var assocs = nakedObject.Specification.Properties.Where(p => p.IsCollection && !p.Specification.IsParseable);
                    var item = assocs.SingleOrDefault(a => data.ContainsKey(a.Id));
                    return item == null ? null : item.Id;
                }
                if (controlData.ActionId == null) {
                    var assocs = nakedObject.Specification.Properties.Where(p => !p.IsCollection || p.Specification.IsParseable);
                    var item = assocs.SingleOrDefault(a => data.ContainsKey(a.Id));
                    return item == null ? null : item.Id;
                }
                {
                    var parms = controlData.GetAction(Facade).Parameters;
                    var item = parms.SingleOrDefault(p => data.ContainsKey(p.Id));
                    return item == null ? null : item.Id;
                }
            }

            return null;
        }
开发者ID:priaonehaha,项目名称:NakedObjectsFramework,代码行数:22,代码来源:NakedObjectsController.cs

示例7: AddAttemptedValues

        internal void AddAttemptedValues(ObjectAndControlData controlData) {
            var action = controlData.GetAction(Facade);
            var form = controlData.Form;
            foreach (var parm in action.Parameters) {
                string name = IdHelper.GetParameterInputId(action, parm);
                ValueProviderResult vp = form.GetValue(name);
                string[] values = vp == null ? new string[] {} : (string[]) vp.RawValue;

                if (parm.Specification.IsCollection && !parm.Specification.IsParseable) {
                    // handle collection mementos 

                    if (parm.IsChoicesEnabled == Choices.Multiple || !CheckForAndAddCollectionMementoNew(name, values, controlData)) {
                        var itemSpec = parm.ElementType;
                        var itemvalues = values.Select(v => itemSpec.IsParseable ? (object) v : GetNakedObjectFromId(v).GetDomainObject<object>()).ToList();

                        if (itemvalues.Any()) {
                            var no = Facade.GetObject(itemvalues);

                            AddAttemptedValue(name, no);
                        }
                    }
                }
                else {
                    string value = values.Any() ? values.First() : "";

                    if (!string.IsNullOrEmpty(value)) {
                        AddAttemptedValue(name, parm.Specification.IsParseable ? (object) value : FilterCollection(GetNakedObjectFromId(value), controlData));
                    }
                }
            }
        }
开发者ID:priaonehaha,项目名称:NakedObjectsFramework,代码行数:31,代码来源:NakedObjectsController.cs


注:本文中的NakedObjects.Web.Mvc.Models.ObjectAndControlData.GetAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。