Exemple #1
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);
        }