Пример #1
0
        public void AddGroup()
        {
            GroupDTO dto = new GroupDTO();
            var      frm = new AddGroup(dto);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                MiscUtilsService.CheckedExec(delegate()
                {
                    LdapMod[] user = new LdapMod[4];
                    user[0]        = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_CN, new string[] {
                        dto.cn,
                        null
                    });
                    user[1] = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_GROUPTYPE, new string[] {
                        dto.groupType.ToString(),
                        null
                    });
                    user[2] = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_SAM_ACCOUNT_NAME, new string[] {
                        dto.sAMAccountName,
                        null
                    });
                    user[3] = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_OBJECT_CLASS, new string[] {
                        dto.objectClass,
                        null
                    });
                    string dn = string.Format("cn={0},{1}", dto.cn, Dn);
                    ServerDTO.Connection.AddObject(dn, user);
                    ClearDummyNode();
                    var oc = VMDirUtil.Utilities.GetObjectClassList(ServerDTO, dn, LdapScope.SCOPE_BASE);
                    this.Nodes.Insert(0, new DirectoryExpandableNode(dn, oc, ServerDTO, PropertiesCtl));
                    MMCDlgHelper.ShowInformation(VMDirConstants.STAT_GRP_ADD_SUCC);
                });
            }
        }
Пример #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (!ValidateForm())
                {
                    this.DialogResult = DialogResult.None;
                    return;
                }

                if (_dto == null)
                {
                    _dto = VMDirServerDTO.CreateInstance();
                }

                _dto.Server   = (txtDirectoryServer.Text).Trim();
                _dto.BaseDN   = (txtBaseDN.Text).Trim();
                _dto.BindDN   = (txtBindUPN.Text).Trim();
                _dto.Password = txtPassword.Text;

                _dto.Connection = new LdapConnectionService(_dto.Server, _dto.BindDN, _dto.Password);
                _dto.Connection.CreateConnection();

                this.Close();
            }
            catch (Exception exp)
            {
                MiscUtilsService.ShowError(exp);
            }
        }
Пример #3
0
        private void ShowOptionalAttribute()
        {
            if (_serverDTO == null || _serverDTO.Connection == null)
            {
                MMCDlgHelper.ShowWarning(VMDirConstants.WRN_RELOGIN);
                return;
            }
            MiscUtilsService.CheckedExec(delegate
            {
                if (_optAttrDTOList.Count <= 0)
                {
                    GetOptionalAttribute();
                }
                var optlvg = new ListViewGroup("Optional Attributes")
                {
                    Tag = GroupTag.OPTIONAL_ATT
                };
                listViewProp.Groups.Add(optlvg);

                var lviList = new List <ListViewItem>();
                foreach (var item in _optAttrDTOList)
                {
                    lviList.Add(new ListViewItem(new string[] { item.Name, item.Value, item.AttrSyntaxDTO.Type })
                    {
                        Tag = optlvg.Tag, Group = optlvg, BackColor = Color.WhiteSmoke
                    });
                }
                listViewProp.Items.AddRange(lviList.ToArray());
            });
        }
Пример #4
0
        private void ShowOperationalAttribute()
        {
            if (_serverDTO == null || _serverDTO.Connection == null)
            {
                MMCDlgHelper.ShowWarning(VMDirConstants.WRN_RELOGIN);
                return;
            }
            MiscUtilsService.CheckedExec(delegate
            {
                if (_oprAttrDTOList.Count <= 0)
                {
                    GetOperationalAttribute();
                }
                var oprlvg = new ListViewGroup("Operational Attributes")
                {
                    Tag = GroupTag.OPERATIONAL_ATT
                };
                this.listViewProp.Groups.Insert(0, oprlvg);

                var lviList = new List <ListViewItem>();
                foreach (var item in _oprAttrDTOList)
                {
                    var val = item.Value;
                    if (string.Equals(item.AttrSyntaxDTO.Type, "Generalized Time"))
                    {
                        val = VmdirUtil.Utilities.ConvertGeneralizedTimeIntoReadableFormat(item.Value);
                    }
                    lviList.Add(new ListViewItem(new string[] { item.Name, val, item.AttrSyntaxDTO.Type })
                    {
                        Tag = oprlvg.Tag, Group = oprlvg, BackColor = Color.WhiteSmoke
                    });
                }
                listViewProp.Items.AddRange(lviList.ToArray());
            });
        }
Пример #5
0
 private void GetPage()
 {
     MiscUtilsService.CheckedExec(delegate
     {
         var _lst = new List <DirectoryExpandableNode>();
         ServerDTO.Connection.PagedSearch(_qdto, ServerDTO.PageSize, _cookie, _morePages,
                                          delegate(ILdapMessage ldMsg, IntPtr ck, bool moreP, List <ILdapEntry> entries)
         {
             _cookie      = ck;
             _morePages   = moreP;
             _totalCount += entries.Count();
             _pageNumber++;
             foreach (var entry in entries)
             {
                 var ocList = new List <string>(entry.getAttributeValues(VMDirConstants.ATTR_OBJECT_CLASS).Select(x => x.StringValue).ToArray());
                 _lst.Add(new DirectoryExpandableNode(entry.getDN(), ocList, ServerDTO, PropertiesCtl));
             }
         });
         if (!_morePages)
         {
             this.Text = Cn;
         }
         this.Nodes.AddRange(_lst.ToArray());
     });
 }
Пример #6
0
        void Bind()
        {
            this.Text = "New " + _objectClass;
            var requiredProps = _serverDTO.Connection.SchemaManager.GetRequiredAttributesWithContentRules(_objectClass);

            _properties = new KeyValueBag();
            foreach (var prop in requiredProps)
            {
                var val  = MiscUtilsService.GetInstanceFromType(prop.Type);
                var item = new VMDirBagItem {
                    Value = val, Description = prop.Description, IsRequired = true, IsReadOnly = prop.ReadOnly
                };
                _properties.Add(prop.Name, item);
            }
            var oc = _properties["objectClass"];

            oc.IsReadOnly = true;
            oc.Value      = _objectClass;

            VMDirBagItem itemCN = null;

            if (!_properties.TryGetValue("cn", out itemCN))
            {
                _properties.Add("cn", new VMDirBagItem {
                    Value = "", Description = "", IsRequired = true
                });
            }

            props.SelectedObject = _properties;
        }
Пример #7
0
        private void btnManageAttributes_Click(object sender, EventArgs e)
        {
            var optionalProps = GetCurrentOptionalProperties();
            var frm           = new AddOrRemoveAttributes(_objectClass, optionalProps, _serverDTO);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                var retainList = frm.NewOptionalAttributes.Intersect(optionalProps);
                var removeList = optionalProps.Except(retainList).ToList();
                foreach (var item in removeList)
                {
                    _properties.Remove(item.Key);
                }
                var addList = frm.NewOptionalAttributes.Except(retainList);
                foreach (var item in addList)
                {
                    var dto = _serverDTO.Connection.SchemaManager.GetAttributeType(item.Key);
                    var val = MiscUtilsService.GetInstanceFromType(dto.Type);
                    _properties.Add(item.Key, new VMDirBagItem {
                        Description = dto.Description, IsReadOnly = dto.ReadOnly, Value = val
                    });
                }
                props.Refresh();
            }
        }
Пример #8
0
        private void buttonExport_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }
            MiscUtilsService.CheckedExec(delegate()
            {
                StringBuilder sb = new StringBuilder();
                var start        = 0;
                var end          = _result.Count();
                if (comboBoxScope.SelectedIndex == (int)ExportScope.CURR_PAGE)
                {
                    start = (_currPage - 1) * _pageSize;
                    end   = _currPage * _pageSize > _result.Count ? _result.Count : _currPage * _pageSize;
                }
                HashSet <string> attrToExport = new HashSet <string>();
                if (checkBoxAttToExport.CheckState == CheckState.Checked)
                {
                    foreach (var item in _attrList)
                    {
                        attrToExport.Add(item);
                    }
                }
                else
                {
                    foreach (ListViewItem item in listViewAttrToExport.Items)
                    {
                        attrToExport.Add(item.SubItems[0].Text);
                    }
                }

                foreach (var item in attrToExport)
                {
                    sb.Append(item + ",");
                }
                sb.Append(Environment.NewLine);
                for (var i = start; i < end; i++)
                {
                    foreach (var item in attrToExport)
                    {
                        sb.Append("\"");
                        if (_result[i].NodeProperties.ContainsKey(item))
                        {
                            foreach (var val in _result[i].NodeProperties[item].Values)
                            {
                                sb.Append(val.StringValue + " ");
                            }
                        }
                        sb.Append("\"");
                        sb.Append(",");
                    }
                    sb.Append(Environment.NewLine);
                }
                if (MMCMiscUtil.SaveDataToFile(sb.ToString(), "Export Result", MMCUIConstants.CSV_FILTER))
                {
                    MMCDlgHelper.ShowInformation(VMDirConstants.STAT_RES_EXPO_SUCC);
                }
            });
        }
Пример #9
0
        bool DoValidate()
        {
            var requiredPropsNotFilled = _properties.Where(x =>
            {
                var val = x.Value;
                if (val.IsRequired)
                {
                    if (val.Value == null)
                    {
                        return(true);
                    }
                    if (val.Value is string)
                    {
                        return(string.IsNullOrEmpty(val.Value as string));
                    }
                    else if (val.Value is List <string> )
                    {
                        return((val.Value as List <string>).Count == 0);
                    }
                }
                return(false);
            });

            if (requiredPropsNotFilled.Count() > 0)
            {
                string error = string.Format("{0} is a required property", requiredPropsNotFilled.First().Key);
                MiscUtilsService.ShowError(error);
                return(false);
            }
            return(true);
        }
Пример #10
0
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     MiscUtilsService.CheckedExec(delegate
     {
         Process.Start(e.Link.LinkData as string);
     });
 }
Пример #11
0
 private void GetDomainFunctionalLevel()
 {
     try
     {
         var domainFucntionalLevel = string.Empty;
         var serverNode            = _formView.ScopeNode as ServerNode;
         if (serverNode != null)
         {
             var dto = serverNode.Hosts.FirstOrDefault(x => x.NodeType == NodeType.Infrastructure && x.Active);
             if (dto != null)
             {
                 if (serverNode.ServerDto != null)
                 {
                     var serverDto = new ServerDto {
                         Server = dto.Name, Upn = serverNode.ServerDto.Upn, Password = serverNode.ServerDto.Password, DomainName = serverNode.ServerDto.DomainName
                     };
                     domainFucntionalLevel = PscHighAvailabilityAppEnvironment.Instance.Service.GetDomainFunctionalLevel(serverDto);
                 }
             }
         }
         txtDomainFunctionalLevel.Text = domainFucntionalLevel;
     }
     catch (Exception exc)
     {
         var custom = new CustomExceptionExtractor().GetCustomMessage(exc);
         PscHighAvailabilityAppEnvironment.Instance.Logger.LogException(exc, custom);
         MiscUtilsService.ShowError(exc);
     }
 }
Пример #12
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            MiscUtilsService.CheckedExec(delegate
            {
                if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0)
                {
                    var attr = listView1.SelectedItems[0].Text;
                    var val  = listView1.SelectedItems[0].SubItems[1].Text;
                    if (!String.Equals(attr, "objectClass", StringComparison.OrdinalIgnoreCase))
                    {
                        var frm = new EditAttribute(attr, val);
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            listView1.SelectedItems[0].SubItems[1].Text = frm.value;
                            int indx = listView1.SelectedIndices[0];
                            _kvData.RemoveAt(indx);

                            if (string.IsNullOrWhiteSpace(frm.value))
                            {
                                _kvData.Insert(indx, new KeyValuePair <string, string>(attr, null));
                            }
                            else
                            {
                                _kvData.Insert(indx, new KeyValuePair <string, string>(attr, frm.value));
                            }
                            this._pendingMods.Add(attr);
                            _parent.Dirty = true;
                        }
                    }
                }
            });
        }
Пример #13
0
 private void btnManageAttributes_Click(object sender, EventArgs e)
 {
     MiscUtilsService.CheckedExec(delegate
     {
         var optionalProps = GetCurrentOptionalProperties();
         if (!_properties.ContainsKey("objectClass"))
         {
             throw new Exception(VMDirConstants.UNABLE_TO_FETCH_DATA);
         }
         var oc    = _properties["objectClass"].Value;
         string cn = "";
         if (oc is string)
         {
             cn = oc.ToString();
         }
         else if (oc is LdapValue[])
         {
             LdapValue[] val = oc as LdapValue[];
             cn = val[(val.Count() - 1)].StringValue;
         }
         var frm = new AddOrRemoveAttributes(cn, optionalProps, ServerDTO);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             foreach (var item in frm.NewOptionalAttributes)
             {
                 _kvData.Add(new KeyValuePair <string, string>(item.Key, null));
             }
             RefreshView();
         }
     });
 }
Пример #14
0
 private void GetOptionalAttribute()
 {
     MiscUtilsService.CheckedExec(delegate
     {
         if (string.IsNullOrWhiteSpace(_objectClass))
         {
             _objectClass = VmdirUtil.Utilities.GetAttrLastVal(_properties, VMDirConstants.ATTR_OBJECT_CLASS);
         }
         _mayAttrTyDTOList.Clear();
         _mayAttrTyDTOList = _serverDTO.Connection.SchemaManager.GetOptionalAttributes(_objectClass);
         _optAttrDTOList.Clear();
         foreach (var item in _mayAttrTyDTOList)
         {
             if (item != null)
             {
                 _optAttrDTOList.Add(new AttributeDTO(item.Name, string.Empty, item));
             }
         }
         foreach (var item in _currAttrDTOList)
         {
             if (item.AttrSyntaxDTO.SingleValue)
             {
                 _optAttrDTOList.RemoveAll(x => x.Name.Equals(item.Name));
             }
         }
         _optAttrDTOList.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.InvariantCultureIgnoreCase));
     });
 }
Пример #15
0
        void CreateSelfSignedCert()
        {
            try
            {
/*                var dto = new CertRequestDTO();
 *              var frm = new GenericInputForm("Fill Certificate Request", "Create", dto);
 *              frm.ApplyDelegate = ApproveCertRequestHandler;
 *              if (frm.ShowDialog() != DialogResult.OK)
 *                  return;
 *              IntPtr cert = new IntPtr();
 *
 *              UInt32 result = VMCAClientWrapper.VMCACreateSelfSignedCertificate(dto.GetRequestData(), dto.PrivateKey, null, dto.NotBefore.ToTime_t(), dto.NotAfter.ToTime_t(), out cert);
 *              MiscUtilsService.CheckStatus("CreateSelfSignedCert", result);
 *
 *              var certString = Marshal.PtrToStringAnsi(cert);
 *              var crt = new X509Certificate2(ASCIIEncoding.ASCII.GetBytes(certString));
 *              X509Certificate2UI.DisplayCertificate(crt);
 *
 *              VMCAClientWrapper.VMCAFreeCertificate(cert);*/
            }
            catch (Exception exp)
            {
                MiscUtilsService.ShowError(exp);
            }
        }
Пример #16
0
 private void buttonBrowse_Click(object sender, EventArgs e)
 {
     MiscUtilsService.CheckedExec(delegate()
     {
         var values         = MMCMiscUtil.ReadAllFromFile("Select File", MMCUIConstants.TXT_FILTER);
         this.textBox1.Text = values;
     });
 }
Пример #17
0
 public DirectoryBaseNode(string dn, List <string> oc, VMDirServerDTO serverDTO, PropertiesControl propCtl)
     : base(serverDTO, propCtl)
 {
     this.Dn          = dn;
     this.ObjectClass = oc;
     Cn         = VMDirServerDTO.DN2CN(dn);
     ImageIndex = SelectedImageIndex = MiscUtilsService.GetImgIndx(ObjectClass);
     this.Tag   = "directory";
 }
Пример #18
0
        private async Task OnOkClick()
        {
            try
            {
                btnOK.Enabled = false;
                if (IsValid())
                {
                    if (Server == null)
                    {
                        Server = new ServerDto();
                    }
                    Server.Server   = txtDirectoryServer.Text;
                    Server.Upn      = txtBindUPN.Text;
                    Server.Password = txtPassword.Text;
                    var parts = Server.Upn.Split('@');
                    Server.UserName   = parts[0];
                    Server.DomainName = parts[1];
                    var task = new Task(Connect);
                    task.Start();
                    if (task == await Task.WhenAny(task, Task.Delay(Constants.TopologyTimeout * Constants.MilliSecsMultiplier)))
                    {
                        await task;
                    }

                    if (ManagementDto != null)
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        MiscUtilsService.ShowError(Constants.LoginError, "Error", MessageBoxButtons.OK);
                        btnOK.Enabled = true;
                    }
                }
                else
                {
                    btnOK.Enabled = true;
                }
            }
            catch (AggregateException exc)
            {
                var custom = new CustomExceptionExtractor().GetCustomMessage(exc);
                PscHighAvailabilityAppEnvironment.Instance.Logger.LogException(exc, custom);
                if (exc.InnerExceptions.Count > 0)
                {
                    var msg = exc.InnerExceptions.Select(x => x.Message).Aggregate((x, y) => x + " , " + y);
                    MMCDlgHelper.ShowError(msg);
                }
            }
            catch (Exception exp)
            {
                var custom = new CustomExceptionExtractor().GetCustomMessage(exp);
                PscHighAvailabilityAppEnvironment.Instance.Logger.LogException(exp, custom);
                MiscUtilsService.ShowError(exp);
            }
        }
Пример #19
0
        private void tsAdd_Click(object sender, EventArgs e)
        {
            var attr = _serverDTO.Connection.SchemaManager.GetAttributeType("description");
            var val  = MiscUtilsService.GetInstanceFromType(attr.Type);

            _properties.Add(attr.Name, new VMDirBagItem {
                Value = val, Description = attr.Description
            });
            props.Refresh();
        }
Пример #20
0
        void IFormViewControl.Initialize(FormView parent)
        {
            _formView = (CertDetailsFormView)parent;

            var il = new ImageList();

            il.Images.AddStrip(MiscUtilsService.GetToolbarImage());
            lstCertDetails.SmallImageList = il;

            InitData();
        }
Пример #21
0
 void Bind()
 {
     MiscUtilsService.CheckedExec(delegate
     {
         _properties.Clear();
         VMDir.Common.VMDirUtilities.Utilities.GetItemProperties(_dn, ServerDTO, _properties);
         VMDir.Common.VMDirUtilities.Utilities.RemoveDontShowAttributes(_properties);
         MiscUtilsService.ConvertToKVData(_properties, _kvData);
         RefreshView();
     });
 }
Пример #22
0
        public VMCertStoreSnapIn()
        {
            VMCertStoreSnapInEnvironment.Instance.LoadLocalData();

            var il = new ImageList();

            this.SmallImages.AddStrip(MiscUtilsService.GetToolbarImage());

            this.RootNode = new VMCertStoreRootNode();

            this.RootNode.ImageIndex = this.RootNode.SelectedImageIndex = (int)VMCertStoreImageIndex.VecsStore;
        }
Пример #23
0
        internal void Login()
        {
            this.Nodes.Clear();
            try
            {
                var frm = new frmConnectToServer(ServerDTO);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    if (ServerDTO.Connection.CreateConnection() == 1)
                    {
                        this.Text = ServerDTO.Server;

                        if (string.IsNullOrWhiteSpace(ServerDTO.BaseDN))
                        {
                            TextQueryDTO dto = new TextQueryDTO("", LdapScope.SCOPE_BASE, VMDirConstants.SEARCH_ALL_OC,
                                                                new string[] { VMDirConstants.ATTR_ROOT_DOMAIN_NAMING_CONTEXT }, 0, IntPtr.Zero, 0);
                            try
                            {
                                ServerDTO.Connection.Search(dto,
                                                            delegate(ILdapMessage searchRequest, List <ILdapEntry> entries)
                                {
                                    ServerDTO.BaseDN = GetRootDomainNamingContext(entries);
                                });
                            }
                            catch (Exception)
                            {
                                throw new Exception(VMDirConstants.ERR_DN_RETRIEVAL);
                            }
                        }
                        else
                        {
                            TextQueryDTO dto = new TextQueryDTO(ServerDTO.BaseDN, LdapScope.SCOPE_BASE, VMDirConstants.SEARCH_ALL_OC,
                                                                new string[] { VMDirConstants.ATTR_DN }, 0, IntPtr.Zero, 0);
                            ServerDTO.Connection.Search(dto, null);
                        }
                        this.Nodes.Add(new DirectoryExpandableNode(ServerDTO.BaseDN, new List <string>(), ServerDTO, PropertiesCtl));
                        ServerDTO.IsLoggedIn = true;
                        Expand();
                        DoSelect();
                    }
                    else
                    {
                        throw new Exception(CommonConstants.INVALID_CREDENTIAL);
                    }
                }
            }
            catch (Exception exp)
            {
                ServerDTO.Connection = null;
                VMDirEnvironment.Instance.Logger.LogException(exp);
                MiscUtilsService.ShowError(exp);
            }
        }
Пример #24
0
 public void RefreshDataSource()
 {
     try
     {
         RefreshView();
     }
     catch (Exception exc)
     {
         PscHighAvailabilityAppEnvironment.Instance.Logger.LogException(exc);
         MiscUtilsService.ShowError(exc);
     }
 }
Пример #25
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     try
     {
         RefreshView();
     }
     catch (Exception exc)
     {
         PscHighAvailabilityAppEnvironment.Instance.Logger.LogException(exc);
         MiscUtilsService.ShowError(exc);
     }
 }
Пример #26
0
 public void RefreshDataSource()
 {
     try
     {
         RefreshView();
     }
     catch (Exception exc)
     {
         var custom = new CustomExceptionExtractor().GetCustomMessage(exc);
         PscHighAvailabilityAppEnvironment.Instance.Logger.LogException(exc, custom);
         MiscUtilsService.ShowError(exc);
     }
 }
Пример #27
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     try
     {
         RefreshView();
     }
     catch (Exception exc)
     {
         var custom = new CustomExceptionExtractor().GetCustomMessage(exc);
         PscHighAvailabilityAppEnvironment.Instance.Logger.LogException(exc, custom);
         MiscUtilsService.ShowError(exc);
     }
 }
Пример #28
0
        public void SaveLocalData()
        {
            MiscUtilsService.CheckedExec(delegate
            {
                using (var ms = new MemoryStream())
                {
                    var xmlSerializer = new XmlSerializer(typeof(LocalData));
                    xmlSerializer.Serialize(ms, LWRaftEnvironment.Instance.LocalData);

                    File.WriteAllBytes(StoreFileName, ms.ToArray());
                }
            });
        }
Пример #29
0
        private async Task GetPage()
        {
            resultStatusLabel.Text = VMDirConstants.STAT_SR_FETCHING_PG;
            IntPtr _timeout = Marshal.AllocCoTaskMem(sizeof(int));

            Marshal.WriteInt32(_timeout, VMDirConstants.SEARCH_TIMEOUT_IN_SEC);
            try
            {
                _qdto.TimeOut = _timeout;
                _serverDTO.Connection.PagedSearch(_qdto, _pageSize, _cookie, _morePages,
                                                  delegate(ILdapMessage ldMsg, IntPtr ck, bool moreP, List <ILdapEntry> entries)
                {
                    _cookie      = ck;
                    _morePages   = moreP;
                    _totalCount += entries.Count();
                    _pageNumber++;
                    foreach (var entry in entries)
                    {
                        var ocList          = new List <string>(entry.getAttributeValues(VMDirConstants.ATTR_OBJECT_CLASS).Select(x => x.StringValue).ToArray());
                        var node            = new DirectoryNonExpandableNode(entry.getDN(), ocList, _serverDTO, this.propertiesControl1);
                        node.NodeProperties = _serverDTO.Connection.GetEntryProperties(entry);
                        _result.Add(node);
                    }
                });

                _totalPage = _totalCount / _pageSize;
                if (_totalCount % _pageSize > 0)
                {
                    _totalPage++;
                }

                if (_morePages)
                {
                    resultStatusLabel.Text = VMDirConstants.STAT_SR_MORE_PG;
                }
                else
                {
                    resultStatusLabel.Text = VMDirConstants.STAT_SR_NO_MORE_PG;
                }
            }
            catch (Exception e)
            {
                resultStatusLabel.Text = VMDirConstants.STAT_SR_FAILED_PG;
                VMDirEnvironment.Instance.Logger.LogException(e);
                MiscUtilsService.ShowError(e);
            }
            finally
            {
                Marshal.FreeCoTaskMem(_timeout);
            }
        }
Пример #30
0
        private void tsDelete_Click(object sender, EventArgs e)
        {
            var item = props.SelectedGridItem;

            if ((item.PropertyDescriptor as KeyValuePropertyDescriptor).IsRequired)
            {
                MiscUtilsService.ShowError(item.Label + " is a required attribute and cannot be deleted");
            }
            else
            {
                _properties.Remove(item.Label);
                props.Refresh();
            }
        }