public MultiItemsGeneralEditPage(MPContainer parent)
 {
     this.pageID = "MultiItemsGeneralEditPage";
     InitializeComponent();
     SetPageTitle("General");
     this.parentDlg = parent as MultiItemPropertiesDlg;
 }
示例#2
0
 public UserMultiselectGeneralEditPage(MPContainer parent)
 {
     this.pageID = "UserMultiSelectProperities";
     InitializeComponent();
     SetPageTitle("General");
     this.parentDlg = parent as MultiItemPropertiesDlg;
     //InitializeComponent();
 }
示例#3
0
 public MultiItemsAddressEditPage(MPContainer parent, bool bMultiUser)
 {
     this.pageID = "UserMultiSelectAddressProperities";
     InitializeComponent();
     SetPageTitle("Address");
     this.parentDlg     = parent;
     bMultiUserSelected = bMultiUser;
     HideCheckbox();
 }
示例#4
0
        public bool OnApply()
        {
            List <LDAPMod>   attrlist   = new List <LDAPMod>();
            LDAPMod          attr       = null;
            DirectoryContext dirContext = dirnode.LdapContext;

            string[] objectClass_values = null;

            string street = txtStreet.Text.Trim();

            if (street.Contains("\n"))
            {
                street = street.Replace("\n", "\r\n");
            }

            objectClass_values = street == string.Empty ? new string[] { null } : new string[] { street, null };
            attr =
                new LDAPMod((int)LDAPMod.mod_ops.LDAP_MOD_REPLACE, "streetAddress",
                            objectClass_values);
            if (bMultiUserSelected && chkStreet.Checked)
            {
                attrlist.Add(attr);
            }
            else if (!bMultiUserSelected && !String.IsNullOrEmpty(txtStreet.Text.Trim()))
            {
                attrlist.Add(attr);
            }

            objectClass_values = txtPOBox.Text.Trim() == string.Empty ? new string[] { null } : new string[] { txtPOBox.Text.Trim(), null };
            attr =
                new LDAPMod((int)LDAPMod.mod_ops.LDAP_MOD_REPLACE, "postOfficeBox",
                            objectClass_values);
            if (bMultiUserSelected && chkPO.Checked)
            {
                attrlist.Add(attr);
            }
            else if (!bMultiUserSelected && !String.IsNullOrEmpty(txtPOBox.Text.Trim()))
            {
                attrlist.Add(attr);
            }

            objectClass_values = txtCity.Text.Trim() == string.Empty ? new string[] { null } : new string[] { txtCity.Text.Trim(), null };
            attr =
                new LDAPMod((int)LDAPMod.mod_ops.LDAP_MOD_REPLACE, "l",
                            objectClass_values);
            if (bMultiUserSelected && chkCity.Checked)
            {
                attrlist.Add(attr);
            }
            else if (!bMultiUserSelected && !String.IsNullOrEmpty(txtCity.Text.Trim()))
            {
                attrlist.Add(attr);
            }

            objectClass_values = txtState.Text.Trim() == string.Empty ? new string[] { null } : new string[] { txtState.Text.Trim(), null };
            attr =
                new LDAPMod((int)LDAPMod.mod_ops.LDAP_MOD_REPLACE, "st",
                            objectClass_values);
            if (bMultiUserSelected && chkState.Checked)
            {
                attrlist.Add(attr);
            }
            else if (!bMultiUserSelected && !String.IsNullOrEmpty(txtState.Text.Trim()))
            {
                attrlist.Add(attr);
            }

            objectClass_values = txtZip.Text.Trim() == string.Empty ? new string[] { null } : new string[] { txtZip.Text.Trim(), null };
            attr =
                new LDAPMod((int)LDAPMod.mod_ops.LDAP_MOD_REPLACE, "postalCode",
                            objectClass_values);
            if (bMultiUserSelected && chkZip.Checked)
            {
                attrlist.Add(attr);
            }
            else if (!bMultiUserSelected && !String.IsNullOrEmpty(txtZip.Text.Trim()))
            {
                attrlist.Add(attr);
            }

            objectClass_values = cbCountry.Text.Trim() == string.Empty ? new string[] { null } : new string[] { cbCountry.Text.Trim(), null };
            attr =
                new LDAPMod((int)LDAPMod.mod_ops.LDAP_MOD_REPLACE, "co",
                            objectClass_values);
            if (bMultiUserSelected && chkCountry.Checked)
            {
                attrlist.Add(attr);
            }
            else if (!bMultiUserSelected && !String.IsNullOrEmpty(cbCountry.Text.Trim()))
            {
                attrlist.Add(attr);
            }

            SetControlStatus();

            LDAPMod[] attrArry = attrlist.ToArray();
            int       ret      = -1;

            if (attrArry != null && attrArry.Length != 0)
            {
                List <object> dirnodes = new List <object>();
                if (parentDlg is MultiItemPropertiesDlg)
                {
                    MPContainer _MultiItemPropertiesDlg = parentDlg as MPContainer;
                    dirnodes = _MultiItemPropertiesDlg.ObjectCounts;
                }
                else
                {
                    MPContainer _ADUserPropertiesDlg = parentDlg as MPContainer;
                    dirnodes = _ADUserPropertiesDlg.ObjectCounts;
                }
                foreach (ADUCDirectoryNode dn in dirnodes)
                {
                    if (dn != null)
                    {
                        ret = dirContext.ModifySynchronous(dn.DistinguishedName, attrArry);
                    }
                    if (ret != 0)
                    {
                        string sMsg = ErrorCodes.LDAPString(ret);
                        container.ShowError(sMsg);
                        return(false);
                    }
                }
            }

            return(true);
        }