Exemple #1
0
        public static List <PackageSchemesViewModel> GetPackageSchemes(int packageID)
        {
            var packageSchemes = new List <PackageSchemesViewModel>();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user = FormsAuthenticationWrapper.User;
                        var     packageSchemesRequest = new GetPackageSchemesRequest()
                        {
                            User = user, PackageID = packageID
                        };
                        var packageSchemesResponse = _certonaService.GetPackageSchemes(packageSchemesRequest);
                        if (packageSchemesResponse.Success &&
                            packageSchemesResponse.PackageSchemes != null &&
                            packageSchemesResponse.PackageSchemes.Count > 0)
                        {
                            foreach (PackageSchemesDTO package in packageSchemesResponse.PackageSchemes)
                            {
                                packageSchemes.Add(new PackageSchemesViewModel
                                {
                                    Catalog       = package.Catalog,
                                    CatalogImage  = package.CatalogImage,
                                    ContainerID   = package.ContainerID,
                                    Description   = package.Description,
                                    Name          = package.Name,
                                    NumberOfItems = package.NumberOfItems,
                                    Status        = package.Status
                                });
                            }
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(packageSchemes);
        }
Exemple #2
0
        public static PackageViewModel GetPackageViewModel(NodeType nodeType, int packageID)
        {
            // Load up the top level Package view model
            var vm = new PackageViewModel();

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

                        var packageDetailsRequest = new GetPackageDetailsRequest()
                        {
                            User = user, PackageID = packageID
                        };
                        var packageDetailsResponse = _certonaService.GetPackageDetails(packageDetailsRequest);

                        if (packageDetailsResponse.Success && packageDetailsResponse.PackageDetails != null)
                        {
                            var dto = packageDetailsResponse.PackageDetails;
                            var ap  = new PackageDetails()
                            {
                                PackageId   = packageID,
                                Description = dto.Description,
                                PackageName = dto.Name,
                                PackageType = dto.Type,
                                SubType     = dto.SubType,
                                PageURL     = dto.PageURL,
                                Status      = null      // MISSING from service response
                            };
                            vm.PackageDetails = ap;
                        }

                        var packageSchemesRequest = new GetPackageSchemesRequest()
                        {
                            User = user, PackageID = packageID
                        };
                        var packageSchemesResponse = _certonaService.GetPackageSchemes(packageSchemesRequest);

                        if (packageSchemesResponse.Success &&
                            packageSchemesResponse.PackageSchemes != null &&
                            packageSchemesResponse.PackageSchemes.Count > 0)
                        {
                            vm.PackageSchemes = new List <PackageSchemesViewModel>();

                            foreach (PackageSchemesDTO package in packageSchemesResponse.PackageSchemes)
                            {
                                vm.PackageSchemes.Add(new PackageSchemesViewModel
                                {
                                    Catalog       = package.Catalog,
                                    CatalogImage  = package.CatalogImage,
                                    ContainerID   = package.ContainerID,
                                    Description   = package.Description,
                                    Name          = package.Name,
                                    NumberOfItems = package.NumberOfItems,
                                    Status        = package.Status
                                });
                            }
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(vm);
        }