Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SieveModel Submodule Test
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nguyenvu
SieveModel Submodule Test
Commits
690ebde6
Commit
690ebde6
authored
Mar 19, 2021
by
VTHIEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed sieve model RemoveSignVietnameseString
parent
830e1291
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
3 deletions
+67
-3
RemoveVietNamSign.cs
Sieve/Models/RemoveVietNamSign.cs
+52
-0
SieveProcessor.cs
Sieve/Services/SieveProcessor.cs
+15
-3
No files found.
Sieve/Models/RemoveVietNamSign.cs
0 → 100644
View file @
690ebde6
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Sieve.Models
{
public
class
RemoveVietNamSign
{
private
string
[]
VietnameseSigns
=
new
string
[]
{
"aAeEoOuUiIdDyY"
,
"áàạảãâấầậẩẫăắằặẳẵ"
,
"ÁÀẠẢÃÂẤẦẬẨẪĂẮẰẶẲẴ"
,
"éèẹẻẽêếềệểễ"
,
"ÉÈẸẺẼÊẾỀỆỂỄ"
,
"óòọỏõôốồộổỗơớờợởỡ"
,
"ÓÒỌỎÕÔỐỒỘỔỖƠỚỜỢỞỠ"
,
"úùụủũưứừựửữ"
,
"ÚÙỤỦŨƯỨỪỰỬỮ"
,
"íìịỉĩ"
,
"ÍÌỊỈĨ"
,
"đ"
,
"Đ"
,
"ýỳỵỷỹ"
,
"ÝỲỴỶỸ"
};
public
string
RemoveSignAndLowerCase4VietnameseString
(
string
str
)
{
for
(
int
i
=
1
;
i
<
VietnameseSigns
.
Length
;
i
++)
{
for
(
int
j
=
0
;
j
<
VietnameseSigns
[
i
].
Length
;
j
++)
str
=
str
.
Replace
(
VietnameseSigns
[
i
][
j
],
VietnameseSigns
[
0
][
i
-
1
]);
}
return
str
;
}
}
}
Sieve/Services/SieveProcessor.cs
View file @
690ebde6
...
...
@@ -386,7 +386,8 @@ namespace Sieve.Services
}
return
Expression
.
Lambda
<
Func
<
TEntity
,
bool
>>(
outerExpression
,
parameterExpression
);
}
private
IQueryable
<
TEntity
>
ApplyFiltering
<
TEntity
>(
TSieveModel
model
,
IQueryable
<
TEntity
>
result
,
...
...
@@ -420,6 +421,7 @@ namespace Sieve.Services
foreach
(
var
filterTermValue
in
filterTerm
.
Values
)
{
//string filterTermValue = this.RemoveSign4VietnameseString(filterTermValue1); //Added by thien to emove vietnam
dynamic
constantVal
=
converter
.
CanConvertFrom
(
typeof
(
string
))
?
converter
.
ConvertFrom
(
filterTermValue
)
...
...
@@ -428,12 +430,22 @@ namespace Sieve.Services
Expression
filterValue
=
GetClosureOverConstant
(
constantVal
,
property
.
PropertyType
);
if
(
filterTerm
.
OperatorIsCaseInsensitive
)
if
(
true
)
//filterTerm.OperatorIsCaseInsensitive Make search insensitive case //comment by thien
{
propertyValue
=
Expression
.
Call
(
propertyValue
,
var
upperData
=
Expression
.
Call
(
propertyValue
,
typeof
(
string
).
GetMethods
()
.
First
(
m
=>
m
.
Name
==
"ToUpper"
&&
m
.
GetParameters
().
Length
==
0
));
propertyValue
=
Expression
.
Call
(
Expression
.
New
(
typeof
(
RemoveVietNamSign
)),
typeof
(
RemoveVietNamSign
).
GetMethod
(
"RemoveSignVietnameseString"
,
new
Type
[]
{
typeof
(
string
)}),
upperData
);
/*propertyValue = Expression.Call(propertyValue,
typeof(string).GetMethods()
.First(m => m.Name == "ToUpper" && m.GetParameters().Length == 0));*/
filterValue
=
Expression
.
Call
(
filterValue
,
typeof
(
string
).
GetMethods
()
.
First
(
m
=>
m
.
Name
==
"ToUpper"
&&
m
.
GetParameters
().
Length
==
0
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment