예제 #1
0
        public AssetStatus GetAssetStatusTemplate2(EST_HWAssetStatus assetStatus)
        {
            var id        = "6b7304c4-1b09-bffc-3fe3-1cfd3eb630cb";
            var itemFiler = EST_HWAssetStatus.NewItem.ToDescriptionString();
            var flatten   = true;

            var queryFilter = string.Format("?id={0}&itemFilter={1}&Flatten={2}",
                                            id, itemFiler, flatten);
            var queryResult = _bamclient._client.GetAsync("api/V3/Enum/GetList" + queryFilter).Result;

            var resultSring = queryResult.Content.ReadAsStringAsync().Result;

            var resultTemp = JsonConvert.DeserializeObject <List <AssetStatus> >(resultSring);
            var result     = new BAM_AssetStatusList()
            {
                AssetStatuses = resultTemp.OrderBy(x => x.Name).ToList()
            };
            var newItem = result.AssetStatuses.Where(x => x.Name == assetStatus.ToDescriptionString()).FirstOrDefault();

            return(newItem);
        }
예제 #2
0
        public HardwareTemplate_Full SetHardwareAssetStatus(HardwareTemplate_Full template, EST_HWAssetStatus hWAssetStatus)
        {
            if (template == null)
            {
                throw new Exception("Template must not be null");
            }

            // Clone the object so we can check the changes
            var newHardwareAsset = CloneObject.Clone(template);

            newHardwareAsset.HardwareAssetStatus = _assetStatusService.HardwareAssetStatusList.FirstOrDefault(x => x.Name == hWAssetStatus.ToDescriptionString());
            return(newHardwareAsset);
        }