Exemplo n.º 1
0
        private AnalyzedStepParameter AnalyzeParameter(string value, CultureInfo bindingCulture, int paramIndex, string regexPattern, ParameterType parameterType)
        {
            string paramName = StepParameterNameGenerator.GenerateParameterName(value, paramIndex, usedParameterNames);

            int intParamValue;

            if (parameterType == ParameterType.Int && int.TryParse(value, NumberStyles.Integer, bindingCulture, out intParamValue))
            {
                return(new AnalyzedStepParameter("Int32", paramName, regexPattern));
            }

            decimal decimalParamValue;

            if (parameterType == ParameterType.Decimal && decimal.TryParse(value, NumberStyles.Number, bindingCulture, out decimalParamValue))
            {
                return(new AnalyzedStepParameter("Decimal", paramName, regexPattern));
            }

            DateTime dateParamValue;

            if (parameterType == ParameterType.Date && DateTime.TryParse(value, bindingCulture, DateTimeStyles.AllowWhiteSpaces, out dateParamValue))
            {
                return(new AnalyzedStepParameter("DateTime", paramName, regexPattern));
            }

            return(new AnalyzedStepParameter("String", paramName, regexPattern));
        }
Exemplo n.º 2
0
        private AnalyzedStepParameter AnalyzeParameter(string value, CultureInfo bindingCulture, int paramIndex, string regexPattern)
        {
            string paramName = StepParameterNameGenerator.GenerateParameterName(value, paramIndex, usedParameterNames);

            int intParamValue;

            if (int.TryParse(value, NumberStyles.Integer, bindingCulture, out intParamValue))
            {
                return(new AnalyzedStepParameter("Int32", paramName, regexPattern));
            }

            decimal decimalParamValue;

            if (decimal.TryParse(value, NumberStyles.Number, bindingCulture, out decimalParamValue))
            {
                return(new AnalyzedStepParameter("Decimal", paramName, regexPattern));
            }

            return(new AnalyzedStepParameter("String", paramName, regexPattern));
        }