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; } } } } }
public static void TaskSetLabelText(LineBase bl) { if (bl != null && bl.PropertyRoute.PropertyRouteType == PropertyRouteType.FieldOrProperty) { bl.LabelText = bl.PropertyRoute.PropertyInfo.NiceName(); } }
public static void TaskSetReadOnly(LineBase bl) { if (bl != null && bl.PropertyRoute.PropertyRouteType == PropertyRouteType.FieldOrProperty) { if (bl.PropertyRoute.PropertyInfo.IsReadOnly() || bl.ReadOnly) { bl.ReadOnly = true; } } }
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(); } }
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; } } }
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; } } }
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; } } } }
public static void FireCommonTasks(LineBase eb) { CommonTask(eb); }