Пример #1
0
        internal static IEnumerable <string> HashtablesToStrings(IEnumerable <Hashtable> parameters, OrganizationId orgId)
        {
            IEnumerable <TargetDataClassification> source = MessageContainsDataClassificationsPredicate.HashtablesToDataClassifications(parameters);

            if (orgId == null)
            {
                return(from classification in source
                       select classification.ToString());
            }
            string empty = string.Empty;
            IEnumerable <string> result;

            try
            {
                Dictionary <string, Tuple <string, string> > resolvedClassifications = DlpUtils.QueryDataClassification(from value in source
                                                                                                                        select value.Id, orgId, null, null, null).ToDictionary((DataClassificationPresentationObject k) => k.Identity.ToString(), (DataClassificationPresentationObject v) => new Tuple <string, string>(v.Name, v.LocalizedName));
                result = from classificationObject in source
                         select MessageContainsDataClassificationsPredicate.FormatClassificationString(classificationObject, resolvedClassifications);
            }
            catch (KeyNotFoundException)
            {
                throw new ArgumentException(RulesTasksStrings.InvalidMessageClassification(empty));
            }
            return(result);
        }