Пример #1
0
        public ReferenceDataEntity GetOptionsByStyleId(string styleId)
        {
            EventLogEntryType eventLogType = EventLogEntryType.Information;

            try
            {
                var baseUrl    = ConfigurationManager.AppSettings["getOptions"];
                var requestUri = string.Format(baseUrl, styleId);
                _logger.AppendMessages(string.Format("GetOptionsByStyleId using URI {0}.", requestUri));
                var jsonResult = RestClient.GetData(requestUri);
                _logger.AppendMessages("Successfully got data from API - GetOptionsBySytleId.");
                var result = new ReferenceDataEntity
                {
                    Colors  = GetColorReferenceEntities(jsonResult),
                    Options = GetOptionsListByParsingJson(jsonResult)
                };
                return(result);
            }
            catch (Exception ex)
            {
                eventLogType = EventLogEntryType.Error;
                _logger.AppendMessages(string.Format("Error in GetOptionsByStyleId.", ex.Message));
            }
            finally
            {
                _logger.LogAppendedMessages(eventLogType);
            }

            return(null);
        }
Пример #2
0
        public ReferenceDataEntity GetOptionsByStyleId(string styleId)
        {
            EventLogEntryType eventLogType = EventLogEntryType.Information;
            try
            {
                var baseUrl = ConfigurationManager.AppSettings["getOptions"];
                var requestUri = string.Format(baseUrl, styleId);
                _logger.AppendMessages(string.Format("GetOptionsByStyleId using URI {0}.", requestUri));
                var jsonResult = RestClient.GetData(requestUri);
                _logger.AppendMessages("Successfully got data from API - GetOptionsBySytleId.");
                var result = new ReferenceDataEntity
                {
                    Colors = GetColorReferenceEntities(jsonResult),
                    Options = GetOptionsListByParsingJson(jsonResult)
                };
                return result;
            }
            catch (Exception ex)
            {
                eventLogType = EventLogEntryType.Error;
                _logger.AppendMessages(string.Format("Error in GetOptionsByStyleId.", ex.Message));
            }
            finally
            {
                _logger.LogAppendedMessages(eventLogType);
            }

            return null;
        }