private void UpdateOriginalData() { if (_editObject != null) { _originalObject = (ContainerGenerelEditObject)_editObject.Clone(); } else { _originalObject = new ContainerGenerelEditObject(); } }
/// <summary> /// Queries and fills the ldap message for the selected Container /// Gets the attribute list from AD for Container schema attribute. /// search for the attributes description, ou or name and displays them in a controls /// </summary> /// <param name="ce"></param> /// <param name="servername"></param> /// <param name="name"></param> /// <param name="dirnode"></param> public void SetData(CredentialEntry ce, string servername, string name, ADUCDirectoryNode dirnode) { try { _editObject = new ContainerGenerelEditObject(); int ret = -1; this.dirnode = dirnode; List <LdapEntry> ldapEntries = null; ret = dirnode.LdapContext.ListChildEntriesSynchronous (dirnode.DistinguishedName, LdapAPI.LDAPSCOPE.BASE, "(objectClass=*)", null, false, out ldapEntries); if (ldapEntries == null || ldapEntries.Count == 0) { return; } LdapEntry ldapNextEntry = ldapEntries[0]; string[] attrsList = ldapNextEntry.GetAttributeNames(); if (attrsList != null) { foreach (string attr in attrsList) { string sValue = ""; LdapValue[] attrValues = ldapNextEntry.GetAttributeValues(attr, dirnode.LdapContext); if (attrValues != null && attrValues.Length > 0) { foreach (LdapValue value in attrValues) { sValue = sValue + "," + value.stringData; } } if (sValue.StartsWith(",")) { sValue = sValue.Substring(1); } if (string.Compare(sValue, "") == 0) { sValue = "<Not Set>"; } if (string.Compare(attr, "description") == 0) { this.txtDescription.Text = attrValues[0].stringData; _editObject.Description = sValue; } if (string.Compare(attr, "cn") == 0) { this.userNamelabel.Text = sValue; } } } if (_editObject != null) { _originalObject = (ContainerGenerelEditObject)_editObject.Clone(); } else { _originalObject = new ContainerGenerelEditObject(); } UpdateApplyButton(); } catch (Exception e) { container.ShowError(e.Message); } // throw new NotImplementedException(); }
/// <summary> /// Queries and fills the ldap message for the selected Container /// Gets the attribute list from AD for Container schema attribute. /// search for the attributes description, ou or name and displays them in a controls /// </summary> /// <param name="ce"></param> /// <param name="servername"></param> /// <param name="name"></param> /// <param name="dirnode"></param> public void SetData(CredentialEntry ce, string servername, string name, ADUCDirectoryNode dirnode) { try { _editObject = new ContainerGenerelEditObject(); int ret = -1; this.dirnode = dirnode; List<LdapEntry> ldapEntries = null; ret = dirnode.LdapContext.ListChildEntriesSynchronous (dirnode.DistinguishedName, LdapAPI.LDAPSCOPE.BASE, "(objectClass=*)", null, false, out ldapEntries); if (ldapEntries == null || ldapEntries.Count == 0) { return; } LdapEntry ldapNextEntry = ldapEntries[0]; string[] attrsList = ldapNextEntry.GetAttributeNames(); if (attrsList != null) { foreach (string attr in attrsList) { string sValue = ""; LdapValue[] attrValues = ldapNextEntry.GetAttributeValues(attr, dirnode.LdapContext); if (attrValues != null && attrValues.Length > 0) { foreach (LdapValue value in attrValues) { sValue = sValue + "," + value.stringData; } } if (sValue.StartsWith(",")) { sValue = sValue.Substring(1); } if (string.Compare(sValue, "") == 0) { sValue = "<Not Set>"; } if (string.Compare(attr, "description") == 0) { this.txtDescription.Text = attrValues[0].stringData; _editObject.Description = sValue; } if (string.Compare(attr, "cn") == 0) { this.userNamelabel.Text = sValue; } } } if (_editObject != null) { _originalObject = (ContainerGenerelEditObject)_editObject.Clone(); } else { _originalObject = new ContainerGenerelEditObject(); } UpdateApplyButton(); } catch (Exception e) { container.ShowError(e.Message); } // throw new NotImplementedException(); }