Inheritance: TypeContext
Exemplo n.º 1
0
        public static void TaskSetImplementations(LineBase bl)
        {
            EntityBase eb = bl as EntityBase;

            if (eb != null)
            {
                PropertyRoute route = bl.PropertyRoute;

                if (bl.Type.IsMList())
                {
                    route = route.Add("Item");
                }

                if (route.Type.CleanType().IsIEntity())
                {
                    IImplementationsFinder finder = typeof(ModelEntity).IsAssignableFrom(route.RootType) ?
                                                    (IImplementationsFinder)Navigator.EntitySettings(route.RootType) : Schema.Current;

                    eb.Implementations = finder.FindImplementations(route);

                    if (eb.Implementations.Value.IsByAll)
                    {
                        EntityLine el = eb as EntityLine;
                        if (el != null)
                        {
                            el.Autocomplete = false;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public static void TaskSetLabelText(LineBase bl)
 {
     if (bl != null && bl.PropertyRoute.PropertyRouteType == PropertyRouteType.FieldOrProperty)
     {
         bl.LabelText = bl.PropertyRoute.PropertyInfo.NiceName();
     }
 }
Exemplo n.º 3
0
 public static void TaskSetReadOnly(LineBase bl)
 {
     if (bl != null && bl.PropertyRoute.PropertyRouteType == PropertyRouteType.FieldOrProperty)
     {
         if (bl.PropertyRoute.PropertyInfo.IsReadOnly() || bl.ReadOnly)
         {
             bl.ReadOnly = true;
         }
     }
 }
Exemplo n.º 4
0
        public static void TaskSetMove(LineBase bl)
        {
            EntityListBase eb = bl as EntityListBase;

            if (eb != null)
            {
                PropertyRoute route = bl.PropertyRoute;

                eb.Move = Schema.Current.Settings.FieldAttributes(bl.PropertyRoute).OfType <PreserveOrderAttribute>().Any();
            }
        }
Exemplo n.º 5
0
        static void TaskSetFormatText(LineBase bl)
        {
            ValueLine vl = bl as ValueLine;

            if (vl != null && bl.PropertyRoute.PropertyRouteType == PropertyRouteType.FieldOrProperty)
            {
                string format = Reflector.FormatString(bl.PropertyRoute);
                if (format != null)
                {
                    vl.Format = format;
                }
            }
        }
Exemplo n.º 6
0
        static void TaskSetUnitText(LineBase bl)
        {
            ValueLine vl = bl as ValueLine;

            if (vl != null && vl.PropertyRoute.PropertyRouteType == PropertyRouteType.FieldOrProperty)
            {
                UnitAttribute ua = bl.PropertyRoute.PropertyInfo.GetCustomAttribute <UnitAttribute>();
                if (ua != null)
                {
                    vl.UnitText = ua.UnitName;
                }
            }
        }
Exemplo n.º 7
0
        public static void TaskSetHtmlProperties(LineBase bl)
        {
            ValueLine vl = bl as ValueLine;

            if (vl != null && bl.PropertyRoute.PropertyRouteType == PropertyRouteType.FieldOrProperty)
            {
                var slv = Validator.TryGetPropertyValidator(bl.PropertyRoute)?.Validators.OfType <StringLengthValidatorAttribute>().FirstOrDefault();
                if (slv != null)
                {
                    int max = slv.Max; //-1 if not set
                    if (max != -1)
                    {
                        vl.ValueHtmlProps.Add("maxlength", max);
                        int?maxSize = ValueLineHelper.Configurator.MaxValueLineSize;
                        vl.ValueHtmlProps.Add("size", maxSize.HasValue ? Math.Min(max, maxSize.Value) : max);
                    }

                    if (slv.MultiLine)
                    {
                        vl.ValueLineType = ValueLineType.TextArea;
                    }
                }
            }
        }
Exemplo n.º 8
0
 public static void FireCommonTasks(LineBase eb)
 {
     CommonTask(eb);
 }