Beispiel #1
0
        public static string[] AsStrings(this TableFilter value)
        {
            var lines = new List <string>();

            for (int i = 0; i < value.Count(); i++)
            {
                var isFirstLine     = (i == 0);
                var isLastLine      = (i == value.Count() - 1);
                var tableFilterLine = value.ElementAt(i);
                var line            = string.Format("{0}={1}({2})", tableFilterLine.FieldName, tableFilterLine.Type.AsString(), tableFilterLine.Value);

                if (isFirstLine)
                {
                    line = string.Format("WHERE({0}", line);
                }
                else
                {
                    line = string.Format("      {0}", line);
                }

                if (isLastLine)
                {
                    line = string.Format("{0})", line);
                }
                else
                {
                    line = string.Format("{0},", line);
                }

                lines.Add(line);
            }

            return(lines.ToArray <string>());
        }