private void AddAttributeType(string name, Dictionary <string, object> dict)
        {
            var dto = new AttributeTypeDTO {
                Name = name
            };

            dto.Description = dict["DESC"] as string;
            if (dto.Description == null)
            {
                dto.Description = "";
            }

            dto.AttributeSyntax = dict["SYNTAX"] as string;

            if (VMDirCommonEnvironment.Instance.SyntaxDefs != null)
            {
                var syntax = VMDirCommonEnvironment.Instance.SyntaxDefs[dto.AttributeSyntax];
                if (syntax == null)
                {
                    dto.Type = "System.String";
                }
                else
                {
                    dto.Type = syntax.Name;
                }
                dto.SingleValue = (bool)dict["SINGLE-VALUE"];
                _data[name]     = dto;
            }
        }
        private void AddAttributeType (string name, Dictionary<string, object> dict)
        {
            var dto = new AttributeTypeDTO { Name = name };
            dto.Description = dict ["DESC"] as string;
            if (dto.Description == null)
                dto.Description = "";

            string syntaxString = dict ["SYNTAX"] as string;
            dto.Length = GetTypeLength (syntaxString);
            if (dto.Length > 0) {
                string lengthString = "{" + dto.Length + "}";
                syntaxString = syntaxString.Replace (lengthString, "");
            }
            if (VMDirCommonEnvironment.Instance.SyntaxDefs != null) {
                var syntax = VMDirCommonEnvironment.Instance.SyntaxDefs [syntaxString];
                if (syntax == null) {
                    dto.Type = "System.String";
                    dto.SyntaxName = "Unknown";
                } else {
                    dto.Type = syntax.Type;
                    dto.SyntaxName = syntax.Name;
                }
                dto.ReadOnly = (bool)dict ["NO-USER-MODIFICATION"];
                dto.SingleValue = (bool)dict ["SINGLE-VALUE"];
                _data [name] = dto;
            }
        }
예제 #3
0
        public AttributeTypeDTO GetAttributeType(string key)
        {
            if (key == null)
            {
                return(null);
            }
            AttributeTypeDTO dto = null;

            _attributeTypes.Data.TryGetValue(key, out dto);
            return(dto);
        }
예제 #4
0
        public bool isSingleValue(string key)

        {
            AttributeTypeDTO attrSynSTO = GetAttributeType(key);

            if (attrSynSTO != null)
            {
                return(attrSynSTO.SingleValue);
            }

            else
            {
                return(false);
            }
        }
        private void AddAttributeTypeDTO(Dictionary <string, Dictionary <string, object> > dict)

        {
            foreach (var key in dict.Keys)

            {
                var dto = new AttributeTypeDTO

                {
                    Name = key
                };

                Dictionary <string, object> attributes = dict[key];

                LdapValue[] val;

                val = Utilities.FetchLdapValueFromAttributesDictionary(AttributeDescription, attributes);

                dto.Description = val != null ? val[0].StringValue : string.Empty;

                val = Utilities.FetchLdapValueFromAttributesDictionary(AttributeSyntax, attributes);

                dto.AttributeSyntax = val != null ? val[0].StringValue : string.Empty;

                dto.Type = "System.String";

                var syntax = VMDirCommonEnvironment.Instance.SyntaxDefs[dto.AttributeSyntax];

                if (syntax != null)
                {
                    dto.Type = syntax.Name;
                }

                val = Utilities.FetchLdapValueFromAttributesDictionary(AttributeSingleValued, attributes);

                dto.SingleValue = val != null?Convert.ToBoolean(val[0].StringValue) : true;

                val = Utilities.FetchLdapValueFromAttributesDictionary(AttributeID, attributes);

                dto.AttributeID = val != null ? val[0].StringValue : string.Empty;

                val = Utilities.FetchLdapValueFromAttributesDictionary(ObjectClass, attributes);

                dto.ObjectClass = val != null?val.Select(data => data.StringValue).ToList() : null;

                _data[key] = dto;
            }
        }
예제 #6
0
        private void AddAttributeType(string name, Dictionary <string, object> dict)
        {
            var dto = new AttributeTypeDTO {
                Name = name
            };

            dto.Description = dict ["DESC"] as string;
            if (dto.Description == null)
            {
                dto.Description = "";
            }

            string syntaxString = dict ["SYNTAX"] as string;

            dto.Length = GetTypeLength(syntaxString);
            if (dto.Length > 0)
            {
                string lengthString = "{" + dto.Length + "}";
                syntaxString = syntaxString.Replace(lengthString, "");
            }
            if (VMDirCommonEnvironment.Instance.SyntaxDefs != null)
            {
                var syntax = VMDirCommonEnvironment.Instance.SyntaxDefs [syntaxString];
                if (syntax == null)
                {
                    dto.Type       = "System.String";
                    dto.SyntaxName = "Unknown";
                }
                else
                {
                    dto.Type       = syntax.Type;
                    dto.SyntaxName = syntax.Name;
                }
                dto.ReadOnly    = (bool)dict ["NO-USER-MODIFICATION"];
                dto.SingleValue = (bool)dict ["SINGLE-VALUE"];
                _data [name]    = dto;
            }
        }