DefaultValueHelper ve List Form Seederlar

This commit is contained in:
Sedat Öztürk 2025-10-07 23:55:42 +03:00
parent 48b49ef699
commit e03de27b85
6 changed files with 484 additions and 162 deletions

View file

@ -26,17 +26,20 @@ public class CustomEndpointAppService : PlatformAppService
private readonly IHttpContextAccessor httpContextAccessor;
private readonly IDataSourceManager dataSourceManager;
private readonly IDynamicDataManager dynamicDataManager;
private readonly DefaultValueHelper defaultValueHelper;
public CustomEndpointAppService(
IRepository<CustomEndpoint, Guid> repo,
IHttpContextAccessor httpContextAccessor,
IDataSourceManager dataSourceManager,
IDynamicDataManager dynamicDataManager)
IDynamicDataManager dynamicDataManager,
DefaultValueHelper defaultValueHelper)
{
this.repo = repo;
this.httpContextAccessor = httpContextAccessor;
this.dataSourceManager = dataSourceManager;
this.dynamicDataManager = dynamicDataManager;
this.defaultValueHelper = defaultValueHelper;
}
[HttpGet("{**path}")]
@ -93,7 +96,7 @@ public class CustomEndpointAppService : PlatformAppService
// 1- Statik
foreach (var item in api.Parameters.Where(a => a.Type == PlatformConsts.CustomEndpointConsts.ParameterTypes.Static))
{
var value = GetDefaultValue(item.DefaultValue);
var value = defaultValueHelper.GetDefaultValue(item.DefaultValue);
param.Add(item.Name, value);
}
@ -113,7 +116,7 @@ public class CustomEndpointAppService : PlatformAppService
}
else
{
param.Add(item.Name, GetDefaultValue(item.DefaultValue));
param.Add(item.Name, defaultValueHelper.GetDefaultValue(item.DefaultValue));
}
}
}
@ -129,7 +132,7 @@ public class CustomEndpointAppService : PlatformAppService
}
var segmentCount = itemPath[..(index + 1)].Count(a => a == '/');
var value = path.GetSegment('/', segmentCount);
param.Add(item.Name, value ?? GetDefaultValue(item.DefaultValue));
param.Add(item.Name, value ?? defaultValueHelper.GetDefaultValue(item.DefaultValue));
}
// 4- Body
@ -150,7 +153,7 @@ public class CustomEndpointAppService : PlatformAppService
}
else
{
param.Add(item.Name, GetDefaultValue(item.DefaultValue));
param.Add(item.Name, defaultValueHelper.GetDefaultValue(item.DefaultValue));
}
}
}
@ -195,15 +198,6 @@ public class CustomEndpointAppService : PlatformAppService
};
}
}
private string GetDefaultValue(string strValue)
{
return strValue?.Replace(PlatformConsts.DefaultValues.UserId, CurrentUser.Id.ToString())
.Replace(PlatformConsts.DefaultValues.UserName, CurrentUser.UserName)
.Replace(PlatformConsts.DefaultValues.Roles, CurrentUser.Roles.JoinAsString("','"))
.Replace(PlatformConsts.DefaultValues.Now, Clock.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture))
.Replace(PlatformConsts.DefaultValues.TenantId, CurrentTenant.Id.HasValue ? CurrentTenant.Id.ToString() : null);
}
}
//TODO: Custom Endpoint rol, permission seed

View file

@ -31,6 +31,7 @@ public class ListFormSelectAppService : PlatformAppService, IListFormSelectAppSe
private readonly IHttpContextAccessor httpContextAccessor;
private readonly IDataSourceManager dataSourceManager;
private readonly IDynamicDataManager dynamicDataManager;
private readonly DefaultValueHelper defaultValueHelper;
private readonly string userId;
private readonly string[] roleIds;
private readonly string cultureName;
@ -47,7 +48,8 @@ public class ListFormSelectAppService : PlatformAppService, IListFormSelectAppSe
IDefaultValueManager defaultValueManager,
IHttpContextAccessor httpContextAccessor,
IDataSourceManager dataSourceManager,
IDynamicDataManager dynamicDataManager
IDynamicDataManager dynamicDataManager,
DefaultValueHelper defaultValueHelper
)
{
this.listFormRepository = listFormRepository;
@ -62,6 +64,7 @@ public class ListFormSelectAppService : PlatformAppService, IListFormSelectAppSe
this.httpContextAccessor = httpContextAccessor;
this.dataSourceManager = dataSourceManager;
this.dynamicDataManager = dynamicDataManager;
this.defaultValueHelper = defaultValueHelper;
userId = currentUser.Name;
roleIds = currentUser.Roles;
cultureName = CultureInfo.CurrentUICulture.Name;
@ -376,6 +379,7 @@ public class ListFormSelectAppService : PlatformAppService, IListFormSelectAppSe
var lookup = JsonSerializer.Deserialize<LookupDto>(field.LookupJson);
if (!string.IsNullOrWhiteSpace(lookup.LookupQuery))
{
var lookupQuery = defaultValueHelper.GetDefaultValue(lookup.LookupQuery);
var parameters = new Dictionary<string, object>();
if (input.Filters != null)
{
@ -384,7 +388,7 @@ public class ListFormSelectAppService : PlatformAppService, IListFormSelectAppSe
parameters.Add("@param" + i, input.Filters[i]);
}
}
return await dynamicDataRepository.QueryAsync(lookup.LookupQuery, connectionString, parameters);
return await dynamicDataRepository.QueryAsync(lookupQuery, connectionString, parameters);
}
}

View file

@ -54,6 +54,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
var lookupQueryTenantValues = $"SELECT \"AbpTenants\".\"Id\" AS \"Key\", \"AbpTenants\".\"Name\" as \"Name\" FROM \"AbpTenants\" ORDER BY \"AbpTenants\".\"Name\"";
var lookupQueryBranchValues = $"SELECT \"{SelectCommandByTableName("Branch")}\".\"Id\" AS \"Key\", \"{SelectCommandByTableName("Branch")}\".\"Name\" as \"Name\" FROM \"{SelectCommandByTableName("Branch")}\" ORDER BY \"{SelectCommandByTableName("Branch")}\".\"Name\"";
//var lookupQueryBranchValues = $"SELECT \"{SelectCommandByTableName("Branch")}\".\"Id\" AS \"Key\", \"{SelectCommandByTableName("Branch")}\".\"Name\" as \"Name\" FROM \"{SelectCommandByTableName("Branch")}\" WHERE \"{SelectCommandByTableName("Branch")}\".\"TenantId\" = '@TENANTID' ORDER BY \"{SelectCommandByTableName("Branch")}\".\"Name\"";
var lookupQueryRegistrationTypeValues = $"SELECT \"{SelectCommandByTableName("RegistrationType", Prefix.DbTableDefinition)}\".\"Id\" AS \"Key\", \"{SelectCommandByTableName("RegistrationType", Prefix.DbTableDefinition)}\".\"Name\" as \"Name\" FROM \"{SelectCommandByTableName("RegistrationType", Prefix.DbTableDefinition)}\" ORDER BY \"{SelectCommandByTableName("RegistrationType", Prefix.DbTableDefinition)}\".\"Name\"";
var lookupQueryClassTypeValues = $"SELECT \"{SelectCommandByTableName("ClassType", Prefix.DbTableDefinition)}\".\"Id\" AS \"Key\", \"{SelectCommandByTableName("ClassType", Prefix.DbTableDefinition)}\".\"Name\" as \"Name\" FROM \"{SelectCommandByTableName("ClassType", Prefix.DbTableDefinition)}\" ORDER BY \"{SelectCommandByTableName("ClassType", Prefix.DbTableDefinition)}\".\"Name\"";
@ -766,17 +767,18 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
ColSpan = 2,
ItemType = "group",
Items = [
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 3, DataField = "IdentifierCode", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox},
new EditingFormItemDto { Order = 4, DataField = "AddressLine1", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "AddressLine2", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 6, DataField = "Country", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 7, DataField = "City", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 8, DataField = "District", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 9, DataField = "PostalCode", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 10, DataField = "Phone", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 11, DataField = "Email", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, ]
new EditingFormItemDto { Order = 1, DataField = "TenantId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "IdentifierCode", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox},
new EditingFormItemDto { Order = 5, DataField = "AddressLine1", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 6, DataField = "AddressLine2", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 7, DataField = "Country", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 8, DataField = "City", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 9, DataField = "District", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 10, DataField = "PostalCode", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 11, DataField = "Phone", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 12, DataField = "Email", ColSpan = 1, EditorType2=EditorTypes.dxTextBox }, ]
}
}),
InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
@ -815,7 +817,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
@ -837,6 +839,37 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
IsPivot = true
})
},
// TenantId
new()
{
ListFormCode = formBank.ListFormCode,
CultureName = LanguageCodes.En,
RoleId = null,
UserId = null,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 150,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryTenantValues,
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.Bank + ".Create",
R = AppCodes.Definitions.Bank,
U = AppCodes.Definitions.Bank + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// BranchId
new()
{
@ -19300,8 +19333,8 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
ItemType = "group",
Items =
[
new EditingFormItemDto { Order = 1, DataField = "CategoryId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "TypeId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 1, DataField = "CategoryId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 2, DataField = "TypeId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "Place", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
@ -23385,9 +23418,10 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
ItemType = "group",
Items =
[
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 3, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 1, DataField = "TenantId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
]
}
}),
@ -23420,7 +23454,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
@ -23440,6 +23474,39 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// TenantId
new()
{
ListFormCode = listFormRegistrationType.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 150,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryTenantValues,
}),
ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[]
{
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.RegistrationType + ".Create",
R = AppCodes.Definitions.RegistrationType,
U = AppCodes.Definitions.RegistrationType + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// BranchId
new()
{
@ -23637,10 +23704,11 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
ItemType = "group",
Items =
[
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "RegistrationTypeId", IsRequired = true, ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 1, DataField = "TenantId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "RegistrationTypeId", IsRequired = true, ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
]
}
}),
@ -23673,7 +23741,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
@ -23692,6 +23760,39 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// TenantId
new()
{
ListFormCode = listFormRegistrationMethod.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 150,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryTenantValues,
}),
ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[]
{
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.RegistrationMethod + ".Create",
R = AppCodes.Definitions.RegistrationMethod,
U = AppCodes.Definitions.RegistrationMethod + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// BranchId
new()
{
@ -23918,12 +24019,13 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
ItemType = "group",
Items =
[
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "RegistrationTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "MinStudentCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 5, DataField = "MaxStudentCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 6, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 1, DataField = "TenantId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "RegistrationTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "MinStudentCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 6, DataField = "MaxStudentCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 7, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
]
}
}),
@ -23956,7 +24058,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
@ -23978,6 +24080,39 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
},
// BranchId
new()
{
ListFormCode = listFormClassType.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 150,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryTenantValues,
}),
ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[]
{
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.ClassType + ".Create",
R = AppCodes.Definitions.ClassType,
U = AppCodes.Definitions.ClassType + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// BranchId
new()
{
ListFormCode = listFormClassType.ListFormCode,
CultureName = LanguageCodes.En,
@ -24248,10 +24383,11 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
ItemType = "group",
Items =
[
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "ClassTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 1, DataField = "TenantId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "ClassTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
]
}
}),
@ -24284,7 +24420,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
@ -24303,6 +24439,39 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// TenantId
new()
{
ListFormCode = listFormClass.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 150,
ListOrderNo = 2,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryTenantValues,
}),
ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[]
{
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.Class + ".Create",
R = AppCodes.Definitions.Class,
U = AppCodes.Definitions.Class + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// BranchId
new()
{
@ -24529,14 +24698,15 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
ItemType = "group",
Items =
[
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "ClassTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "LevelType", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "LessonCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 6, DataField = "LessonDuration", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 7, DataField = "MonthlyPaymentRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 8, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 1, DataField = "TenantId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "ClassTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 4, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "LevelType", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 6, DataField = "LessonCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 7, DataField = "LessonDuration", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 8, DataField = "MonthlyPaymentRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 9, DataField = "Status", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
]
}
}),
@ -24569,7 +24739,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
@ -24588,6 +24758,39 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// TenantId
new()
{
ListFormCode = listFormLevel.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 150,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryTenantValues,
}),
ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[]
{
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.Level + ".Create",
R = AppCodes.Definitions.Level,
U = AppCodes.Definitions.Level + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// BranchId
new()
{
@ -24906,13 +25109,14 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
ItemType = "group",
Items =
[
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 3, DataField = "Day", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "Lesson1", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 5, DataField = "Lesson2", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 6, DataField = "Lesson3", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 7, DataField = "Lesson4", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 1, DataField = "TenantId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "Day", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "Lesson1", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 6, DataField = "Lesson2", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 7, DataField = "Lesson3", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 8, DataField = "Lesson4", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
]
}
}),
@ -24938,7 +25142,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
@ -24958,6 +25162,40 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// TenantId
new()
{
ListFormCode = listFormLessonPeriod.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 150,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
SortIndex = 1,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryTenantValues,
}),
ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[]
{
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.LessonPeriod + ".Create",
R = AppCodes.Definitions.LessonPeriod,
U = AppCodes.Definitions.LessonPeriod + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// BranchId
new()
{
@ -25291,24 +25529,25 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
Order = 1, ColCount = 2, ColSpan = 2, ItemType = "group",
Items =
[
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 3, DataField = "StartTime", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "EndTime", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "LessonMinute", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 6, DataField = "LessonBreakMinute", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 7, DataField = "LessonCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 8, DataField = "IncludeLunch", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 9, DataField = "LunchTime", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 10, DataField = "LunchMinute", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 11, DataField = "Monday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 12, DataField = "Tuesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 13, DataField = "Wednesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 14, DataField = "Thursday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 15, DataField = "Friday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 16, DataField = "Saturday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 17, DataField = "Sunday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 18, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 1, DataField = "TenantId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "StartTime", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "EndTime", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 6, DataField = "LessonMinute", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 7, DataField = "LessonBreakMinute", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 8, DataField = "LessonCount", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 9, DataField = "IncludeLunch", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 10, DataField = "LunchTime", ColSpan = 1, EditorType2 = EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 11, DataField = "LunchMinute", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox },
new EditingFormItemDto { Order = 12, DataField = "Monday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 13, DataField = "Tuesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 14, DataField = "Wednesday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 15, DataField = "Thursday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 16, DataField = "Friday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 17, DataField = "Saturday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 18, DataField = "Sunday", ColSpan = 1, EditorType2 = EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 19, DataField = "Status", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
]
}
}),
@ -25391,7 +25630,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
@ -25409,6 +25648,34 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// TenantId
new() {
ListFormCode = listFormSchedule.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 150,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryTenantValues,
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.Schedule + ".Create",
R = AppCodes.Definitions.Schedule,
U = AppCodes.Definitions.Schedule + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// BranchId
new() {
ListFormCode = listFormSchedule.ListFormCode,
@ -25983,11 +26250,12 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
ItemType = "group",
Items =
[
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "Date", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox },
new EditingFormItemDto { Order = 3, DataField = "Breakfast", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
new EditingFormItemDto { Order = 4, DataField = "Lunch", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
new EditingFormItemDto { Order = 5, DataField = "Snack", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
new EditingFormItemDto { Order = 1, DataField = "TenantId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "Date", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox },
new EditingFormItemDto { Order = 4, DataField = "Breakfast", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
new EditingFormItemDto { Order = 5, DataField = "Lunch", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
new EditingFormItemDto { Order = 6, DataField = "Snack", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
]
}
}),
@ -26031,7 +26299,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
@ -26050,6 +26318,35 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// TenantId
new()
{
ListFormCode = listFormMeal.ListFormCode,
CultureName = LanguageCodes.En,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 150,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryTenantValues,
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.Meal + ".Create",
R = AppCodes.Definitions.Meal,
U = AppCodes.Definitions.Meal + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// BranchId
new()
{
@ -26292,17 +26589,18 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=
[
new EditingFormItemDto { Order = 1, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 3, DataField = "IdentifierCode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox},
new EditingFormItemDto { Order = 4, DataField = "AddressLine1", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "AddressLine2", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 6, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 7, DataField = "City", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 8, DataField = "District", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 9, DataField = "PostalCode", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 10, DataField = "Phone", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 11, DataField = "Email", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 1, DataField = "TenantId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 3, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "IdentifierCode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox},
new EditingFormItemDto { Order = 5, DataField = "AddressLine1", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 6, DataField = "AddressLine2", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 7, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 8, DataField = "City", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 9, DataField = "District", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 10, DataField = "PostalCode", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 11, DataField = "Phone", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 12, DataField = "Email", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
]
}
}),
@ -26352,7 +26650,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "Id",
Width = 100,
ListOrderNo = 1,
ListOrderNo = 0,
Visible = false,
IsActive = true,
IsDeleted = false,
@ -26374,6 +26672,37 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
IsPivot = true
})
},
// TenantId
new()
{
ListFormCode = listFormBank.ListFormCode,
CultureName = LanguageCodes.En,
RoleId = null,
UserId = null,
SourceDbType = DbType.Guid,
FieldName = "TenantId",
Width = 150,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryTenantValues,
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.Bank + ".Create",
R = AppCodes.Definitions.Bank,
U = AppCodes.Definitions.Bank + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
// BranchId
new()
{
@ -26828,11 +27157,10 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=
[
new EditingFormItemDto { Order = 1, DataField = "BankId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 2, DataField = "BranchId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox },
new EditingFormItemDto { Order = 3, DataField = "AccountNumber", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "AccountOwner", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "CurrencyId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 6, DataField = "CanTransferMoney", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox },
new EditingFormItemDto { Order = 2, DataField = "AccountNumber", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 3, DataField = "AccountOwner", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "CurrencyId", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 5, DataField = "CanTransferMoney", ColSpan = 2, EditorType2=EditorTypes.dxCheckBox },
]
}
}),
@ -26929,37 +27257,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
IsPivot = true
})
},
// BranchId
new()
{
ListFormCode = listFormBankAccount.ListFormCode,
CultureName = LanguageCodes.En,
RoleId = null,
UserId = null,
SourceDbType = DbType.Guid,
FieldName = "BranchId",
Width = 150,
ListOrderNo = 3,
Visible = true,
IsActive = true,
IsDeleted = false,
LookupJson = JsonSerializer.Serialize(new LookupDto {
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = lookupQueryBranchValues,
}),
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = AppCodes.Definitions.BankAccount + ".Create",
R = AppCodes.Definitions.BankAccount,
U = AppCodes.Definitions.BankAccount + ".Update",
E = true,
I = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto { IsPivot = true })
},
new() {
ListFormCode = listFormBankAccount.ListFormCode,
RoleId = null,
@ -26968,7 +27265,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.String,
FieldName = "AccountNumber",
Width = 150,
ListOrderNo = 4,
ListOrderNo = 3,
Visible = true,
IsActive = true,
IsDeleted = false,
@ -27000,7 +27297,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.String,
FieldName = "AccountOwner",
Width = 250,
ListOrderNo = 5,
ListOrderNo = 4,
Visible = true,
IsActive = true,
IsDeleted = false,
@ -27031,7 +27328,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Guid,
FieldName = "CurrencyId",
Width = 150,
ListOrderNo = 6,
ListOrderNo = 5,
Visible = true,
IsActive = true,
IsDeleted = false,
@ -27065,7 +27362,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc
SourceDbType = DbType.Boolean,
FieldName = "CanTransferMoney",
Width = 50,
ListOrderNo = 7,
ListOrderNo = 6,
Visible = true,
IsActive = true,
IsDeleted = false,

View file

@ -0,0 +1,34 @@
using System;
using System.Globalization;
using Kurs.Platform;
using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Users;
public class DefaultValueHelper : ITransientDependency
{
private ICurrentUser _currentUser;
private ICurrentTenant _currentTenant;
public DefaultValueHelper(
ICurrentUser currentUser,
ICurrentTenant currentTenant
)
{
_currentUser = currentUser;
_currentTenant = currentTenant;
}
public string GetDefaultValue(string strValue)
{
if (string.IsNullOrEmpty(strValue))
return strValue;
return strValue
.Replace(PlatformConsts.DefaultValues.UserId, _currentUser.Id.ToString())
.Replace(PlatformConsts.DefaultValues.UserName, _currentUser.UserName)
.Replace(PlatformConsts.DefaultValues.Roles, string.Join("','", _currentUser.Roles))
.Replace(PlatformConsts.DefaultValues.Now, DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture))
.Replace(PlatformConsts.DefaultValues.TenantId, _currentTenant.Id.HasValue ? _currentTenant.Id.ToString() : Guid.Empty.ToString());
}
}

View file

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.Json;
@ -107,6 +106,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
public bool IsAppliedServerFilter { get; private set; }
public IPlatformOuRepository OuRepository { get; }
public IRepository<BranchUsers, Guid> BranchUsersRepository { get; }
public DefaultValueHelper DefaultValueHelper { get; }
public SelectQueryManager(
ISettingProvider settingProvider,
@ -115,7 +115,8 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
IObjectMapper objectMapper,
IListFormAuthorizationManager authManager,
IPlatformOuRepository ouRepository,
IRepository<BranchUsers, Guid> branchUsersRepository)
IRepository<BranchUsers, Guid> branchUsersRepository,
DefaultValueHelper defaultValueHelper)
: base(settingProvider, localizer, currentUser, objectMapper, authManager)
{
SelectFields = [];
@ -125,6 +126,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
SummaryQueries = [];
OuRepository = ouRepository;
BranchUsersRepository = branchUsersRepository;
DefaultValueHelper = defaultValueHelper;
}
public void PrepareQueries(ListForm listform,
@ -146,7 +148,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
int skip = queryParams?.Skip ?? 0;
DataSourceType = dataSourceType;
SelectCommand = GetDefaultValue(listform.SelectCommand);
SelectCommand = DefaultValueHelper.GetDefaultValue(listform.SelectCommand);
TableName = listform.TableName.IsNullOrEmpty() ? SelectCommand : listform.TableName;
KeyFieldName = listform.KeyFieldName;
SelectCommandType = listform.SelectCommandType;
@ -312,7 +314,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
WhereParts.Add("AND");
}
WhereParts.Add(GetDefaultValue(item));
WhereParts.Add(DefaultValueHelper.GetDefaultValue(item));
IsAppliedServerFilter = true;
}
}
@ -382,7 +384,7 @@ public class SelectQueryManager : PlatformDomainService, ISelectQueryManager
whereParts.Add("AND");
}
whereParts.Add(GetDefaultValue(listform.DefaultFilter));
whereParts.Add(DefaultValueHelper.GetDefaultValue(listform.DefaultFilter));
IsAppliedServerFilter = true;
}
@ -811,13 +813,4 @@ GROUP BY {argumentExpression}";
return sql;
}
private string GetDefaultValue(string strValue)
{
return strValue?.Replace(PlatformConsts.DefaultValues.UserId, CurrentUser.Id.ToString())
.Replace(PlatformConsts.DefaultValues.UserName, CurrentUser.UserName)
.Replace(PlatformConsts.DefaultValues.Roles, CurrentUser.Roles.JoinAsString("','"))
.Replace(PlatformConsts.DefaultValues.Now, DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture))
.Replace(PlatformConsts.DefaultValues.TenantId, CurrentTenant.Id.HasValue ? CurrentTenant.Id.ToString() : null);
}
}

View file

@ -37,7 +37,7 @@ const CardItem = ({
listFormCode: string
dataSource: CustomStore
refreshData: () => void
getCachedLookupDataSource: (editorOptions: any, colData: any) => any
getCachedLookupDataSource: (editorOptions: any, colData: any, row?: any) => any
}) => {
const [formData, setFormData] = useState(row)
const refForm = useRef<FormDx>(null)
@ -220,12 +220,12 @@ const Card = (props: CardProps) => {
const lookupCache = useRef<Map<string, any>>(new Map())
const getCachedLookupDataSource = useCallback(
(editorOptions: any, colData: any) => {
(editorOptions: any, colData: any, row?: any) => {
const key = colData?.fieldName
if (!key) return null
if (!lookupCache.current.has(key)) {
lookupCache.current.set(key, getLookupDataSource(editorOptions, colData))
lookupCache.current.set(key, getLookupDataSource(editorOptions, colData, row))
}
return lookupCache.current.get(key)
},