Пример #1
0
        private Org SyncOrgFromEntry(LdapEntry rootEntry, Org parentOrg, LdapEntry entry)
        {
            string orgId = entry.Guid().ToLower();
            Org    org   = this._org.GetOrgById(orgId) as Org;

            if (org != null)
            {
                if (entry.ContainsAttr("ou"))
                {
                    org.Name = entry.getAttribute("ou").StringValue + string.Empty;
                }
                //设置其他属性的值
                _org.UpdateOrg(org);
                return(org);
            }
            org = new Org
            {
                Id       = orgId,
                ParentId = parentOrg.Id,
            };

            //设置其他属性的值
            this._org.AddOrg(org);
            return(org);
        }
Пример #2
0
 public static string AttrStringValue(this LdapEntry entry, string attrName)
 {
     if (!entry.ContainsAttr(attrName))
     {
         return(string.Empty);
     }
     return(entry.getAttribute(attrName).StringValue);
 }
Пример #3
0
        public static List <string> AttrStringValueArray(this LdapEntry entry, string attrName)
        {
            List <string> list = new List <string>();

            if (!entry.ContainsAttr(attrName))
            {
                return(list);
            }

            string[] values = entry.getAttribute(attrName).StringValueArray;
            foreach (var item in values)
            {
                list.Add(item);
            }
            return(list);
        }