public static string ComparerToString(QueryComparer comparer) { switch (comparer) { case QueryComparer.Contains: return("Contains"); case QueryComparer.EndsWith: return("Ends With"); case QueryComparer.Equals: return("Equals"); case QueryComparer.NotEqual: return("Doesn't Equal"); case QueryComparer.GreaterThan: return("Greater Than"); case QueryComparer.Is: return("Is"); case QueryComparer.LessThan: return("Less Than"); case QueryComparer.StartsWith: return("Starts With"); case QueryComparer.NotStartsWith: return("Doesn't Start With"); case QueryComparer.NotEndsWith: return("Doesn't End With"); case QueryComparer.NotContains: return("Doesn't Contain"); default: return(comparer.ToString()); } }
public void SetupComparers(QueryComparer comparer) { if (Next != null) { if (GetSearchType().GetProperty(PropertyName).PropertyType.IsGenericType) { Comparer = QueryComparer.Count; } else { Comparer = QueryComparer.Property; } Next.SetupComparers(comparer); } else { if (comparer == QueryComparer.Equals || comparer == QueryComparer.NotEqual) { if (PropertyName != "Value" && GetSearchType().GetProperty(PropertyName).PropertyType == typeof(string) || PropertyName == "Value" && GetSearchType() == typeof(string)) { if (comparer == QueryComparer.Equals) { comparer = QueryComparer.StringEquals; } if (comparer == QueryComparer.NotEqual) { comparer = QueryComparer.StringNotEqual; } } if (PropertyName != "Value" && GetSearchType().GetProperty(PropertyName).PropertyType == typeof(bool)) { comparer = QueryComparer.Is; } } if (PropertyName != "Value" && GetSearchType().GetProperty(PropertyName).PropertyType.IsGenericType) { switch (comparer) { case QueryComparer.Equals: comparer = QueryComparer.ListEquals; break; case QueryComparer.GreaterThan: comparer = QueryComparer.ListGreaterThan; break; case QueryComparer.LessThan: comparer = QueryComparer.ListLessThan; break; } Next = Make(GetSearchType().GetProperty(PropertyName).PropertyType); Next.Operator = QueryOperator.Or; Next.Previous = this; Next.Comparer = QueryComparer.All; } Comparer = comparer; } }
public void SetupOrderByComparers(QueryComparer comparer) { if (Next != null) { if (comparer == QueryComparer.Min || comparer == QueryComparer.Max || comparer == QueryComparer.Average || comparer == QueryComparer.Sum) { Comparer = comparer; Next.Comparer = Comparer; } if (!GetSearchType().GetProperty(PropertyName).PropertyType.IsGenericType) { Comparer = QueryComparer.Property; } Next.SetupOrderByComparers(comparer); } else { if (comparer == QueryComparer.All) { Comparer = QueryComparer.All; Next = Make(GetSearchType().GetProperty(PropertyName).PropertyType); Next.Operator = QueryOperator.Or; Next.Previous = Next; Next.Comparer = QueryComparer.All; } else { if (comparer == QueryComparer.Equals || comparer == QueryComparer.NotEqual) { bool propertyIsString; if (PropertyName != "Value") { propertyIsString = GetSearchType().GetProperty(PropertyName).PropertyType == typeof(string); } else { propertyIsString = Previous.GetSearchType().GetProperty(Previous.PropertyName).PropertyType.GetGenericArguments()[0] == typeof(string); } if (propertyIsString && comparer == QueryComparer.Equals) { comparer = QueryComparer.StringEquals; } if (propertyIsString && comparer == QueryComparer.NotEqual) { comparer = QueryComparer.StringNotEqual; } } Comparer = comparer; } } }
public void SetupComparers(QueryComparer comparer) { if (this.Next != null) { if (this.GetSearchType().GetProperty(this.PropertyName).PropertyType.IsGenericType) { this.Comparer = QueryComparer.Count; } else { this.Comparer = QueryComparer.Property; } this.Next.SetupComparers(comparer); } else { if (comparer == QueryComparer.Equals || comparer == QueryComparer.NotEqual) { if ((this.PropertyName != "Value" && this.GetSearchType().GetProperty(this.PropertyName).PropertyType == typeof(string)) || (this.PropertyName == "Value" && this.GetSearchType() == typeof(string))) { if (comparer == QueryComparer.Equals) { comparer = QueryComparer.StringEquals; } if (comparer == QueryComparer.NotEqual) { comparer = QueryComparer.StringNotEqual; } } if (this.PropertyName != "Value" && this.GetSearchType().GetProperty(this.PropertyName).PropertyType == typeof(bool)) { comparer = QueryComparer.Is; } } if (this.PropertyName != "Value" && this.GetSearchType().GetProperty(this.PropertyName).PropertyType.IsGenericType) { switch (comparer) { case QueryComparer.Equals: comparer = LegendsViewer.Controls.Query.QueryComparer.ListEquals; break; case QueryComparer.GreaterThan: comparer = QueryComparer.ListGreaterThan; break; case QueryComparer.LessThan: comparer = QueryComparer.ListLessThan; break; } this.Next = SearchInfo.Make(this.GetSearchType().GetProperty(this.PropertyName).PropertyType); this.Next.Operator = QueryOperator.Or; this.Next.Previous = this; this.Next.Comparer = QueryComparer.All; } this.Comparer = comparer; } }
private void ComparerChanged(object sender, EventArgs e) { if (ComparerSelect.SelectedIndex >= 0) { QueryComparer comparer = (QueryComparer)ComparerSelect.SelectedItem; if (comparer == QueryComparer.Min || comparer == QueryComparer.Max || comparer == QueryComparer.Average || comparer == QueryComparer.Sum) { Controls.Remove(ValueSelect); } else if (!Controls.Contains(ValueSelect) && PropertySelect.Child != null && PropertySelect.Child.SelectedProperty != null && !PropertySelect.ContainsListLast()) { Controls.Add(ValueSelect); } } }
public void SetupComparers(QueryComparer comparer) { if (this.Next != null) { if (this.GetSearchType().GetProperty(this.PropertyName).PropertyType.IsGenericType) this.Comparer = QueryComparer.Count; else this.Comparer = QueryComparer.Property; this.Next.SetupComparers(comparer); } else { if (comparer == QueryComparer.Equals || comparer == QueryComparer.NotEqual) { if ((this.PropertyName != "Value" && this.GetSearchType().GetProperty(this.PropertyName).PropertyType == typeof(string)) || (this.PropertyName == "Value" && this.GetSearchType() == typeof(string))) { if (comparer == QueryComparer.Equals) comparer = QueryComparer.StringEquals; if (comparer == QueryComparer.NotEqual) comparer = QueryComparer.StringNotEqual; } if (this.PropertyName != "Value" && this.GetSearchType().GetProperty(this.PropertyName).PropertyType == typeof(bool)) { comparer = QueryComparer.Is; } } if (this.PropertyName != "Value" && this.GetSearchType().GetProperty(this.PropertyName).PropertyType.IsGenericType) { switch (comparer) { case QueryComparer.Equals: comparer = LegendsViewer.Controls.Query.QueryComparer.ListEquals; break; case QueryComparer.GreaterThan: comparer = QueryComparer.ListGreaterThan; break; case QueryComparer.LessThan: comparer = QueryComparer.ListLessThan; break; } this.Next = SearchInfo.Make(this.GetSearchType().GetProperty(this.PropertyName).PropertyType); this.Next.Operator = QueryOperator.Or; this.Next.Previous = this; this.Next.Comparer = QueryComparer.All; } this.Comparer = comparer; } }
public static string ComparerToString(QueryComparer comparer) { switch (comparer) { case QueryComparer.Contains: return "Contains"; case QueryComparer.EndsWith: return "Ends With"; case QueryComparer.Equals: return "Equals"; case QueryComparer.NotEqual: return "Doesn't Equal"; case QueryComparer.GreaterThan: return "Greater Than"; case QueryComparer.Is: return "Is"; case QueryComparer.LessThan: return "Less Than"; case QueryComparer.StartsWith: return "Starts With"; case QueryComparer.NotStartsWith: return "Doesn't Start With"; case QueryComparer.NotEndsWith: return "Doesn't End With"; case QueryComparer.NotContains: return "Doesn't Contain"; default: return comparer.ToString(); } }
public void SetupOrderByComparers(QueryComparer comparer) { if (this.Next != null) { if (comparer == QueryComparer.Min || comparer == QueryComparer.Max || comparer == QueryComparer.Average || comparer == QueryComparer.Sum) { this.Comparer = comparer; this.Next.Comparer = this.Comparer; } if (!this.GetSearchType().GetProperty(this.PropertyName).PropertyType.IsGenericType) this.Comparer = QueryComparer.Property; this.Next.SetupOrderByComparers(comparer); } else { if (comparer == QueryComparer.All) { this.Comparer = QueryComparer.All; this.Next = SearchInfo.Make(this.GetSearchType().GetProperty(this.PropertyName).PropertyType); this.Next.Operator = QueryOperator.Or; this.Next.Previous = Next; this.Next.Comparer = QueryComparer.All; } else { if (comparer == QueryComparer.Equals || comparer == QueryComparer.NotEqual) { bool propertyIsString; if (this.PropertyName != "Value") propertyIsString = this.GetSearchType().GetProperty(this.PropertyName).PropertyType == typeof(string); else propertyIsString = this.Previous.GetSearchType().GetProperty(Previous.PropertyName).PropertyType.GetGenericArguments()[0] == typeof(string); if (propertyIsString && comparer == QueryComparer.Equals) comparer = QueryComparer.StringEquals; if (propertyIsString && comparer == QueryComparer.NotEqual) comparer = QueryComparer.StringNotEqual; } this.Comparer = comparer; } } }