Exemple #1
0
        public static ReportsViewModel GetSegments(string applicationId)
        {
            var model = new ReportsViewModel();

            model.Segments = new List <string>();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user = FormsAuthenticationWrapper.User;


                        var getRequest = new GetApplicationSegmentsRequest()
                        {
                            ApplicationID = applicationId, User = user
                        };
                        var getResponse = _certonaService.GetApplicationSegments(getRequest);
                        if (getResponse.Success && getResponse.Segments != null && getResponse.Segments.Count > 0)
                        {
                            foreach (var name in getResponse.Segments)
                            {
                                model.Segments.Add(name);
                            }
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                _certonaService.Abort();
                throw;
            }

            return(model);
        }