Esempio n. 1
0
        /// <summary>
        /// Describe Module Fields.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public DescribeInfo doDescribe(string name)
        {
            if (!getCheckLogin())
            {
                throw new Exception("Login error.");
            }

            var result = Get("describe", new Dictionary <string, string> {
                { "elementType", name }
            });
            var describeInfo = new DescribeInfo();

            describeInfo.labelFields  = (string)result["labelFields"];
            describeInfo.idPrefix     = (string)result["idPrefix"];
            describeInfo.name         = (string)result["name"];
            describeInfo.deleteable   = (bool)result["deleteable"];
            describeInfo.retrieveable = (bool)result["retrieveable"];
            describeInfo.createable   = (bool)result["createable"];
            describeInfo.label        = (string)result["label"];
            describeInfo.updateable   = (bool)result["updateable"];
            describeInfo.isEntity     = (bool)result["isEntity"];
            describeInfo.information  = result;

            var fields    = result["fields"] as List <object>;
            var fieldDict = new Dictionary <string, DescribeFieldInfo> ();

            foreach (var val in fields)
            {
                var field     = val as Dictionary <string, object>;
                var fieldInfo = new DescribeFieldInfo();

                fieldInfo.mandatory   = (bool)field["mandatory"];
                fieldInfo.name        = (string)field["name"];
                fieldInfo.nullable    = (bool)field["nullable"];
                fieldInfo.editable    = (bool)field["editable"];
                fieldInfo.label       = (string)field["label"];
                fieldInfo.information = field;

                var fieldType = new DescribeTypeInfo();
                var typeInfo  = field["type"] as Dictionary <string, object>;

                fieldType.name        = (string)typeInfo["name"];
                fieldType.information = typeInfo["type"] as Dictionary <string, object>;
                fieldInfo.type        = fieldType;

                fieldDict.Add(fieldInfo.name, fieldInfo);
            }

            describeInfo.fields = fieldDict;
            return(describeInfo);
        }
Esempio n. 2
0
        /// <summary>
        /// Describe Module Fields.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public DescribeInfo doDescribe(string name)
        {
            if (!getCheckLogin())
                throw new Exception("Login error.");

            var result = Get("describe", new Dictionary<string, string>{{"elementType", name}});
            var describeInfo = new DescribeInfo();

            describeInfo.labelFields = (string)result["labelFields"];
            describeInfo.idPrefix   = (string)result["idPrefix"];
            describeInfo.name       = (string)result["name"];
            describeInfo.deleteable = (bool)result["deleteable"];
            describeInfo.retrieveable = (bool)result["retrieveable"];
            describeInfo.createable = (bool)result["createable"];
            describeInfo.label      = (string)result["label"];
            describeInfo.updateable = (bool)result["updateable"];
            describeInfo.isEntity   = (bool)result["isEntity"];
            describeInfo.information = result;

            var fields = result["fields"] as List<object>;
            var fieldDict = new Dictionary<string, DescribeFieldInfo> ();

            foreach(var val in fields)
            {
                var field = val as Dictionary<string, object>;
                var fieldInfo = new DescribeFieldInfo();

                fieldInfo.mandatory = (bool)field["mandatory"];
                fieldInfo.name = (string)field["name"];
                fieldInfo.nullable = (bool)field["nullable"];
                fieldInfo.editable = (bool)field["editable"];
                fieldInfo.label = (string)field["label"];
                fieldInfo.information = field;

                var fieldType = new DescribeTypeInfo();
                var typeInfo = field["type"] as Dictionary<string, object>;

                fieldType.name = (string)typeInfo["name"];
                fieldType.information = typeInfo["type"] as Dictionary<string, object>;
                fieldInfo.type = fieldType;

                fieldDict.Add(fieldInfo.name, fieldInfo);
            }

            describeInfo.fields = fieldDict;
            return describeInfo;
        }