コード例 #1
0
        public IEnumerable <LazyObjects.AFAttributeTemplate> GetChildAttributeTemplates(LazyPI.Common.Connection Connection, string AttrTempID)
        {
            WebAPIConnection webConnection = (WebAPIConnection)Connection;
            var request = new RestRequest("/attributetemplates/{webId}/attributetemplates");

            request.AddUrlSegment("webId", AttrTempID);

            var response = webConnection.Client.Execute <ResponseModels.ResponseList <ResponseModels.AFAttributeTemplate> >(request);

            if (response.ErrorException != null)
            {
                throw new ApplicationException("Error finding attribute template children. (See Inner Details)", response.ErrorException);
            }

            var data = response.Data;
            List <LazyObjects.AFAttributeTemplate> templateList = new List <LazyObjects.AFAttributeTemplate>();

            foreach (var template in data.Items)
            {
                LazyObjects.AFAttributeTemplate attrTemplate = new Lazyobject.AFAttributeTemplate(Connection, template.WebId, template.Id, template.Name, template.Description, template.Path);
                templateList.Add(attrTemplate);
            }

            return(templateList);
        }
コード例 #2
0
        public IEnumerable<LazyObjects.AFAttributeTemplate> GetAttributeTemplates(LazyPI.Common.Connection Connection, string ElementID)
        {
            WebAPIConnection webConnection = (WebAPIConnection)Connection;
            var request = new RestRequest("/elementtemplates/{webId}/attributetemplates");
            request.AddUrlSegment("webId", ElementID);

            var response = webConnection.Client.Execute<ResponseModels.ResponseList<ResponseModels.AFAttributeTemplate>>(request);

            if (response.ErrorException != null)
            {
                throw new ApplicationException("Error finding element templates for element. (See Inner Details)", response.ErrorException);
            }

            var data = response.Data;

            List<LazyObjects.AFAttributeTemplate> results = new List<LazyObjects.AFAttributeTemplate>();

            foreach (var template in data.Items)
            {
                LazyObjects.AFAttributeTemplate attr = new LazyObjects.AFAttributeTemplate(Connection, template.WebID, template.Name, template.Description, template.Path);
                results.Add(attr);
            }

            return results;
        }