public void AssociateAssetCustomer(List <string> assetUIDs) { List <Guid> Asset = new List <Guid>(); Asset = assetUIDs.Select(a => Guid.Parse(a)).ToList(); for (int i = 0; i < assetUIDs.Count; i++) { Guid assetuid = Asset.ElementAt(i); associateAssetCustomer = new AssociateAssetCustomer { CustomerUID = Guid.Parse(CustomerUID), AssetUID = assetuid, RelationType = "Customer", ActionUTC = DateTime.Now, ReceivedUTC = DateTime.Now }; } }
public void AssociateAssetCustomer() { associateAssetCustomer = new AssociateAssetCustomer { CustomerUID = CustomerUID, AssetUID = CreateAsset.AssetUID, RelationType = "Customer", ActionUTC = DateTime.Now, ReceivedUTC = DateTime.Now }; var requestString = JsonConvert.SerializeObject(associateAssetCustomer); try { GetToken(true); var response = RestClientUtil.DoHttpRequest("https://api-stg.trimble.com/t/trimble.com/vss-dev-customerservice/1.0/AssociateCustomerAsset", HeaderSettings.PostMethod, AccessToken, HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType, null); } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Exception Occured while associating asset to device" + "AssetUID-" + CreateAsset.AssetUID + "Customer-" + associateAssetCustomer.CustomerUID); throw new Exception("Exception Occured while associating asset to device" + "AssetUID-" + CreateAsset.AssetUID + "Customer-" + associateAssetCustomer.CustomerUID); } }
public void AssociateAssetCustomer(List <string> AssetUIDs = null) { try { List <Guid> Asset = new List <Guid>(); Asset = AssetUIDs.Select(a => Guid.Parse(a)).ToList(); for (int i = 0; i < AssetUIDs.Count; i++) { Guid assetuid = Asset.ElementAt(i); associateAssetCustomer = new AssociateAssetCustomer { CustomerUID = Guid.Parse(CustomerUID), AssetUID = assetuid, RelationType = "Customer", ActionUTC = DateTime.Now, ReceivedUTC = DateTime.Now }; } } catch (Exception e) { LogResult.Report(Log, "log_ForError", "Got Error While DeSerializing JSON Object", e); } }