예제 #1
0
        private WildcardMatches ValidateWildcardMatches(string assetIDContains, string snContains)
        {
            WildcardMatches wilcardMatches = null;

            if (assetIDContains != null || snContains != null)
            {
                wilcardMatches = new WildcardMatches
                {
                    AssetIDContains = assetIDContains,
                    SNContains      = snContains
                }
            }
            ;
            return(wilcardMatches);
        }
예제 #2
0
        private Guid[] GetAssetUIDsFromFilters(Guid userUid, Guid?accountSelectionUid, Guid?customerGuid,
                                               string[] assetType, string[] assetStatus, string[] manufacturer, string[] model,
                                               WildcardMatches wildcardMatches,
                                               int pageSize, int pageNumber)
        {
            try
            {
                var query = new AssetFleetQueryParameters
                {
                    UserUID             = userUid,
                    AssetFamilyType     = assetType,
                    AccountSelectionUID = accountSelectionUid,
                    CustomerUID         = customerGuid.HasValue ? new Guid[] { customerGuid.Value } : new Guid[] { },
                    Status       = assetStatus,
                    Manufacturer = manufacturer,
                    Model        = model,
                    Wildcards    = wildcardMatches,
                    PageNo       = pageNumber,
                    PageSize     = pageSize
                };

                var response = _searchAndFilterClient.QueryFleet(query);
                if (!response.AssetUIDs.Any())
                {
                    return(null);
                }

                var assetUIDs = response.AssetUIDs.Distinct();
                return(assetUIDs.ToArray());
            }
            catch (Exception ex)
            {
                _logger.LogError($"{ex.Message}");
                throw;
            }
        }