Exemple #1
0
        public static AssetsViewModel GetCatalogMappingsForAccountItemIDAndDescription(string catalogId)
        {
            var ret = new AssetsViewModel();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user      = FormsAuthenticationWrapper.User;
                        var     idRequest = new GetCatalogMappingFromResonanceFieldRequest
                        {
                            CatalogID      = catalogId,
                            User           = user,
                            ResonanceField = "AccountItemID"
                        };
                        var idResponse = _certonaService.GetCatalogMappingFromResonanceField(idRequest);
                        ret.AccountItemIDMapping = idResponse.Success ? !String.IsNullOrWhiteSpace(idResponse.CatalogMapping) ? idResponse.CatalogMapping : "AccountItemID" : "AccountItemID";

                        var descriptionRequest = new GetCatalogMappingFromResonanceFieldRequest
                        {
                            CatalogID      = catalogId,
                            User           = user,
                            ResonanceField = "Description"
                        };
                        var descriptionResponse = _certonaService.GetCatalogMappingFromResonanceField(descriptionRequest);
                        ret.DescriptionMapping = idResponse.Success ? !String.IsNullOrWhiteSpace(descriptionResponse.CatalogMapping) ? descriptionResponse.CatalogMapping : "AccountItemID" : "AccountItemID";
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(ret);
        }