Пример #1
0
        /// <summary>Functions used when building/adjusting or splitting Arrays in the configuration Builder
        /// </summary>

        /// <summary>Builds an array of data by splitting by ~ in the string of the array.
        /// <para>Input = string value to be split</para>
        /// <para>jCategory = the whole configuration which is required to do the variable replace</para>
        /// <para>GroupID = current Group ID</para>
        /// <para>ItemID = current row ID</para>
        /// </summary>
        public string[] InputArrayBuilder(string Input, List <CategoryViewModel> jCategory, int GroupID, int ItemID)
        {
            CalculationCSharp.Areas.Configuration.Models.ConfigFunctions Config = new CalculationCSharp.Areas.Configuration.Models.ConfigFunctions();
            if (!string.IsNullOrEmpty(Input))
            {
                string[] parts = null;
                //Split Array
                parts = Input.Split('~');
                string        outputstring = null;
                string[]      partsSplit   = null;
                List <string> OutputList   = new List <string>();
                //Loop through the array
                foreach (string date in parts)
                {
                    //Replace any value that has a variable attached to it
                    outputstring = Config.VariableReplace(jCategory, date, GroupID, ItemID);
                    if (outputstring.Contains("~"))
                    {
                        partsSplit = outputstring.Split('~');
                        foreach (string Output2 in partsSplit)
                        {
                            OutputList.Add(Output2);
                        }
                    }
                    //If not an array output the single value
                    else
                    {
                        OutputList.Add(outputstring);
                    }
                }
                return(OutputList.ToArray());
            }
            return(null);
        }
 /// <summary>Functions used when building/adjusting or splitting Arrays in the configuration Builder
 /// </summary>   
 /// <summary>Builds an array of data by splitting by ~ in the string of the array.
 /// <para>Input = string value to be split</para>
 /// <para>jCategory = the whole configuration which is required to do the variable replace</para>
 /// <para>GroupID = current Group ID</para>
 /// <para>ItemID = current row ID</para>
 /// </summary>   
 public string[] InputArrayBuilder(string Input, List<CategoryViewModel> jCategory, int GroupID, int ItemID)
 {
     CalculationCSharp.Areas.Configuration.Models.ConfigFunctions Config = new CalculationCSharp.Areas.Configuration.Models.ConfigFunctions();
     if (!string.IsNullOrEmpty(Input))
     {
         string[] parts = null;
         //Split Array
         parts = Input.Split('~');
         string outputstring = null;
         string[] partsSplit = null;
         List<string> OutputList = new List<string>();
         //Loop through the array
         foreach (string date in parts)
         {
             //Replace any value that has a variable attached to it
             outputstring = Config.VariableReplace(jCategory, date, GroupID, ItemID);
             if (outputstring.Contains("~"))
             {
                 partsSplit = outputstring.Split('~');
                 foreach (string Output2 in partsSplit)
                 {
                     OutputList.Add(Output2);
                 }
             }
             //If not an array output the single value
             else
             {
                 OutputList.Add(outputstring);
             }
         }
         return OutputList.ToArray();
     }
     return null;
 }