Esempio n. 1
0
 public static void SetPanelBarWidth(decimal width)
 {
     try
     {
         using (_certonaService = new CertonaServiceClient())
         {
             try
             {
                 UserDTO user = FormsAuthenticationWrapper.User;
                 var     panelBarWidthRequest = new SetPanelBarWidthRequest
                 {
                     User  = user,
                     Width = width
                 };
                 _certonaService.SetPanelBarWidth(panelBarWidthRequest);
             }
             catch (TimeoutException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
             catch (CommunicationException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 2
0
 public static void UpdateExperienceDetails(ExperienceNodeViewModel experience)
 {
     try
     {
         using (_certonaService = new CertonaServiceClient())
         {
             try
             {
                 UserDTO user    = FormsAuthenticationWrapper.User;
                 var     request = new UpdateExperienceDetailsRequest
                 {
                     User         = user,
                     ExperienceID = experience.ExperienceID,
                     Name         = experience.Name,
                     Description  = experience.Description,
                 };
                 _certonaService.UpdateExperienceDetails(request);
             }
             catch (TimeoutException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
             catch (CommunicationException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 3
0
 public static bool DeleteRule(int ruleID)
 {
     try
     {
         using (_certonaService = new CertonaServiceClient())
         {
             try
             {
                 UserDTO user    = FormsAuthenticationWrapper.User;
                 var     request = new DeleteRuleRequest()
                 {
                     User          = user,
                     ApplicationID = null,
                     RuleID        = ruleID
                 };
                 var response = _certonaService.DeleteRule(request);
                 return(response.Success);
             }
             catch (TimeoutException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
             catch (CommunicationException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 4
0
 public static List <RuleOperatorDTO> GetRuleOperators(string attributeType)
 {
     try
     {
         using (_certonaService = new CertonaServiceClient())
         {
             try
             {
                 UserDTO user    = FormsAuthenticationWrapper.User;
                 var     request = new GetRuleOperatorsRequest()
                 {
                     User          = user,
                     ApplicationID = null,
                     AttributeType = attributeType
                 };
                 var response = _certonaService.GetRuleOperators(request);
                 return(response.RuleOperators);
             }
             catch (TimeoutException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
             catch (CommunicationException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 5
0
        public static List <NodeDTO> GetAssetTreeItems()
        {
            var nodes = new List <NodeDTO>();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        var user = FormsAuthenticationWrapper.User;
                        var assetExplorerTreeRequest = new GetAssetExplorerTreeRequest {
                            User = user
                        };
                        var assetExplorerTreeResponse = _certonaService.GetAssetExplorerTree(assetExplorerTreeRequest);

                        return(assetExplorerTreeResponse.Nodes.ToList());
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(nodes);
        }
Esempio n. 6
0
        public static bool SetFrequencyCap(ApplicationFrequencyCapDTO frequencyCap, UserDTO user)
        {
            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        var frequencyCapRequest = new SetApplicationFrequencyCapsRequest()
                        {
                            ApplicationID = frequencyCap.ApplicationID, FrequencyCapDTO = frequencyCap, User = user
                        };
                        _certonaService.SetApplicationFrequencyCap(frequencyCapRequest);
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(true);
        }
Esempio n. 7
0
 public static List <RecommendationTypeDTO> GetRecTypeList(string catalogID)
 {
     try
     {
         using (_certonaService = new CertonaServiceClient())
         {
             try
             {
                 UserDTO user    = FormsAuthenticationWrapper.User;
                 var     request = new GetRecommendationTypesRequest()
                 {
                     User = user, CatalogID = catalogID
                 };
                 var response = _certonaService.GetRecommendationTypes(request);
                 return(response.RecommendationTypes);
             }
             catch (TimeoutException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
             catch (CommunicationException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 8
0
        public static void SetContentPanelSectionState(int contentPanelSectionID)
        {
            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        var request = new SetContentPanelSectionStateRequest()
                        {
                            ContentPanelSectionID = contentPanelSectionID,
                            User = FormsAuthenticationWrapper.User
                        };

                        _certonaService.SetContentPanelSectionState(request);
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 9
0
 private static void UpdateVariantPriority(int variantID, string action)
 {
     try
     {
         using (_certonaService = new CertonaServiceClient())
         {
             try
             {
                 UserDTO user    = FormsAuthenticationWrapper.User;
                 var     request = new UpdateVariantPriorityRequest()
                 {
                     User = user, VariantID = variantID, Direction = action
                 };
                 var response = _certonaService.UpdateVariantPriority(request);
             }
             catch (TimeoutException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
             catch (CommunicationException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 10
0
 public static void UpdateVariantStatus(string variantID_List, string status)
 {
     try
     {
         using (_certonaService = new CertonaServiceClient())
         {
             try
             {
                 UserDTO user    = FormsAuthenticationWrapper.User;
                 var     request = new UpdateVariantStatusRequest()
                 {
                     User = user, VariantID_List = variantID_List, Status = status
                 };
                 var response = _certonaService.UpdateVariantStatus(request);
             }
             catch (TimeoutException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
             catch (CommunicationException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 11
0
        public static string AuthenticateUser(LoginViewModel model)
        {
            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        var user = new UserDTO
                        {
                            UserID   = model.UserName,
                            Password = Encryption.GetMd5Sum(model.Password)
                        };
                        var request = new AuthenticateUserRequest {
                            User = user
                        };

                        AuthenticateUserResponse response = _certonaService.AuthenticateUser(request);
                        if (!response.Success)
                        {
                            return(Utilities.ParseServiceErrors(response.Errors));
                        }
                        if (response.User == null || response.User.UserID == null)
                        {
                            return("Invalid user account.");
                        }

                        var userDetailsRequest = new GetUserAccountApplicationFeaturesRequest {
                            User = response.User
                        };
                        var userDetailsResponse = _certonaService.GetUserAccountApplicationFeatures(userDetailsRequest);
                        if (userDetailsResponse.Success)
                        {
                            response.User.Accounts = userDetailsResponse.Accounts;
                        }

                        FormsAuth.SetAuthCookie(response.User, false);

                        ReportingStartDate = DateTime.Now.AddDays(-30);
                        ReportingEndDate   = DateTime.Now;
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return("");
        }
Esempio n. 12
0
        private static TrendsViewModel GetTrendsSeriesVariantData(int id, DateTime startDate, DateTime endDate)
        {
            var model = new TrendsViewModel();

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

                        model.TrendSeries = new List <TrendSeries>();

                        var getRequest = new GetTrendsDataVariantRequest()
                        {
                            VariantID = id, StartDate = startDate, EndDate = endDate, User = user
                        };
                        var getResponse = _certonaService.GetTrendsDataVariant(getRequest);
                        if (getResponse.Success && getResponse.TrendsData != null && getResponse.TrendsData.Count > 0)
                        {
                            foreach (var dto in getResponse.TrendsData)
                            {
                                var seriesDataPoint = new TrendSeries()
                                {
                                    Category = dto.Category, Group = dto.Group, Data = dto.Data
                                };
                                model.TrendSeries.Add(seriesDataPoint);
                            }
                        }
                        else
                        {
                            var seriesDataPoint = new TrendSeries()
                            {
                                Category = "No Data", Group = "No Data"
                            };
                            model.TrendSeries.Add(seriesDataPoint);
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                _certonaService.Abort();
                throw;
            }

            return(model);
        }
Esempio n. 13
0
        public static List <ExperienceStrategy> GetExperienceStrategies(int experienceID)
        {
            List <ExperienceStrategy> strategies = new List <ExperienceStrategy>();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user    = FormsAuthenticationWrapper.User;
                        var     request = new GetExperienceVariantsRequest()
                        {
                            User = user, ExperienceID = experienceID
                        };
                        var response = _certonaService.GetExperienceVariants(request);

                        if (response.Success && response.Variants != null)
                        {
                            strategies.AddRange(response.Variants.Select(x => new ExperienceStrategy()
                            {
                                StrategyID              = x.StrategyID,
                                Catalog                 = x.Catalog,
                                CatalogImage            = x.CatalogImage,
                                Name                    = x.Name,
                                Impressions             = x.Impressions,
                                PersonalizationType     = x.PersonalizationType,
                                Priority                = x.Priority,
                                Rules                   = x.Rules.HasValue ? (x.Rules.Value ? "Y" : null) : null,
                                Status                  = x.Status,
                                NumberOfItems           = x.NumberOfItems,
                                MinItemsReturned        = x.MinItemsReturned,
                                BreakOnMinItemsReturned = x.BreakOnMinItemsReturned
                            }).ToList());
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(strategies);
        }
Esempio n. 14
0
        public static SchemeDetails GetSchemeDetails(int schemeID)
        {
            SchemeDetails SchemeDetails = null;

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user             = FormsAuthenticationWrapper.User;
                        var     appDetailRequest = new GetSchemeDetailsRequest {
                            SchemeID = schemeID, User = user
                        };
                        var appDetailResponse = _certonaService.GetSchemeDetails(appDetailRequest);

                        if (appDetailResponse.Success && appDetailResponse.SchemeDetails != null)
                        {
                            SchemeDetails = new SchemeDetails
                            {
                                ApplicationID     = appDetailResponse.SchemeDetails.ApplicationID,
                                Name              = appDetailResponse.SchemeDetails.Name,
                                Description       = appDetailResponse.SchemeDetails.Description,
                                Scheme            = appDetailResponse.SchemeDetails.Scheme,
                                SchemeType        = appDetailResponse.SchemeDetails.SchemeType,
                                DefaultCatalogID  = appDetailResponse.SchemeDetails.DefaultCatalogID,
                                Status            = appDetailResponse.SchemeDetails.Status.ToString(),
                                RecMethod         = appDetailResponse.SchemeDetails.RecMethod,
                                Callback          = appDetailResponse.SchemeDetails.Callback,
                                CustomQueryString =
                                    appDetailResponse.SchemeDetails.CustomQueryString,
                                NumberOfItems = appDetailResponse.SchemeDetails.NumberOfItems,
                                Icon_Filename = appDetailResponse.SchemeDetails.Icon_Filename
                            };
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(SchemeDetails);
        }
Esempio n. 15
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);
        }
Esempio n. 16
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);
        }
Esempio n. 17
0
        private static void DeactivateExperiences(SchemeExperience experience)
        {
            // get all experiences for container
            var m = SchemeModel.GetSchemeExperiences(experience.SchemeID);

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user = FormsAuthenticationWrapper.User;
                        foreach (var exp in m.Experiences)
                        {
                            if (exp.ExperienceID != experience.ExperienceID && exp.Status == "Active")
                            {
                                // set others to Inactive
                                var request = new UpdateExperienceDetailsRequest
                                {
                                    User         = user,
                                    ExperienceID = exp.ExperienceID,
                                    Status       = "Inactive",
                                };
                                _certonaService.UpdateExperienceDetails(request);

                                // clear Traffic
                                var req = new UpdateExperienceTrafficRequest()
                                {
                                    User = user, ExperienceID = exp.ExperienceID
                                };
                                _certonaService.UpdateExperienceTraffic(req);
                            }
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 18
0
        public static CatalogDetails GetCatalogDetails(string catalogID)
        {
            CatalogDetails details = null;

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user = FormsAuthenticationWrapper.User;
                        var     catalogDetailsRequest = new GetCatalogDetailsRequest()
                        {
                            User = user, CatalogID = catalogID
                        };
                        var catalogDetailsResponse = _certonaService.GetCatalogDetails(catalogDetailsRequest);


                        if (catalogDetailsResponse.Success && catalogDetailsResponse.CatalogDetails != null)
                        {
                            details = new CatalogDetails()
                            {
                                CatalogId           = catalogID,
                                Name                = catalogDetailsResponse.CatalogDetails.Name,
                                Description         = catalogDetailsResponse.CatalogDetails.Description,
                                AssetType           = catalogDetailsResponse.CatalogDetails.AssetType,
                                Icon_FileName       = catalogDetailsResponse.CatalogDetails.Icon_FileName,
                                CatalogApplications = catalogDetailsResponse.CatalogDetails.Applications,
                                LanguageName        = catalogDetailsResponse.CatalogDetails.LanguageName
                            };
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(details);
        }
Esempio n. 19
0
 public static int SaveExpression(ExpressionViewModel expression)
 {
     try
     {
         using (_certonaService = new CertonaServiceClient())
         {
             try
             {
                 UserDTO user    = FormsAuthenticationWrapper.User;
                 var     request = new SaveExpressionRequest()
                 {
                     User          = user,
                     ApplicationID = null,
                     VariantID     = expression.VariantID,
                     RuleID        = expression.RuleID,
                     RuleName      = expression.RuleName,
                     ExpressionID  = expression.ExpressionID
                 };
                 request.RuleExpression = new List <ExpressionDTO>();
                 request.RuleExpression.Add(new ExpressionDTO()
                 {
                     ConditionID    = expression.ConditionID, // init to 0 for NEW ADD
                     Attribute      = expression.Attribute,
                     Operator       = expression.Operator,
                     Value          = expression.Value,
                     Context        = expression.Context,
                     PlusOrMinus    = expression.PlusOrMinus,
                     PercentOrUnits = expression.PercentOrUnits,
                     ExpressionType = ExpressionType.Filter
                 });
                 var response = _certonaService.SaveExpression(request);
                 return(response.ExpressionID);
                 // return 400;
             }
             catch (TimeoutException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
             catch (CommunicationException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 20
0
        public static List <VariantRule> GetVariantRules(int variantID)
        {
            var rules = new List <VariantRule>();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user    = FormsAuthenticationWrapper.User;
                        var     request = new GetVariantRulesRequest()
                        {
                            User = user, VariantID = variantID
                        };
                        var response = _certonaService.GetVariantRules(request);

                        if (response.Success && response.Rules != null)
                        {
                            foreach (var rule in response.Rules)
                            {
                                rules.Add(new VariantRule()
                                {
                                    VariantID = variantID,
                                    RuleID    = rule.RuleID,
                                    Name      = rule.RuleName,
                                    RuleText  = rule.ExpressionText
                                });
                            }
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(rules);
        }
Esempio n. 21
0
        public static ApplicationDetails GetApplicationDetailsViewModel(string applicationID)
        {
            ApplicationDetails applicationDetails = null;

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user             = FormsAuthenticationWrapper.User;
                        var     appDetailRequest = new GetApplicationDetailsRequest {
                            ApplicationID = applicationID, User = user
                        };

                        var appDetailResponse = _certonaService.GetApplicationDetails(appDetailRequest);


                        if (appDetailResponse.Success && appDetailResponse.ApplicationDetails != null)
                        {
                            applicationDetails = new ApplicationDetails
                            {
                                Name            = appDetailResponse.ApplicationDetails.Name,
                                Description     = appDetailResponse.ApplicationDetails.Description,
                                ApplicationID   = applicationID,
                                URL             = HtmlExtensions.UrlPrependHttp(appDetailResponse.ApplicationDetails.ApplicationURL),
                                Classifications = appDetailResponse.ApplicationDetails.Classifications
                            };
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }


            return(applicationDetails);
        }
Esempio n. 22
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);
        }
Esempio n. 23
0
        public static ExperienceNodeViewModel GetExperienceDetails(int experienceID)
        {
            ExperienceNodeViewModel details = new ExperienceNodeViewModel();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user    = FormsAuthenticationWrapper.User;
                        var     request = new GetExperienceDetailsRequest()
                        {
                            User = user, ExperienceID = experienceID
                        };
                        var response = _certonaService.GetExperienceDetails(request);

                        if (response.Success && response.Details != null)
                        {
                            details.ExperienceID = experienceID;
                            details.Name         = response.Details.Name;
                            details.Description  = response.Details.Description;
                            details.Status       = response.Details.Status;
                            if (response.Details.Traffic.HasValue)
                            {
                                details.Traffic = Convert.ToDecimal(response.Details.Traffic.Value);
                            }
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(details);
        }
Esempio n. 24
0
        public static PackageDetails GetPackageDetails(int packageID)
        {
            PackageDetails details = null;

            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)
                        {
                            details = new PackageDetails()
                            {
                                PackageId   = packageID,
                                Description = packageDetailsResponse.PackageDetails.Description,
                                PackageName = packageDetailsResponse.PackageDetails.Name,
                                PackageType = packageDetailsResponse.PackageDetails.Type,
                                SubType     = packageDetailsResponse.PackageDetails.SubType,
                                PageURL     = HtmlExtensions.UrlPrependHttp(packageDetailsResponse.PackageDetails.PageURL),
                                Status      = null      // MISSING from service response
                            };
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(details);
        }
Esempio n. 25
0
        public static AssetsViewModel GetCatalogMappingsForAccountItemIDAndDescription(string catalogId)
        {
            var ret = new AssetsViewModel();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user      = FormsAuthenticationWrapper.User;
                        var     idRequest = new GetCatalogMappingFromResonanceFieldRequest
                        {
                            CatalogID      = catalogId,
                            User           = user,
                            ResonanceField = "AccountItemID"
                        };
                        var idResponse = _certonaService.GetCatalogMappingFromResonanceField(idRequest);
                        ret.AccountItemIDMapping = idResponse.Success ? !String.IsNullOrWhiteSpace(idResponse.CatalogMapping) ? idResponse.CatalogMapping : "AccountItemID" : "AccountItemID";

                        var descriptionRequest = new GetCatalogMappingFromResonanceFieldRequest
                        {
                            CatalogID      = catalogId,
                            User           = user,
                            ResonanceField = "Description"
                        };
                        var descriptionResponse = _certonaService.GetCatalogMappingFromResonanceField(descriptionRequest);
                        ret.DescriptionMapping = idResponse.Success ? !String.IsNullOrWhiteSpace(descriptionResponse.CatalogMapping) ? descriptionResponse.CatalogMapping : "AccountItemID" : "AccountItemID";
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(ret);
        }
Esempio n. 26
0
        /*
         * public static ReportsViewModel GetRecommendations(string applicationId)
         * {
         *  var model = new ReportsViewModel();
         *  model.Recommendations = new List<string>();
         *
         *  try
         *  {
         *      using (_certonaService = new CertonaServiceClient())
         *      {
         *          try
         *          {
         *              UserDTO user = FormsAuthenticationWrapper.User;
         *
         *              var getRequest = new GetApplicationSchemesRequest() { ApplicationID = applicationId, User = user };
         *              var getResponse = _certonaService.GetApplicationSchemes(getRequest);
         *              if (getResponse.Success && getResponse.Schemes != null && getResponse.Schemes.Count > 0)
         *              {
         *                  foreach (var scheme in getResponse.Schemes)
         *                  {
         *                      model.Recommendations.Add(scheme.SchemeName);
         *                  }
         *              }
         *
         *          }
         *          catch (TimeoutException exception)
         *          {
         *              _certonaService.Abort();
         *              throw;
         *          }
         *          catch (CommunicationException exception)
         *          {
         *              _certonaService.Abort();
         *              throw;
         *          }
         *      }
         *  }
         *  catch (Exception ex)
         *  {
         *      _certonaService.Abort();
         *      throw;
         *  }
         *
         *  return model;
         * }
         */

        public static ReportsViewModel GetUserAccountApplicationFeatures()
        {
            var model = new ReportsViewModel();

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

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user       = FormsAuthenticationWrapper.User;
                        var     getRequest = new GetUserAccountApplicationFeaturesRequest()
                        {
                            User = user
                        };
                        var getResponse = _certonaService.GetUserAccountApplicationFeatures(getRequest);
                        if (getResponse.Success && getResponse.Accounts[0].Applications != null && getResponse.Accounts[0].Applications.Count > 0)
                        {
                            model.ApplicationList =
                                getResponse.Accounts.Where(m => m.AccountID == user.LastAccountID)
                                .SelectMany(m => m.Applications)
                                .Select(m => m.ApplicationID)
                                .ToList();
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                _certonaService.Abort();
                throw;
            }

            return(model);
        }
Esempio n. 27
0
 public static void UpdateVariantDetails(VariantDetails details)
 {
     try
     {
         using (_certonaService = new CertonaServiceClient())
         {
             try
             {
                 UserDTO user    = FormsAuthenticationWrapper.User;
                 var     request = new UpdateVariantDetailsRequest()
                 {
                     User          = user,
                     VariantID     = details.VariantId,
                     Name          = details.Name,
                     Description   = details.Description ?? "",
                     Explanation   = details.ContainerTitle ?? "",
                     CatalogID     = details.CatalogId,                          // passed back as is
                     MethodID      = details.MethodId,
                     Status        = details.Status,
                     NumberOfItems = details.NumberOfAssets,       // passed back as is
                     Priority      = details.Priority              // passed back as is
                 };
                 var response = _certonaService.UpdateVariantDetails(request);
                 if (!response.Success)
                 {
                     throw new ApplicationException("UpdateVariantDetails returned failure status");
                 }
             }
             catch (TimeoutException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
             catch (CommunicationException exception)
             {
                 _certonaService.Abort();
                 throw;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 28
0
        public static void SetAccountExplorerNodeState(string nodeID, string nodeType, string nodeName, int?classificationID, bool expand)
        {
            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user    = FormsAuthenticationWrapper.User;
                        var     nodeDTO = new NodeDTO
                        {
                            NodeID           = nodeID,
                            DisplayValue     = nodeName,
                            NodeType         = (NodeType)Enum.Parse(typeof(NodeType), nodeType),
                            ClassificationID = classificationID,
                            Expanded         = expand
                        };

                        var accountExplorerNodeStateRequest = new SetAccountExplorerNodeStateRequest
                        {
                            User = user,
                            Node = nodeDTO
                        };

                        _certonaService.SetAccountExplorerNodeState(accountExplorerNodeStateRequest);
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 29
0
        public static List <ApplicationPackage> GetApplicationPackagesViewModel(string applicationID)
        {
            var appPackageList = new List <ApplicationPackage>();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user = FormsAuthenticationWrapper.User;
                        var     appPackagesRequest = new GetApplicationPackagesRequest {
                            ApplicationID = applicationID, User = user
                        };
                        var appPackagesResponse = _certonaService.GetApplicationPackages(appPackagesRequest);


                        if (appPackagesResponse.Success && appPackagesResponse.ApplicationPackages.Count > 0)
                        {
                            appPackageList.AddRange(appPackagesResponse.ApplicationPackages.Select(appPackage => new ApplicationPackage
                            {
                                PackageId = appPackage.PackageId, PackageName = appPackage.PackageName, Status = appPackage.Status, Type = appPackage.PackageType, Description = appPackage.Description, SubType = appPackage.SubType
                            }));
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(appPackageList);
        }
Esempio n. 30
0
        public static HeaderViewModel GetCatalogHeader(string catalogID)
        {
            var vm = new HeaderViewModel();

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        UserDTO user = FormsAuthenticationWrapper.User;
                        var     catalogDetailsRequest = new GetCatalogDetailsRequest()
                        {
                            User = user, CatalogID = catalogID
                        };
                        var catalogDetailsResponse = _certonaService.GetCatalogDetails(catalogDetailsRequest);


                        if (catalogDetailsResponse.Success && catalogDetailsResponse.CatalogDetails != null)
                        {
                            vm.CatalogName = catalogDetailsResponse.CatalogDetails.Name;
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(vm);
        }