public List<BusinessObjects.WorkManagement.Asset> SearchForAsset(int assetID, bool includeChildAssets, bool includeMeasurements) { List<BusinessObjects.WorkManagement.Asset> assets = null; CorporateData.ExternalDataServiceClient serviceProxy = new CorporateData.ExternalDataServiceClient(); CorporateData.AssetSearchCriteria criteria = new CorporateData.AssetSearchCriteria(); criteria.ID = assetID; criteria.IncludeMeasurementHistory = includeMeasurements; criteria.IncludeLocation = true; assets = serviceProxy.SearchAssets(criteria); serviceProxy.Close(); if (includeChildAssets) { if (assets != null && assets.Count == 1 && assets[0].Groups != null) { BusinessObjects.WorkManagement.Asset parentAsset = assets[0]; List<BusinessObjects.WorkManagement.Asset> childAssets = new List<BusinessObjects.WorkManagement.Asset>(); for (int index = 0; index < parentAsset.Groups.Count; index++) { if (parentAsset.Groups[index].Assets != null) { for (int assetIndex = 0; assetIndex < parentAsset.Groups[index].Assets.Count; assetIndex++) { childAssets.Add(parentAsset.Groups[index].Assets[assetIndex]); } } } // Return childAssets if such are present assets = childAssets; } } return assets; }
public int SaveCustomer(BusinessObjects.WorkManagement.Customer customer, string userID) { List<int> customerIDs = null; CorporateData.ExternalDataServiceClient serviceProxy = new CorporateData.ExternalDataServiceClient(); customerIDs = serviceProxy.UploadCustomerData(customer, userID); serviceProxy.Close(); if (customerIDs != null && customerIDs.Count > 0) { return customerIDs[0]; } return 0; }
public BusinessObjects.WorkManagement.StockItemCollection QueryStock(int materialID) { List<BusinessObjects.WorkManagement.Stock> stockContainer = null; CorporateData.ExternalDataServiceClient serviceProxy = new CorporateData.ExternalDataServiceClient(); stockContainer = serviceProxy.SearchStock(string.Empty, materialID, 0, null); serviceProxy.Close(); if (stockContainer[0].StockItems != null) { return stockContainer[0].StockItems; } return new BusinessObjects.WorkManagement.StockItemCollection(); }
public CorporateData.AssetCollection SaveAsset(CorporateData.AssetUpdate assetUpdate) { CorporateData.AssetCollection assets = null; CorporateData.ExternalDataServiceClient serviceProxy = new CorporateData.ExternalDataServiceClient(); assets = serviceProxy.UploadAssetData(assetUpdate); serviceProxy.Close(); return assets; }