Exemple #1
0
        public static SchemeExperienceViewModel GetSchemeExperiences(int schemeID)
        {
            SchemeExperienceViewModel vm = new SchemeExperienceViewModel();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user       = FormsAuthenticationWrapper.User;
                        var     getRequest = new GetSchemeExperiencesRequest()
                        {
                            SchemeID = schemeID, User = user
                        };
                        var getResponse = _certonaService.GetSchemeExperiences(getRequest);

                        if (getResponse.Success && getResponse.Experiences != null)
                        {
                            foreach (var dto in getResponse.Experiences)
                            {
                                vm.ContainerID = schemeID;
                                vm.Experiences.Add(new SchemeExperience()
                                {
                                    SchemeID     = schemeID,
                                    ExperienceID = dto.ExperienceID,
                                    Name         = dto.Name,
                                    Description  = dto.Description,
                                    Status       = dto.Status,
                                    Traffic      = dto.Traffic
                                });
                            }
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(vm);
        }