2026-08-21 19:27:59 +00:00
|
|
|
|
using System.Collections.Generic;
|
2026-08-06 22:54:50 +00:00
|
|
|
|
using Microsoft.Extensions.Localization;
|
|
|
|
|
|
using Sozsoft.Platform;
|
|
|
|
|
|
using Sozsoft.Platform.Entities;
|
|
|
|
|
|
using Sozsoft.Platform.Enums;
|
|
|
|
|
|
using Sozsoft.Platform.ListForms;
|
2026-08-21 19:27:59 +00:00
|
|
|
|
using Sozsoft.Platform.Localization;
|
2026-08-06 22:54:50 +00:00
|
|
|
|
using Sozsoft.Platform.Queries;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Sozsoft.Reports.PredefinedReports;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Grid ve Tree raporlarının ortak kolon tanımı.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
internal sealed record DynamicReportColumn(
|
|
|
|
|
|
ListFormField Field,
|
|
|
|
|
|
string BindingName,
|
|
|
|
|
|
LookupDto Lookup,
|
|
|
|
|
|
Dictionary<string, string> StaticLookupValues,
|
|
|
|
|
|
bool IsMultiValue,
|
|
|
|
|
|
bool IsImage,
|
|
|
|
|
|
bool IsHtml,
|
|
|
|
|
|
string EditorType,
|
|
|
|
|
|
int ImageCount = 1) : DynamicReportSqlBuilder.IReportLookupColumn, DynamicReportGridStateHelper.IReportColumnWidth
|
|
|
|
|
|
{
|
|
|
|
|
|
public float ImageWidth => DynamicReportImageHelper.GetGridImageColumnWidth(ImageCount);
|
|
|
|
|
|
|
|
|
|
|
|
public bool HasBindingName =>
|
|
|
|
|
|
!string.IsNullOrWhiteSpace(BindingName) && BindingName != "undefined";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal static class DynamicReportColumnFactory
|
|
|
|
|
|
{
|
|
|
|
|
|
public static DynamicReportColumn Create(
|
|
|
|
|
|
ListFormField field,
|
|
|
|
|
|
SelectField selectField,
|
|
|
|
|
|
DefaultValueHelper defaultValueHelper,
|
|
|
|
|
|
string editorType,
|
|
|
|
|
|
IStringLocalizer<PlatformResource> localizer)
|
|
|
|
|
|
{
|
|
|
|
|
|
var bindingName = DynamicReportImageHelper.GetReportFieldName(selectField);
|
|
|
|
|
|
var lookup = DynamicReportImageHelper.GetLookup(field);
|
|
|
|
|
|
var isMultiValue = IsMultiValueLookupEditor(editorType);
|
|
|
|
|
|
var isImage = DynamicReportImageHelper.IsImageEditor(editorType);
|
|
|
|
|
|
var isHtml = editorType == PlatformConsts.EditorTypes.dxHtmlEditor;
|
|
|
|
|
|
|
2026-10-02 09:29:22 +00:00
|
|
|
|
if (lookup == null || selectField?.IsJoined == true)
|
2026-08-06 22:54:50 +00:00
|
|
|
|
{
|
|
|
|
|
|
return new DynamicReportColumn(field, bindingName, null, null, isMultiValue, isImage, isHtml, editorType);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (DynamicReportSqlBuilder.IsReportQueryableLookup(lookup))
|
|
|
|
|
|
{
|
|
|
|
|
|
return new DynamicReportColumn(
|
|
|
|
|
|
field,
|
|
|
|
|
|
DynamicReportSqlBuilder.GetLookupBindingName(field),
|
|
|
|
|
|
lookup,
|
|
|
|
|
|
null,
|
|
|
|
|
|
isMultiValue,
|
|
|
|
|
|
isImage,
|
|
|
|
|
|
isHtml,
|
|
|
|
|
|
editorType);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (lookup.DataSourceType == UiLookupDataSourceTypeEnum.StaticData)
|
|
|
|
|
|
{
|
|
|
|
|
|
var staticLookupValues = DynamicReportImageHelper.GetStaticLookupValues(
|
|
|
|
|
|
lookup,
|
|
|
|
|
|
defaultValueHelper,
|
|
|
|
|
|
localizer);
|
|
|
|
|
|
return new DynamicReportColumn(
|
|
|
|
|
|
field,
|
|
|
|
|
|
staticLookupValues?.Count > 0 ? DynamicReportSqlBuilder.GetLookupBindingName(field) : bindingName,
|
|
|
|
|
|
lookup,
|
|
|
|
|
|
staticLookupValues,
|
|
|
|
|
|
isMultiValue,
|
|
|
|
|
|
isImage,
|
|
|
|
|
|
isHtml,
|
|
|
|
|
|
editorType);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new DynamicReportColumn(field, bindingName, null, null, isMultiValue, isImage, isHtml, editorType);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsMultiValueLookupEditor(string editorType)
|
|
|
|
|
|
{
|
|
|
|
|
|
return editorType is PlatformConsts.EditorTypes.dxTagBox or "dxGridBox";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|