Esempio n. 1
0
 public override Property CreateProperty(string propertyName, string typeName)
 {
     if (propertyName != null)
     {
         if (propertyName == "ClientIpProperty")
         {
             return(new ClientAccessRulesClientIpProperty(propertyName, Argument.GetTypeForName(typeName)));
         }
         if (propertyName == "SourceTcpPortNumberProperty")
         {
             return(new ClientAccessRulesSourcePortNumberProperty(propertyName, Argument.GetTypeForName(typeName)));
         }
         if (propertyName == "ProtocolProperty")
         {
             return(new ClientAccessRulesProtocolProperty(propertyName, Argument.GetTypeForName(typeName)));
         }
         if (propertyName == "UsernamePatternProperty")
         {
             return(new ClientAccessRulesUsernamePatternProperty(propertyName, Argument.GetTypeForName(typeName)));
         }
         if (propertyName == "AuthenticationTypeProperty")
         {
             return(new ClientAccessRulesAuthenticationTypeProperty(propertyName, Argument.GetTypeForName(typeName)));
         }
         if (propertyName == "UserRecipientFilterProperty")
         {
             return(new ClientAccessRulesUserRecipientFilterProperty(propertyName, Argument.GetTypeForName(typeName)));
         }
     }
     throw new RulesValidationException(RulesStrings.InvalidPropertyName(propertyName));
 }
 public override PredicateCondition CreatePredicate(string name, Property property, ShortList <string> valueEntries, RulesCreationContext creationContext)
 {
     if (name != null)
     {
         if (!(name == "recipientIs"))
         {
             if (!(name == "allInternal"))
             {
                 if (name == "is")
                 {
                     if (property == null || !string.Equals(property.Name, "Message.Sender.Department", StringComparison.OrdinalIgnoreCase))
                     {
                         throw new ParserException(RulesStrings.InvalidPropertyName((property != null) ? property.Name : string.Empty));
                     }
                     return(base.CreatePredicate(name, property, valueEntries, creationContext));
                 }
             }
             else
             {
                 if (property == null || !string.Equals(property.Name, "Message.ToCcBcc", StringComparison.OrdinalIgnoreCase))
                 {
                     throw new ParserException(RulesStrings.InvalidPropertyName((property != null) ? property.Name : string.Empty));
                 }
                 return(new AllInternalPredicate());
             }
         }
         else
         {
             if (property == null || !string.Equals(property.Name, "Message.ToCcBcc", StringComparison.OrdinalIgnoreCase))
             {
                 throw new ParserException(RulesStrings.InvalidPropertyName((property != null) ? property.Name : string.Empty));
             }
             return(new RecipientIsPredicate(valueEntries, creationContext));
         }
     }
     return(base.CreatePredicate(name, property, valueEntries, creationContext));
 }