Exemple #1
0
        public static ExperienceBoosts GetExperienceBoosts(int experienceID)
        {
            ExperienceBoosts details = null;

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user = FormsAuthenticationWrapper.User;
                        var     experienceBoostsRequest = new GetExperienceBoostsRequest()
                        {
                            User = user, ExperienceID = experienceID
                        };
                        var experienceBoostsResponse = _certonaService.GetExperienceBoosts(experienceBoostsRequest);

                        if (experienceBoostsResponse.Success && experienceBoostsResponse.ExperienceDetails != null)
                        {
                            details = new ExperienceBoosts()
                            {
                                ExperienceID = experienceID
                            };

                            details.ExperienceDetails         = new ExperienceDetails();
                            details.ExperienceDetails.Pool    = experienceBoostsResponse.ExperienceDetails.Pool;
                            details.ExperienceDetails.Profile = experienceBoostsResponse.ExperienceDetails.Profile;

                            /*
                             * details.ExperienceBiases = new List<ExperienceBiases>();
                             * details.ExperienceBiases.AddRange(experienceBoostsResponse.ExperienceBiases.Select(b => new ExperienceBiases()
                             * {
                             *  BiasID = b.BiasID,
                             *  ListName = b.ListName,
                             *  Weight = b.Weight * 100 // Convert decimal value to integer
                             * }).ToList());
                             *
                             * details.ExperienceModels = new List<Model>();
                             * details.ExperienceModels.AddRange(experienceBoostsResponse.ExperienceModels.Select(m => new Model()
                             * {
                             *  CatalogID = m.CatalogID,
                             *  Description = m.Description,
                             *  ModelID = m.ModelID,
                             *  Name = m.Name,
                             *  Weight = m.Weight * 100 // Convert decimal value to integer
                             * }));
                             * */
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(details);
        }