Beispiel #1
0
        public static MvcHtmlString EntityStrip <T, S>(this HtmlHelper helper, TypeContext <T> tc, Expression <Func <T, MList <S> > > property, Action <EntityStrip> settingsModifier)
        {
            TypeContext <MList <S> > context = Common.WalkExpression(tc, property);

            var vo = tc.ViewOverrides;

            if (vo != null && !vo.IsVisible(context.PropertyRoute))
            {
                return(vo.OnSurroundLine(context.PropertyRoute, helper, tc, null));
            }

            EntityStrip es = new EntityStrip(context.Type, context.UntypedValue, context, null, context.PropertyRoute);

            EntityBaseHelper.ConfigureEntityBase(es, typeof(S).CleanType());

            Common.FireCommonTasks(es);

            if (settingsModifier != null)
            {
                settingsModifier(es);
            }

            var result = helper.InternalEntityStrip <S>(es);

            if (vo == null)
            {
                return(result);
            }

            return(vo.OnSurroundLine(es.PropertyRoute, helper, tc, result));
        }
Beispiel #2
0
        public static MvcHtmlString GridRepeater<T, S>(this HtmlHelper helper, TypeContext<T> tc, Expression<Func<T, MList<S>>> property, Action<GridRepeater> settingsModifier)
            where S : ModifiableEntity, IGridEntity
        {
            TypeContext<MList<S>> context = Common.WalkExpression(tc, property);

            var vo = tc.ViewOverrides;

            if (vo != null && !vo.IsVisible(context.PropertyRoute))
                return vo.OnSurroundLine(context.PropertyRoute, helper, tc, null);

            GridRepeater repeater = new GridRepeater(context.Type, context.UntypedValue, context, null, context.PropertyRoute);

            EntityBaseHelper.ConfigureEntityBase(repeater, typeof(S).CleanType());

            Common.FireCommonTasks(repeater);

            if (settingsModifier != null)
                settingsModifier(repeater);

            var result = helper.InternalGridRepeater<S>(repeater);

            if (vo == null)
                return result;

            return vo.OnSurroundLine(repeater.PropertyRoute, helper, tc, result);
        }
Beispiel #3
0
        public static MvcHtmlString EntityCombo <T, S>(this HtmlHelper helper, TypeContext <T> tc, Expression <Func <T, S> > property, Action <EntityCombo> settingsModifier)
        {
            TypeContext <S> context = Common.WalkExpression(tc, property);

            var vo = tc.ViewOverrides;

            if (vo != null && !vo.IsVisible(context.PropertyRoute))
            {
                return(vo.OnSurroundLine(context.PropertyRoute, helper, tc, null));
            }


            EntityCombo ec = new EntityCombo(typeof(S), context.Value, context, null, context.PropertyRoute);

            EntityBaseHelper.ConfigureEntityBase(ec, ec.CleanRuntimeType ?? ec.Type.CleanType());

            Common.FireCommonTasks(ec);

            if (settingsModifier != null)
            {
                settingsModifier(ec);
            }

            var result = helper.InternalEntityCombo(ec);

            if (vo == null)
            {
                return(result);
            }

            return(vo.OnSurroundLine(ec.PropertyRoute, helper, tc, result));
        }
Beispiel #4
0
        public static MvcHtmlString EntityLine <T, S>(this HtmlHelper helper, TypeContext <T> tc, Expression <Func <T, S> > property, Action <EntityLine> settingsModifier)
        {
            TypeContext <S> context = Common.WalkExpression(tc, property);

            var vo = tc.ViewOverrides;

            if (vo != null && !vo.IsVisible(context.PropertyRoute))
            {
                return(vo.OnSurroundLine(context.PropertyRoute, helper, tc, null));
            }

            EntityLine el = new EntityLine(typeof(S), context.Value, context, null, context.PropertyRoute);

            EntityBaseHelper.ConfigureEntityBase(el, el.CleanRuntimeType ?? el.Type.CleanType());

            if (el.Implementations == null || el.Implementations.Value.IsByAll)
            {
                el.Autocomplete = false;
            }

            Common.FireCommonTasks(el);

            if (settingsModifier != null)
            {
                settingsModifier(el);
            }

            var result = helper.InternalEntityLine(el);

            if (vo == null)
            {
                return(result);
            }

            return(vo.OnSurroundLine(el.PropertyRoute, helper, tc, result));
        }