/// <summary>
 /// Get actual value of items' field
 /// </summary>
 /// <param name="fieldName"></param>
 /// <param name="modifiers"></param>
 /// <returns></returns>
 public string GetCurrentFieldValue(string fieldName, ModifiersCollection modifiers = null)
 {
     if (Vars.SItem != null && Vars.SItem.Fields.ContainsField(fieldName))
     {
         return(Convert.ToString(Vars.SItem[fieldName]));
     }
     else
     {
         return(null);
     }
 }
Esempio n. 2
0
 public override string GetText(ModifiersCollection modifiers)
 {
     if (modifiers.Contains(Modifier.Old))
     {
         return(m_field.GetAtributeValue("LookupOldF"));
     }
     else if (modifiers.Contains(Modifier.New))
     {
         return(m_field.GetAtributeValue("LookupNewF"));
     }
     else
     {
         return(m_field.GetAtributeValue("LookupNewF") ?? m_field.GetAtributeValue("LookupOldF"));
     }
 }
Esempio n. 3
0
 public virtual string GetText(ModifiersCollection modifiers)
 {
     if (modifiers.Contains(Modifier.Old))
     {
         return(m_field.GetAtributeValue("Old"));
     }
     else if (modifiers.Contains(Modifier.New))
     {
         return(m_field.GetAtributeValue("New"));
     }
     else
     {
         return(m_field.GetAtributeValue("New") ?? m_field.GetAtributeValue("Old"));
     }
 }
Esempio n. 4
0
        public static ModifiersCollection Parse(string modifiers)
        {
            var res = new ModifiersCollection();

            if (string.IsNullOrEmpty(modifiers))
            {
                return(ModifiersCollection.Empty);
            }
            foreach (var s in modifiers.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries))
            {
                var m = Modifier.AllModifiers.Where(p => p.Pattern != null && p.Pattern.Trim(':') == s).FirstOrDefault();
                if (m != null && !res.Contains(m))
                {
                    res.Add(m);
                }
            }
            return(res);
        }
        public override string Process(string text, ISubstitutionContext context)
        {
            string res = text;

            foreach (Match m in Regex.Matches(res, Pattern))
            {
                try
                {
                    ModifiersCollection modifiers = ModifiersCollection.Parse(m.Groups[2].Value);
                    string fieldTextValue         = context.GetCurrentFieldValue(m.Groups[1].Value, modifiers);
                    if (fieldTextValue != null)
                    {
                        res = res.Replace(m.Value, fieldTextValue);
                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteTrace(ex, SeverityEnum.Error);
                }
            }
            return(res);
        }
 /// <summary>
 /// Get value from context objects
 /// </summary>
 /// <param name="value"></param>
 /// <param name="modifiers"></param>
 /// <returns></returns>
 public string GetContextValue(string value, ModifiersCollection modifiers)
 {
     return(GetValueFromObjByPath(Vars, value));
 }