示例#1
0
        private Result CreateBaseResult(DirectoryEntry baseou, List <KeyValuePair <string, XElement> > propertytemplates)
        {
            Result r = new Result();

            if (propertytemplates.Count != 0)
            {
                foreach (KeyValuePair <string, XElement> template in propertytemplates)
                {
                    FormattedProperty pf = new FormattedProperty(template.Value);
                    if (baseou.Properties[pf.Name] != null && baseou.Properties[pf.Name].Count > 0)
                    {
                        pf.Input = baseou.Properties[pf.Name][0].ToString();
                        r.Add(pf);
                    }
                }
            }
            else
            {
                foreach (PropertyCollection pc in baseou.Properties)
                {
                    if (pc.Count > 0)
                    {
                        foreach (string s in pc.Values)
                        {
                            FormattedProperty pf = new FormattedProperty();
                            pf.Input = s;
                            r.Add(pf);
                        }
                    }
                }
            }

            return(r);
        }
示例#2
0
        private void AddPropertiesToWrangler(ResultWrangler wrangler, Principal group, List <KeyValuePair <string, XElement> > PropertyTemplates)
        {
            wrangler.NewResult();

            //if properties have been specified in the xml, query them directly in order
            if (PropertyTemplates.Count != 0)
            {
                foreach (KeyValuePair <string, XElement> template in PropertyTemplates)
                {
                    FormattedProperty prop = new FormattedProperty(template.Value);
                    prop.Input = PropertyInterogation.GetStringFromPropertyValue(group, template.Key);
                    wrangler.AddFormattedProperty(prop);
                }
            }
        }