public FormulaSet GetRecordingData()
        {
            var formulaSet = new FormulaSet();

            formulaSet.Id             = Id;
            formulaSet.Target         = Target;
            formulaSet.Condition      = Condition;
            formulaSet.Formula        = Formula;
            formulaSet.OutOfCondition = OutOfCondition;
            return(formulaSet);
        }
 public static Error.Types AddFormula(
     this SiteSettings ss,
     string target,
     int? condition,
     string formula,
     string outOfCondition)
 {
     if (ss.FormulaColumn(target) == null)
     {
         return Error.Types.InvalidFormula;
     }
     var formulaSet = new FormulaSet()
     {
         Id = ss.Formulas?.Any() == true
             ? ss.Formulas.Max(o => o.Id) + 1
             : 1,
         Target = target,
         Condition = ss.Views?.Get(condition) != null
             ? condition
             : null
     };
     var formulaParts = Parts(formula);
     if (!formulaParts.Any())
     {
         return Error.Types.InvalidFormula;
     }
     var outOfConditionParts = Parts(outOfCondition);
     if (!outOfCondition.IsNullOrEmpty() && !outOfConditionParts.Any())
     {
         return Error.Types.InvalidFormula;
     }
     var error1 = Get(ss, formulaParts, out formulaSet.Formula);
     if (error1.Has()) return error1;
     if (formulaSet.Condition != null && outOfConditionParts != null)
     {
         var error2 = Get(ss, outOfConditionParts, out formulaSet.OutOfCondition);
         if (error2.Has()) return error2;
     }
     if (ss.Formulas == null) ss.Formulas = new SettingList<FormulaSet>();
     ss.Formulas.Add(formulaSet);
     return Error.Types.None;
 }