public static string CanExecute <T>(this T entity, IEntityOperationSymbolContainer <T> symbol) where T : class, IEntity { var op = Find <IEntityOperation>(entity.GetType(), symbol.Symbol); return(op.CanExecute(entity)); }
protected virtual string WriteConstructFrom(IEntityOperationSymbolContainer oper) { List <Type> type = oper.GetType().GetGenericArguments().ToList(); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.ConstructFrom<{1}>({2})".FormatWith(type[0].TypeName(), type[1].TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); sb.AppendLine(" Construct = ({0}, _) => new {1}".FormatWith(GetVariableName(type[1]), type[0].TypeName())); sb.AppendLine(" {"); sb.AppendLine(" }"); sb.AppendLine("}.Register();"); return(sb.ToString()); }
protected virtual string WriteDeleteOperation(IEntityOperationSymbolContainer oper) { Type type = oper.GetType().GetGenericArguments().Single(); string v = GetVariableName(type); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.Delete({1})".FormatWith(type.TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); sb.AppendLine(" Delete = ({0}, _) => {0}.Delete()".FormatWith(v)); sb.AppendLine("}.Register();"); return(sb.ToString()); }
protected virtual string WriteExecuteOperation(IEntityOperationSymbolContainer oper) { Type type = oper.GetType().GetGenericArguments().Single(); var v = GetVariableName(type); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.Execute({1})".FormatWith(type.TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); if (IsSave(oper)) { sb.AppendLine(" AllowsNew = true,"); sb.AppendLine(" Lite = false,"); } sb.AppendLine(" Execute = ({0}, _) => {{ }}".FormatWith(v)); sb.AppendLine("}.Register();"); return(sb.ToString()); }
public static IWebElement OperationClickCapture <T>(this IEntityButtonContainer <T> container, IEntityOperationSymbolContainer <T> symbol) where T : Entity { return(container.OperationClickCapture(symbol.Symbol)); }
public static WebElementLocator OperationButton <T>(this IEntityButtonContainer <T> container, IEntityOperationSymbolContainer <T> symbol) where T : Entity { return(container.OperationButton(symbol.Symbol)); }
public static void Register <T>(this IEntityOperationSymbolContainer <T> entityOperation, ContextualOperationSettings <T> settings) where T : class, IEntity { ProcessContextualOperartions[entityOperation.Symbol] = settings; }
/// <param name="symbolContainer">A ExecuteSymbol<T>, DeleteSymbol<T> or a Construct<R>.From<T></param> public EntityOperationSettings(IEntityOperationSymbolContainer <T> symbolContainer) : base(symbolContainer.Symbol) { this.Contextual = new ContextualOperationSettings <T>(symbolContainer); this.ContextualFromMany = new ContextualOperationSettings <T>(symbolContainer); }
internal ContextualOperationSettings(IEntityOperationSymbolContainer <T> symbolContainer) : base(symbolContainer.Symbol) { }
public static bool OperationDisabled <T>(this IEntityButtonContainer <T> container, IEntityOperationSymbolContainer <T> symbol) where T : Entity { return(container.ButtonDisabled(symbol.Symbol.KeyWeb())); }
protected virtual string WriteDeleteOperation(IEntityOperationSymbolContainer oper) { Type type = oper.GetType().GetGenericArguments().Single(); string v = GetVariableName(type); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.Delete({1})".FormatWith(type.TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); sb.AppendLine(" Delete = ({0}, _) => {0}.Delete()".FormatWith(v)); sb.AppendLine("}.Register();"); return sb.ToString(); }
protected virtual bool IsSave(IEntityOperationSymbolContainer oper) { return oper.ToString().Contains("Save"); ; }
protected virtual string WriteExecuteOperation(IEntityOperationSymbolContainer oper) { Type type = oper.GetType().GetGenericArguments().Single(); var v = GetVariableName(type); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.Execute({1})".FormatWith(type.TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); if (IsSave(oper)) { sb.AppendLine(" AllowsNew = true,"); sb.AppendLine(" Lite = false,"); } sb.AppendLine(" Execute = ({0}, _) => {{ }}".FormatWith(v)); sb.AppendLine("}.Register();"); return sb.ToString(); }
protected virtual bool IsSave(IEntityOperationSymbolContainer oper) { return(oper.ToString().Contains("Save"));; }
public static EntityOperationSettings <T> GetEntitySettings <T>(IEntityOperationSymbolContainer <T> operation) where T : class, IEntity { return(Manager.GetSettings <EntityOperationSettings <T> >(typeof(T), operation.Symbol)); }
public static By OperationLocator <T>(this IEntityButtonContainer <T> container, IEntityOperationSymbolContainer <T> symbol) where T : Entity { return(container.ButtonLocator(symbol.Symbol.KeyWeb())); }
protected virtual string WriteConstructFrom(IEntityOperationSymbolContainer oper) { List<Type> type = oper.GetType().GetGenericArguments().ToList(); StringBuilder sb = new StringBuilder(); sb.AppendLine("new Graph<{0}>.ConstructFrom<{1}>({2})".FormatWith(type[0].TypeName(), type[1].TypeName(), oper.Symbol.ToString())); sb.AppendLine("{"); sb.AppendLine(" Construct = ({0}, _) => new {1}".FormatWith(GetVariableName(type[1]), type[0].TypeName())); sb.AppendLine(" {"); sb.AppendLine(" }"); sb.AppendLine("}.Register();"); return sb.ToString(); }
public static void OperationClick <T>(this IEntityButtonContainer <T> container, IEntityOperationSymbolContainer <T> symbol) where T : Entity { container.ButtonClick(symbol.Symbol.KeyWeb()); }
public static bool OperationNotPresent <T>(this IEntityButtonContainer <T> container, IEntityOperationSymbolContainer <T> symbol) where T : Entity { return(container.OperationButton(symbol).TryFind() == null); }