Exemple #1
0
        /// <summary>
        /// Build a BS1192 role field from a standard BS1192 Role.
        /// </summary>
        /// <param name="role">The standard BS1192 role as a Role.</param>
        public Role(Standard.Role role)
        {
            // throws exception if argument is invalid.
            // we do this instead of defaulting to A as user would expect the exact supplied value to be used.
            this.CurrentRole = role;

            this.Required           = true;
            this.NumberOfChars      = 1;
            this.FixedNumberOfChars = true;
        }
Exemple #2
0
        /// <summary>
        /// Build a BS1192 role field from a standard BS1192 Role.
        /// </summary>
        /// <param name="s">The standard BS1192 role as a string.</param>
        public Role(string s)
        {
            Standard.Role role;

            if (CheckFormatAndLength(s))
            {
                throw new Exception("Cannot build Role because supplied string is invalid");
            }
            if (!Enum.TryParse(s, out role))
            {
                throw new Exception("Could not parse string into Role.");
            }

            this.CurrentRole        = role;
            this.Required           = true;
            this.NumberOfChars      = 1;
            this.FixedNumberOfChars = true;
        }