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