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); }
public static string AttrStringValue(this LdapEntry entry, string attrName) { if (!entry.ContainsAttr(attrName)) { return(string.Empty); } return(entry.getAttribute(attrName).StringValue); }
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); }