예제 #1
0
파일: Utils.cs 프로젝트: fujie/apiserver
        // for single value
        public void AddCSEntryAttribute(AttributeType _attributeType, CSEntryChange _csentry, string _attributeName, object _attributeValue)
        {
            try
            {
                switch (_attributeType)
                {
                case AttributeType.String:
                    _csentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(_attributeName, _attributeValue.ToString()));
                    break;

                case AttributeType.Boolean:
                    _csentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(_attributeName, System.Convert.ToBoolean(_attributeValue.ToString())));
                    break;

                case AttributeType.Integer:
                    _csentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(_attributeName, System.Convert.ToInt64(_attributeValue.ToString())));
                    break;

                default:
                    throw new ExtensionException("Unsupported attribute type : " + _attributeType.GetTypeCode().ToString());
                }
            }
            catch (Exception ex)
            {
                throw new ExtensibleExtensionException("Exception in AddCSEntryAttribute", ex);
            }
        }
예제 #2
0
파일: Utils.cs 프로젝트: fujie/apiserver
        // Add attribute to CS entry
        // for multi value
        public void AddCSEntryAttribute(AttributeType _attributeType, CSEntryChange _csentry, string _attributeName, List <object> _attributeValueList)
        {
            try
            {
                switch (_attributeType)
                {
                case AttributeType.String:
                    _csentry.AttributeChanges.Add(AttributeChange.CreateAttributeAdd(_attributeName, _attributeValueList));
                    break;

                default:
                    throw new ExtensionException("Unsupported attribute type for multiple value : " + _attributeType.GetTypeCode().ToString());
                }
            }
            catch (Exception ex)
            {
                throw new ExtensibleExtensionException("Exception in AddCSEntryAttribute", ex);
            }
        }