Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug-fix Filter.cs in ToExpression #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 0 additions & 70 deletions Kendo.DynamicLinq.Tests/Kendo.DynamicLinq.Tests.csproj

This file was deleted.

36 changes: 0 additions & 36 deletions Kendo.DynamicLinq.Tests/Properties/AssemblyInfo.cs

This file was deleted.

52 changes: 0 additions & 52 deletions Kendo.DynamicLinq.Tests/SerializationTests.cs

This file was deleted.

4 changes: 0 additions & 4 deletions Kendo.DynamicLinq.Tests/packages.config

This file was deleted.

7 changes: 6 additions & 1 deletion Kendo.DynamicLinq/Filter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ public string ToExpression(IList<Filter> filters)
int index = filters.IndexOf(this);

string comparison = operators[Operator];


if (this.Value.GetType().Equals(typeof(Guid)))
{
return String.Format("{0}.Equals(@{1})", Field, index);
}

if (Operator == "doesnotcontain")
{
return String.Format("!{0}.{1}(@{2})", Field, comparison, index);
Expand Down
1 change: 1 addition & 0 deletions Kendo.DynamicLinq/Kendo.DynamicLinq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QueryableExtensions.cs" />
<Compile Include="Sort.cs" />
<Compile Include="View.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Kendo.DynamicLinq.nuspec" />
Expand Down
42 changes: 42 additions & 0 deletions Kendo.DynamicLinq/View.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kendo.DynamicLinq
{
public class View
{
public int Take { get; set; }
public int Skip { get; set; }
public List<Sort> Sort { get; set; }
public Filter Filter { get; set; }
public List<Aggregator> Aggregates { get; set; }
/// <summary>
/// Filter.Value alanında guid değerler strint Type olarak gözükebilir, bu fonksiyon Guid ama string alan FieldType'ları Guid Type olarak günceller.
/// </summary>
public void FieldTypeCheckAll()
{
List<Filter> _filters = Filter.Filters.ToList();
for (int i = 0; i < _filters.Count; i++)
{
_filters[i] = FieldTypeCheck(_filters[i]);
}
Filter.Filters = (IEnumerable<Filter>)_filters;
Filter = FieldTypeCheck(Filter);
}

public Filter FieldTypeCheck(Filter filter)
{
if (filter.Value == null)
{ return filter; }

Guid _guidResult;
if (Guid.TryParse(filter.Value.ToString(), out _guidResult))
{
filter.Value = _guidResult;
}
return filter;
}
}
}