Пример #1
0
        public RadioTokenHelper(DisplayableToken displayableToken)
        {
            if (!displayableToken.Name.Equals("FormRadio"))
                throw new ArgumentException("Not a radio token", "displayableToken");

            _displayableToken = displayableToken;
        }
        public FreeTextareaTokenHelper(DisplayableToken displayableToken)
        {
            if (!displayableToken.Name.Equals("FormTextarea"))
                throw new ArgumentException("Not a textarea token", "displayableToken");

            _displayableToken = displayableToken;
        }
Пример #3
0
        public FileTokenHelper(DisplayableToken displayableToken)
        {
            if (!displayableToken.Name.Equals("FormFile"))
                throw new ArgumentException("Not a file token", "displayableToken");

            _displayableToken = displayableToken;
        }
Пример #4
0
        public InputTokenHelper(DisplayableToken displayableToken)
        {
            if (!displayableToken.Name.Equals("FormInput"))
                throw new ArgumentException("Not an input token", "displayableToken");

            _displayableToken = displayableToken;
        }
Пример #5
0
        public SelectTokenHelper(DisplayableToken displayableToken)
        {
            if (!displayableToken.Name.Equals("FormSelect"))
                throw new ArgumentException("Not a select token", "displayableToken");

            _displayableToken = displayableToken;
        }
        public CheckboxTokenHelper(DisplayableToken displayableToken)
        {
            if (!displayableToken.Name.Equals("FormCheckbox"))
                throw new ArgumentException("Not a checkbox token", "displayableToken");

            _displayableToken = displayableToken;
        }
Пример #7
0
        public static string[] GetComponents(this DisplayableToken token)
        {
            if (string.IsNullOrEmpty(token.Value))
            {
                return new string[] { "" }
            }
            ;

            return(token.Value.Split('|'));
        }
Пример #8
0
 public static string GetOptionalInputName(this DisplayableToken token, int position, int treshold)
 {
     string[] components = token.GetComponents();
     return(components.Length > treshold ? components[position] : (token.Name + token.Index));
 }
Пример #9
0
 public static bool Is(this DisplayableToken token, string tokenName)
 {
     return(token.Name.Equals(tokenName, StringComparison.InvariantCultureIgnoreCase));
 }
Пример #10
0
 public static string GenerateInputName(this DisplayableToken token)
 {
     return(token.Name + token.Index);
 }