Example #1
0
 public Dictionary <string, object> BuildRouteValues(TokenHandlerContext context, IEnumerable <string> excludedParameterNames)
 {
     return(context
            .Parameters
            .Keys
            .Except(excludedParameterNames, StringComparer.OrdinalIgnoreCase)
            .ToDictionary(
                key => key,
                key => (object)context.Parameters[key]));
 }
Example #2
0
        public string GetTokenValue(Customer customer, string token, IDictionary <string, string> parameters)
        {
            if (customer == null)
            {
                throw new ArgumentNullException("customer");
            }

            var effectiveParamaters = parameters == null
                                ? new Dictionary <string, string>()
                                : new Dictionary <string, string>(parameters, StringComparer.OrdinalIgnoreCase);

            var tokenHandlerContext = new TokenHandlerContext(customer, token, effectiveParamaters);

            return(TokenHandlers
                   .Select(handler => handler.RenderToken(tokenHandlerContext))
                   .Where(result => result != null)
                   .FirstOrDefault());
        }
Example #3
0
 public string GetSeNameParameterValue(TokenHandlerContext context, string seNameParam)
 {
     return(context.Parameters.ContainsKey(seNameParam)
                         ? context.Parameters[seNameParam] ?? string.Empty
                         : string.Empty);
 }
Example #4
0
 public string GetEntityTypeParameterValue(TokenHandlerContext context, string entityNameParam)
 {
     return(context.Parameters.ContainsKey(entityNameParam)
                         ? context.Parameters[entityNameParam] ?? string.Empty
                         : string.Empty);
 }
Example #5
0
 public int GetEntityIdParameterValue(TokenHandlerContext context, string entityIdParam)
 {
     return(context.Parameters.ContainsKey(entityIdParam)
                         ? Localization.ParseUSInt(context.Parameters[entityIdParam])
                         : 0);
 }