Exemple #1
0
 public static List <KeyValuePair <object, string> > GetAllActions()
 {
     return(Enum.GetValues(typeof(ActionType))
            .Cast <ActionType> ()
            .Select(a => new KeyValuePair <object, string> (a, PriceRuleAction.TypeToString(a)))
            .ToList());
 }
Exemple #2
0
        public override string ToString()
        {
            StringBuilder             ret  = new StringBuilder();
            List <PriceRuleCondition> cond = conditions.FindAll(c => !c.IsException);

            if (cond.Count > 0)
            {
                ret.AppendFormat("{0}:{1}{2}{1}",
                                 Translator.GetString("Conditions"),
                                 Environment.NewLine,
                                 string.Join(Environment.NewLine, cond));
            }

            List <PriceRuleCondition> exceptions = conditions.FindAll(c => c.IsException);

            if (exceptions.Count > 0)
            {
                if (ret.Length > 0)
                {
                    ret.Append(Environment.NewLine);
                }

                ret.AppendFormat("{0}:{1}{2}{1}",
                                 Translator.GetString("Exceptions"),
                                 Environment.NewLine,
                                 string.Join(Environment.NewLine, exceptions));
            }

            ret.AppendFormat("{1}{0}:{1}{2}{1}",
                             Translator.GetString("Actions"),
                             Environment.NewLine,
                             string.Join(Environment.NewLine, actions.Select(a => string.Format("{0}: {1}", PriceRuleAction.TypeToString(a.Type), a))));

            ret.AppendFormat("{1}{0}:{1}{2}",
                             Translator.GetString("Operations"),
                             Environment.NewLine,
                             string.Join(Environment.NewLine, operations.Select(Translator.GetOperationTypeGlobalName)));

            return(ret.ToString());
        }