示例#1
0
        public static VariantDetails GetVariantDetails(int variantID)
        {
            VariantDetails details      = null;
            int?           nullMethodId = null;

            #region Main
            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user = FormsAuthenticationWrapper.User;
                        var     variantDetailsRequest = new GetVariantDetailsRequest()
                        {
                            User = user, VariantID = variantID
                        };
                        var variantDetailsResponse = _certonaService.GetVariantDetails(variantDetailsRequest);

                        if (variantDetailsResponse.Success && variantDetailsResponse.VariantDetails != null)
                        {
                            details = new VariantDetails()
                            {
                                VariantId           = variantID,
                                Catalog             = variantDetailsResponse.VariantDetails.Catalog,
                                CatalogId           = variantDetailsResponse.VariantDetails.CatalogID,
                                ContainerTitle      = variantDetailsResponse.VariantDetails.ContainerTitle,
                                Description         = variantDetailsResponse.VariantDetails.Description,
                                Icon_FileName       = variantDetailsResponse.VariantDetails.Icon_FileName,
                                Name                = variantDetailsResponse.VariantDetails.Name,
                                NumberOfAssets      = variantDetailsResponse.VariantDetails.NumberOfAssets,
                                PersonalizationType = variantDetailsResponse.VariantDetails.PersonalizationType,
                                MethodId            = variantDetailsResponse.VariantDetails.MethodID,
                                PoolFactor          = variantDetailsResponse.VariantDetails.PoolFactor,
                                Priority            = variantDetailsResponse.VariantDetails.Priority,
                                RecommendationType  = variantDetailsResponse.VariantDetails.RecommendationType,
                                SubjectWeight       = variantDetailsResponse.VariantDetails.SubjectWeight,
                                Status              = variantDetailsResponse.VariantDetails.Status
                            };
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            #endregion

            //if (details != null)
            //{
            //    if (!string.IsNullOrEmpty(details.CatalogId))
            //    {
            //        var recTypeList = VariantModel.GetRecTypeList(details.CatalogId);
            //        details.PersonalizationTypeList = recTypeList.Select(s => new SelectListItem
            //                    {
            //                        Text = s.Name,
            //                        Value = s.MethodID.ToString(),
            //                        Selected = (s.Name == details.PersonalizationType) ? true : false
            //                    }).ToList();
            //    }
            //
            //    var statusList = ApplicationModel.GetStatusList();
            //    details.StatusList = statusList.Select(s => new SelectListItem { Text = s, Value = s }).ToList();
            //}

            return(details);
        }