public void SetInFilter(string InFields, string InOption, bool filterOptions, string Conjunction) { if(String.IsNullOrEmpty(Conjunction)) Conjunction = "AND"; SQLQueryField queryField = new SQLQueryField(); queryField.conjunction = (ConjunctionEnum)Enum.Parse(typeof(ConjunctionEnum), Conjunction, true); queryField.key = InFields; InOption = InOption.Trim(new char[] {keyBracketOpen[0], keyBracketClose[0]}); if(filterOptions) { List<string> stringList = new List<string>(); string[] stringArrayTmp = InOption.Split(new Char[] { keyDelimiter[0] }, StringSplitOptions.RemoveEmptyEntries); foreach(string s in stringArrayTmp) { stringList.Add(AddStringEscapeSymbol(s)); } InOption = string.Join(", ", stringList.ToArray()); } else { InOption = InOption.Trim(new char[] { keyEnd[0], keySpace[0] }); } queryField.value = keyBracketOpen + InOption + keyBracketClose; queryField.operation = keyIN; FilterList.Add(queryField); }
public void SetFilter(string WhereOption, string Conjunction) { if(String.IsNullOrEmpty(Conjunction)) Conjunction = "AND"; string operation = String.Empty; if (WhereOption.IndexOf(keyLike) != -1) { operation = keyLike; } else { Regex reg = new Regex ("[^<>=]"); operation = reg.Replace (WhereOption, ""); } string[] split = WhereOption.Split(_splitChar, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < split.Length; i += 2) { SQLQueryField queryField = new SQLQueryField(); queryField.key = (split[i]).Trim(); queryField.value = AddStringEscapeSymbol(split[i+1]); queryField.operation = operation; queryField.conjunction = (ConjunctionEnum)Enum.Parse(typeof(ConjunctionEnum), Conjunction, true); FilterList.Add(queryField); } }