/// <summary>
        /// Evaluates formula
        /// </summary>
        /// <param name="values"></param>
        /// <returns>"Formula" with project values instead of sqlFunctions and %values% in viewable form</returns>
        public String ParseFormula(Evaluation values)
        {
            string evaluatedFormula = Formula;
            foreach (KeyValuePair<String, String> value in values.Formulas)
            {
                evaluatedFormula = evaluatedFormula.Replace("$" + value.Key, value.Value);

            }
            foreach (KeyValuePair<String, String> value in values.Values)
            {
                evaluatedFormula = Regex.Replace(evaluatedFormula, "%" + value.Key + "%", value.Value);
            }
            return HtmlHelperHelper.RenderValue(evaluatedFormula, Type);
        }
 private KeyValuePair<int, Evaluation> ReadDictionaryOfEvaluations(string projectFromFile, String[] headers)
 {
     String[] valuesFromFile = projectFromFile.Split(';').Where(x => System.Text.RegularExpressions.Regex.IsMatch(x, @"\w{1,}")).ToArray();
     if(valuesFromFile.Length != headers.Length)
     {
         return new KeyValuePair<int,Evaluation>();
     }
     for (int i = 0; i < valuesFromFile.Length; i++)
     {
         valuesFromFile[i] = valuesFromFile[i].FileFormatvalueIntoProgramFormat();
     }
     Int32 projectId = 0;
     if(!Int32.TryParse(valuesFromFile[0], out projectId))
     {
         return new KeyValuePair<int, Evaluation>();
     }
     Evaluation evaluation = new Evaluation();
     for (int i = 1; i < headers.Length; i++ )
     {
         evaluation.Values.Add(headers[i], valuesFromFile[i]);
     }
     return new KeyValuePair<int, Evaluation>(projectId, evaluation);
 }
 /// <summary>
 /// Returns values for each "variable" or "function" in each project that matches "Filter"
 /// </summary>
 /// <returns>Each element of array is collection of requered values in (valueName, value) format</returns>
 public Evaluation[] GetValues()
 {
     List<Evaluation> evaluations = new List<Evaluation>(projects.Count());
     foreach (Project project in projects)
     {
         Evaluation evaluation = new Evaluation();
         evaluation.Values = EvaluateVariables(project);
         evaluation.Formulas = EvaluateFormulas(project);
         evaluations.Add(evaluation);
     }
     return evaluations.ToArray();
 }
 /// <summary>
 /// Generates projects. To create each project it gives values of this project to each column.
 /// </summary>
 /// <param name="valuesForEach">Evaluated SQL functions and variables of projects.</param>
 /// <param name="columns">Program definition of each required column.</param>
 /// <returns>Viewable models for projects.</returns>
 public static ProjectModel[] SetValuesIntoFormulas(Evaluation[] valuesForEach, ColumnDefinition[] columns)
 {
     ProjectModel[] projects = new ProjectModel[valuesForEach.Length];
     for (int i = 0; i < projects.Length; i++)
     {
         ProjectModel project = new ProjectModel();
         project.Properties = new String[columns.Length];
         for(int j = 0; j < columns.Length; j++)
         {
             project.Properties[j] = columns[j].ParseFormula(valuesForEach[i]);
         }
         projects[i] = project;
     }
     return projects;
 }