Filtrelemelerdeki Türkçe Karakterler düzeltildi
This commit is contained in:
parent
2118acf6e1
commit
d8763d6dee
5 changed files with 20 additions and 10 deletions
|
|
@ -105,7 +105,8 @@ public class DynamicFormReport : XtraReport
|
|||
var reportFields = GetReportFields(listForm, fields, selectQueryManager, defaultValueHelper);
|
||||
var selectQuery = DynamicReportImageHelper.StripReportPaging(DynamicReportImageHelper.ApplyQueryParameters(
|
||||
selectQueryManager.SelectQuery,
|
||||
selectQueryManager.SelectQueryParameters));
|
||||
selectQueryManager.SelectQueryParameters,
|
||||
dataSourceType));
|
||||
selectQuery = DynamicReportSqlBuilder.ApplyLookupTextColumns(
|
||||
selectQuery,
|
||||
reportFields,
|
||||
|
|
|
|||
|
|
@ -134,7 +134,8 @@ public class DynamicGridReport : XtraReport
|
|||
|
||||
var selectQuery = DynamicReportImageHelper.StripReportPaging(DynamicReportImageHelper.ApplyQueryParameters(
|
||||
selectQueryManager.SelectQuery,
|
||||
selectQueryManager.SelectQueryParameters));
|
||||
selectQueryManager.SelectQueryParameters,
|
||||
dataSourceType));
|
||||
selectQuery = DynamicReportSqlBuilder.ApplyLookupTextColumns(
|
||||
selectQuery,
|
||||
reportColumns,
|
||||
|
|
|
|||
|
|
@ -121,7 +121,10 @@ internal static class DynamicReportImageHelper
|
|||
: $"XpoProvider={provider};{connectionString}";
|
||||
}
|
||||
|
||||
public static string ApplyQueryParameters(string sql, Dictionary<string, object> parameters)
|
||||
public static string ApplyQueryParameters(
|
||||
string sql,
|
||||
Dictionary<string, object> parameters,
|
||||
DataSourceTypeEnum? dataSourceType = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sql) || parameters == null || parameters.Count == 0)
|
||||
{
|
||||
|
|
@ -134,7 +137,7 @@ internal static class DynamicReportImageHelper
|
|||
sql = Regex.Replace(
|
||||
sql,
|
||||
Regex.Escape(key) + @"\b",
|
||||
ToSqlLiteral(parameter.Value),
|
||||
ToSqlLiteral(parameter.Value, dataSourceType),
|
||||
RegexOptions.CultureInvariant);
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +151,7 @@ internal static class DynamicReportImageHelper
|
|||
: ReportPagingRegex.Replace(sql, string.Empty);
|
||||
}
|
||||
|
||||
public static string ToSqlLiteral(object value)
|
||||
public static string ToSqlLiteral(object value, DataSourceTypeEnum? dataSourceType = null)
|
||||
{
|
||||
if (value == null || value == DBNull.Value)
|
||||
{
|
||||
|
|
@ -157,7 +160,9 @@ internal static class DynamicReportImageHelper
|
|||
|
||||
return value switch
|
||||
{
|
||||
string text => $"'{text.Replace("'", "''")}'",
|
||||
string text => dataSourceType == DataSourceTypeEnum.Mssql
|
||||
? $"N'{text.Replace("'", "''")}'"
|
||||
: $"'{text.Replace("'", "''")}'",
|
||||
Guid guid => $"'{guid}'",
|
||||
DateTime date => $"'{date:yyyy-MM-dd HH:mm:ss.fff}'",
|
||||
DateTimeOffset date => $"'{date:yyyy-MM-dd HH:mm:ss.fff zzz}'",
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ internal static class DynamicReportSqlBuilder
|
|||
{
|
||||
if (column.StaticLookupValues?.Count > 0)
|
||||
{
|
||||
return CreateStaticLookupSelectPart(column);
|
||||
return CreateStaticLookupSelectPart(column, dataSourceType);
|
||||
}
|
||||
|
||||
if (column.Lookup != null && IsReportQueryableLookup(column.Lookup))
|
||||
|
|
@ -81,11 +81,13 @@ internal static class DynamicReportSqlBuilder
|
|||
return null;
|
||||
}
|
||||
|
||||
private static string CreateStaticLookupSelectPart(IReportLookupColumn column)
|
||||
private static string CreateStaticLookupSelectPart(
|
||||
IReportLookupColumn column,
|
||||
DataSourceTypeEnum dataSourceType)
|
||||
{
|
||||
var sourceField = GetSourceField(column.Field.FieldName);
|
||||
var cases = column.StaticLookupValues
|
||||
.Select(item => $"WHEN {DynamicReportImageHelper.ToSqlLiteral(item.Key)} THEN {DynamicReportImageHelper.ToSqlLiteral(item.Value)}");
|
||||
.Select(item => $"WHEN {DynamicReportImageHelper.ToSqlLiteral(item.Key, dataSourceType)} THEN {DynamicReportImageHelper.ToSqlLiteral(item.Value, dataSourceType)}");
|
||||
|
||||
return $"CASE {sourceField} {string.Join(" ", cases)} ELSE CAST({sourceField} AS VARCHAR(4000)) END AS {QuoteSqlIdentifier(column.BindingName)}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,8 @@ public class DynamicTreeReport : XtraReport
|
|||
|
||||
var selectQuery = DynamicReportImageHelper.StripReportPaging(DynamicReportImageHelper.ApplyQueryParameters(
|
||||
selectQueryManager.SelectQuery,
|
||||
selectQueryManager.SelectQueryParameters));
|
||||
selectQueryManager.SelectQueryParameters,
|
||||
dataSourceType));
|
||||
selectQuery = DynamicReportSqlBuilder.ApplyLookupTextColumns(
|
||||
selectQuery,
|
||||
reportColumns,
|
||||
|
|
|
|||
Loading…
Reference in a new issue