Esempio n. 1
0
        public GroupGeneralEditPage()
        {
            pageID = "GroupGeneralEditProperities";
            InitializeComponent();
            SetPageTitle("General");

            _editObject     = new GroupGenerelEditObject();
            _originalObject = new GroupGenerelEditObject();
        }
        public GroupGeneralEditPage()
        {
            pageID = "GroupGeneralEditProperities";
            InitializeComponent();
            SetPageTitle("General");

            _editObject = new GroupGenerelEditObject();
            _originalObject = new GroupGenerelEditObject();
        }
Esempio n. 3
0
 private void UpdateOriginalData()
 {
     if (_editObject != null)
     {
         _originalObject = (GroupGenerelEditObject)_editObject.Clone();
     }
     else
     {
         _originalObject = new GroupGenerelEditObject();
     }
 }
Esempio n. 4
0
        public virtual object Clone()
        {
            // Create a shallow copy first
            GroupGenerelEditObject other = MemberwiseClone() as GroupGenerelEditObject;

            other.Description = Description;
            other.Name        = Name;
            other.Email       = Email;
            other.Notes       = Notes;
            other.GroupType   = GroupType;
            return(other);
        }
Esempio n. 5
0
        /// <summary>
        /// Queries and fills the ldap message for the selected group
        /// Gets the attribute list from AD for group schema attribute.
        /// search for the attributes description, cn 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
            {
                this.dirnode = dirnode;
                int ret = -1;
                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);
                        }

                        sValue = sValue.Substring(0, sValue.Length);

                        if (string.Compare(sValue, "") == 0)
                        {
                            sValue = "<Not Set>";
                        }

                        if (string.Compare(attr, "cn") == 0)
                        {
                            this.lblGroupName.Text = sValue;
                        }

                        if (string.Compare(attr, "sAMAccountName") == 0)
                        {
                            _editObject.Name         = sValue;
                            this.txtPrewinGroup.Text = sValue;
                        }

                        if (string.Compare(attr, "description") == 0)
                        {
                            this.txtDescription.Text = sValue;
                            _editObject.Description  = sValue;
                        }

                        if (string.Compare(attr, "mail") == 0)
                        {
                            this.txtEmail.Text = sValue;
                            _editObject.Email  = sValue;
                        }

                        if (string.Compare(attr, "groupType") == 0)
                        {
                            EnableCheckBox(sValue);
                            _editObject.GroupType = sValue;
                        }


                        if (string.Compare(attr, "info") == 0)
                        {
                            this.txtNotes.Text = sValue;
                            _editObject.Notes  = sValue;
                        }
                    }
                }
                if (_editObject != null)
                {
                    _originalObject = (GroupGenerelEditObject)_editObject.Clone();
                }
                else
                {
                    _originalObject = new GroupGenerelEditObject();
                }
                UpdateApplyButton();
            }
            catch (Exception e)
            {
                container.ShowError(e.Message);
            }

            // throw new NotImplementedException();
        }
        /// <summary>
        /// Queries and fills the ldap message for the selected group
        /// Gets the attribute list from AD for group schema attribute.
        /// search for the attributes description, cn 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
            {
                this.dirnode = dirnode;
                int ret = -1;
                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);
                        }

                        sValue = sValue.Substring(0, sValue.Length);

                        if (string.Compare(sValue, "") == 0)
                        {
                            sValue = "<Not Set>";
                        }

                        if (string.Compare(attr, "cn") == 0)
                        {
                            this.lblGroupName.Text = sValue;
                        }

                        if (string.Compare(attr, "sAMAccountName") == 0)
                        {
                            _editObject.Name = sValue;
                            this.txtPrewinGroup.Text = sValue;
                        }

                        if (string.Compare(attr, "description") == 0)
                        {
                            this.txtDescription.Text = sValue;
                            _editObject.Description = sValue;
                        }

                        if (string.Compare(attr, "mail") == 0)
                        {
                            this.txtEmail.Text = sValue;
                            _editObject.Email = sValue;
                        }

                        if (string.Compare(attr, "groupType") == 0)
                        {
                            EnableCheckBox(sValue);
                            _editObject.GroupType = sValue;
                        }


                        if (string.Compare(attr, "info") == 0)
                        {
                            this.txtNotes.Text = sValue;
                            _editObject.Notes = sValue;
                        }
                    }
                }
                if (_editObject != null)
                {
                    _originalObject = (GroupGenerelEditObject)_editObject.Clone();
                }
                else
                {
                    _originalObject = new GroupGenerelEditObject();
                }
                UpdateApplyButton();
            }
            catch (Exception e)
            {
                container.ShowError(e.Message);
            }

            // throw new NotImplementedException();
        }
 private void UpdateOriginalData()
 {
     if (_editObject != null)
     {
         _originalObject = (GroupGenerelEditObject)_editObject.Clone();
     }
     else
     {
         _originalObject = new GroupGenerelEditObject();
     }
 }