コード例 #1
0
        public async Task <EngineeringItem> GetEngineeringItemDetails(string _engineeringItemId)
        {
            Dictionary <string, string> queryParams = new Dictionary <string, string>();

            queryParams.Add("$mask", "dsmveng:EngItemMask.Details");

            string searchResource = string.Format("{0}/{1}", GetBaseResource(), _engineeringItemId);

            IRestResponse requestResponse = await GetAsync(searchResource, queryParams);

            if (requestResponse.StatusCode != System.Net.HttpStatusCode.OK)
            {
                //handle according to established exception policy
                throw (new EngineeringResponseException(requestResponse));
            }

            NlsLabeledItemSet <EngineeringItem> engItemSet = JsonConvert.DeserializeObject <NlsLabeledItemSet <EngineeringItem> >(requestResponse.Content);

            if ((engItemSet != null) && (engItemSet.totalItems == 1))
            {
                return(engItemSet.member[0]);
            }

            return(null);
        }
コード例 #2
0
        //This extension gets the Enabled Criteria and Configuration Contexts of Configured object
        public async Task <EngineeringItemConfigurationDetails> GetConfigurationDetails(string _itemId)
        {
            string getConfigurationDetails = string.Format("{0}/{1}{2}", GetBaseResource(), _itemId, CONFIGURED);

            Dictionary <string, string> queryParams = new Dictionary <string, string>();

            queryParams.Add("$mask", "dsmvcfg:ConfiguredDetails");

            IRestResponse requestResponse = await GetAsync(getConfigurationDetails, queryParams);

            if (requestResponse.StatusCode != System.Net.HttpStatusCode.OK)
            {
                //handle according to established exception policy
                throw (new EngineeringResponseException(requestResponse));
            }

            NlsLabeledItemSet <EngineeringItemConfigurationDetails> configurationSet = JsonConvert.DeserializeObject <NlsLabeledItemSet <EngineeringItemConfigurationDetails> >(requestResponse.Content);

            if ((configurationSet != null) && (configurationSet.totalItems == 1))
            {
                return(configurationSet.member[0]);
            }

            return(null);
        }