Exemplo n.º 1
0
        private static void PopulateAssetType(IEnumerable <Asset> resultValues)
        {
            List <Asset> assetlist = new List <Asset>();

            foreach (var item in resultValues)
            {
                var assettypeValue = RestServiceHelper.GetAssetType(item.AssetType);

                item.AssetTypeValue = string.Empty;
                if (assettypeValue != null)
                {
                    item.AssetTypeValue = assettypeValue.AssetType1;
                }

                var assetsubtypeValue = RestServiceHelper.GetAssetSubType(item.AssetType, item.AssetSubType);

                item.AssetSubTypeValue = string.Empty;
                if (assetsubtypeValue != null)
                {
                    item.AssetSubTypeValue = assetsubtypeValue.AssetSubType1;
                }

                assetlist.Add(item);
            }
        }
Exemplo n.º 2
0
        private IEnumerable <Asset> GetAssetsByClient(string clientId)
        {
            List <Asset> assetlist = new List <Asset>();

            if (string.IsNullOrWhiteSpace(clientId))
            {
                //ShowOnUIThread("Getting assets for All clients...");

                Dictionary <string, IEnumerable <Asset> > result = RestServiceHelper.InvokeGetByClientAsync().Result;
                foreach (var resultValue in result.Values)
                {
                    assetlist.AddRange(resultValue);
                }

                //ShowOnUIThread("Number of assets for all clients is " + assets.Count);
            }
            else
            {
                //ShowOnUIThread("Getting assets for client '" + clientId + "'...");
                var result = RestServiceHelper.InvokeGetByClientAsync(clientId).Result;
                if (result.ContainsKey(clientId))
                {
                    assetlist.AddRange(result[clientId]);
                }

                //ShowOnUIThread("Number of assets for client '" + clientId + "' is " + assetlist.Count);
            }

            return(assetlist);
        }
Exemplo n.º 3
0
        public static AssetType GetAssetType(int assetTypeId)
        {
            if (!RestServiceHelper.AssetTypes.Any())
            {
                RestServiceHelper.PopulateAssetTypesSubTypesAsync().Wait();
            }

            return(RestServiceHelper.AssetTypes.Where(type => type.AssetTypeID == assetTypeId).FirstOrDefault());
        }