public static IColumnConfigurator <T, object, IFilter <object> > ProgressColumn <T, TLink, TFilter>(this IColumnConfigurator <T, TLink, TFilter> c, Func <T, double?> getProgress) where T : class, IEntity, new() where TFilter : IFilter <TLink> => c.Column() .Header("{Progress}").Width(80) .Content(s => new ProgressViewModel { Value = getProgress(s) ?? 0.0 }) .OrderBy(s => getProgress(s));
public static IColumnConfigurator <T, object, IFilter <object> > DescriptionColumn <T, TLink, TFilter>(this IColumnConfigurator <T, TLink, TFilter> c, Func <T, string> getTitle, Func <T, string> getDescription) where T : class, IEntity, new() where TFilter : IFilter <TLink> => c.Column() .Content(s => new ColumnDescriptionBlock() { VerticalAlignment = VerticalAlignment.Top, Title = getTitle(s), Description = getDescription(s) });
public static IColumnConfigurator <T, int?, EntityFilterNullable <Form> > FormColumn <T, TLink, TFilter>(this IColumnConfigurator <T, TLink, TFilter> c, Expression <Func <T, Form> > getForm) where T : class, IEntity, new() where TFilter : IFilter <TLink> { var getter = getForm.Compile(); return(c.Column() .Header("{Form}") .Width(160) .LinkNullable(getForm) .Content(e => getter(e)) .Mvvm() .Filter()); }
public static IColumnConfigurator <T, ConformityState, ConformityFilter> ConformityColumn <T, TLink, TFilter>( this IColumnConfigurator <T, TLink, TFilter> c, Expression <Func <T, ConformityState> > getStateExpression) where T : class, IEntity, new() where TFilter : IFilter <TLink> { var getState = getStateExpression.Compile(); return(c.Column() .Header("{Conformity}").Width(130) .Link(getStateExpression) .Content(s => $"{{{getState(s)}}}").Localize() .Icon(s => getState(s).IconPath(), 20) .Center() .OrderBy(s => getState(s)) .Filter(default(ConformityFilter)) .IconPath("Icons/Conformity")); }
public static IColumnConfigurator <T, string, WorkflowFilter <TW> > StageColumn <T, TLink, TFilter, TW>(this IColumnConfigurator <T, TLink, TFilter> c, TW workflow, Expression <Func <T, string> > stageNameExpression) where T : class, IEntity, new() where TFilter : IFilter <TLink> where TW : class, IWorkflow <TW> { var stageFromNameMethod = typeof(TW).GetMethod("StageFromName", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy /*,new []{typeof(string) }*/); IWorkflowStage stageFromName(string name) => (IWorkflowStage)stageFromNameMethod.Invoke(null, new [] { name }); var stageName = stageNameExpression.Compile(); Func <T, IWorkflowStage> stage = e => stageFromName(stageName(e)); return(c.Column() .Header("{Stage}").Width(180).Content(s => stage(s).GetCaption(null)) .Localize() .Icon(s => stage(s)?.GetIconPath(null), 20) .OrderBy(s => stage(s).Name) .Link(stageNameExpression) .Filter(default(WorkflowFilter <TW>)) .Header("{Stage}") .IconPath("Icons/Workflow")); }
public static IColumnConfigurator <T, int?, EntityFilterNullable <TE> > Column <T, TLink, TFilter, TE>(this IColumnConfigurator <T, TLink, TFilter> c, Expression <Func <T, TE> > getter, string id = null, // Expression<Func<T, int?>> getterId = null, double width = double.NaN ) where T : class, IEntity, new() where TFilter : IFilter <TLink> where TE : class, IListableModel, IEntity <int>, new() { var lambda = getter.Compile(); // getterId ??= GetterIdNullableFromGetter(getter); return(c.Column(id) .Header($"{{{typeof(TE).Name}}}") .Width(width) .LinkNullable(getter) .Content(e => lambda(e)) .OrderBy(e => c.Localize(lambda(e)?.Caption)) // TODO .Icon(e => lambda(e)?.IconPath) .Filter().IconPath($"Icons/Entities/{typeof(TE).Name}") ); }