/// <summary>
        /// Add query parameters.
        /// </summary>
        /// <param name="list"></param>
        public void AddParameters(List <string> queryParams)
        {
            string allParams = string.Empty;

            foreach (string queryParam in queryParams)
            {
                NamedQueryParam param = NamedQueryParamsParser.ParseParams(queryParam)[0];
                allParams += param.ToString() + ",";
            }
            if (allParams[allParams.Length - 1] == ',')
            {
                allParams = allParams.Substring(0, allParams.Length - 1);
            }

            this.Parameters = allParams;
        }
        /// <summary>
        /// Validate a single parameter by
        /// 1. checking it's type against
        /// 2. Check the supplied value against the type.
        /// 3. supplied value is not null.
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        protected BoolMessage ValidateParam(NamedQueryParam param)
        {
            // Check type.
            if (!_validTypes.ContainsKey(param.Typ))
            {
                return(new BoolMessage(false, "Unknown type : " + param.Typ));
            }

            // Check if required param.
            if (param.IsRequired)
            {
                if (param.Val == null)
                {
                    return(new BoolMessage(false, "Value not provided for : " + param.Name));
                }
            }
            return(BoolMessage.True);
        }
        /// <summary>
        /// Parses the parameters definition string and returns a List of NamedQueryParam objects.
        /// </summary>
        /// <param name="paramDefinitions">E.g. "@id:int:1:'';@businessDate:date:1:${today};@username:string:1:''"</param>
        /// <returns>List of NamedQueryParam objects.</returns>
        public static IList <NamedQueryParam> ParseParams(string paramDefinitions)
        {
            MatchCollection         parameterMatches = Regex.Matches(paramDefinitions, ParamDefinitionRegEx);
            IList <NamedQueryParam> namedQueryParams = new List <NamedQueryParam>();

            // Get each parameter.
            foreach (Match parameterMatch in parameterMatches)
            {
                NamedQueryParam param = new NamedQueryParam();

                Group group = parameterMatch.Groups["name"];
                if (group != null)
                {
                    param.Name = group.Value;
                }

                group = parameterMatch.Groups["type"];
                if (group != null)
                {
                    param.Typ = group.Value;
                }

                group = parameterMatch.Groups["required"];
                if (group != null)
                {
                    param.IsRequired = group.Value == "1" ? true : false;
                }

                group = parameterMatch.Groups["defaultValue"];
                if (group != null)
                {
                    param.DefaultValue = group.Value;
                }

                namedQueryParams.Add(param);
            }
            return(namedQueryParams);
        }