/// <summary>
        /// Replaces keys with the corresponding value from incident - ex "{key1} + {key2} /2 " -> "24 + 13 / 2"
        /// </summary>
        /// <param name="input">Input incident object containing values for expression formatting</param>
        /// <param name="inputExpression">Expression that will be formatted into value string</param>
        /// <returns></returns>
        public static string ReplaceKeysInStringWithValues(IIncidentObject input, string inputExpression)
        {
            MatchCollection matches = keysRegex.Matches(inputExpression);

            foreach (Match match in matches)
            {
                inputExpression = inputExpression.Replace(match.Value, input.Get(match.Value).ToString());
            }

            return(inputExpression);
        }
        private string GetAgencySchemeId(IIncidentObject input)
        {
            foreach (Agency agency in agencies)
            {
                if (!input.ContainsValue(agency.key))
                {
                    continue;
                }
                if (input.Get(agency.key).Equals(agency.value))
                {
                    return(agency.schemeId);
                }
            }

            throw new InvalidDataException("Undefined Agency Encountered");
        }
Exemplo n.º 3
0
 public bool Validate(IIncidentObject input)
 {
     return(((string)input.Get(key)).Equals(value));
 }