diff --git a/api/src/Kurs.Platform.Application/ListForms/ListFormSelectAppService.cs b/api/src/Kurs.Platform.Application/ListForms/ListFormSelectAppService.cs index 3684b203..335f1d92 100644 --- a/api/src/Kurs.Platform.Application/ListForms/ListFormSelectAppService.cs +++ b/api/src/Kurs.Platform.Application/ListForms/ListFormSelectAppService.cs @@ -186,7 +186,7 @@ public class ListFormSelectAppService : PlatformAppService, IListFormSelectAppSe { result.TotalCount = await dynamicDataRepository.ExecuteScalarAsync(selectQueryManager.TotalCountQuery, connectionString, param); } - else if(queryParams.Chart && !string.IsNullOrEmpty(selectQueryManager.ChartQuery)) + else if (queryParams.Chart && !string.IsNullOrEmpty(selectQueryManager.ChartQuery)) { result.Data = await dynamicDataRepository.QueryAsync(selectQueryManager.ChartQuery, connectionString, param); } @@ -377,7 +377,7 @@ public class ListFormSelectAppService : PlatformAppService, IListFormSelectAppSe if (field != null && !field.LookupJson.IsNullOrEmpty() && field.CanRead) { var lookup = JsonSerializer.Deserialize(field.LookupJson); - if (!string.IsNullOrWhiteSpace(lookup.LookupQuery)) + if (!string.IsNullOrWhiteSpace(lookup?.LookupQuery)) { var lookupQuery = defaultValueHelper.GetDefaultValue(lookup.LookupQuery); var parameters = new Dictionary(); diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformListFormsSeeder.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformListFormsSeeder.cs index 6ad57f50..6033cddb 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformListFormsSeeder.cs +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/PlatformListFormsSeeder.cs @@ -44,20 +44,116 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc public async Task SeedAsync(DataSeedContext context) { - var lookupQueryLanguageKeyValues = $"SELECT \"{SelectCommandByTableName("LanguageKey")}\".\"Key\", CONCAT(\"{SelectCommandByTableName("LanguageKey")}\".\"Key\", ' (', \"{SelectCommandByTableName("LanguageText")}\".\"Value\", ')') AS \"Name\" FROM \"{SelectCommandByTableName("LanguageKey")}\" LEFT OUTER JOIN \"{SelectCommandByTableName("LanguageText")}\" ON \"{SelectCommandByTableName("LanguageKey")}\".\"Key\" = \"{SelectCommandByTableName("LanguageText")}\".\"Key\" AND \"{SelectCommandByTableName("LanguageKey")}\".\"ResourceName\" = \"{SelectCommandByTableName("LanguageText")}\".\"ResourceName\" WHERE \"{SelectCommandByTableName("LanguageKey")}\".\"IsDeleted\" = 'false' AND \"{SelectCommandByTableName("LanguageText")}\".\"IsDeleted\" = 'false' AND \"{SelectCommandByTableName("LanguageText")}\".\"CultureName\" = 'tr' ORDER BY \"{SelectCommandByTableName("LanguageKey")}\".\"Key\";"; - var lookupQueryCultureValues = $"SELECT \"CultureName\" AS \"Key\", \"DisplayName\" AS \"Name\", \"CreationTime\" FROM \"{SelectCommandByTableName("Language")}\" WHERE \"IsEnabled\" = 'true' and \"IsDeleted\" = 'false'"; + var lookupQueryLanguageKeyValues = + $"SELECT " + + $"\"{SelectCommandByTableName("LanguageKey")}\".\"Key\", " + + $"CONCAT(" + + $"\"{SelectCommandByTableName("LanguageKey")}\".\"Key\", " + + $"' (', " + + $"\"{SelectCommandByTableName("LanguageText")}\".\"Value\", " + + $"')'" + + $") AS \"Name\" " + + $"FROM \"{SelectCommandByTableName("LanguageKey")}\" " + + $"LEFT OUTER JOIN \"{SelectCommandByTableName("LanguageText")}\" " + + $"ON \"{SelectCommandByTableName("LanguageKey")}\".\"Key\" = \"{SelectCommandByTableName("LanguageText")}\".\"Key\" " + + $"AND \"{SelectCommandByTableName("LanguageKey")}\".\"ResourceName\" = \"{SelectCommandByTableName("LanguageText")}\".\"ResourceName\" " + + $"WHERE " + + $"\"{SelectCommandByTableName("LanguageKey")}\".\"IsDeleted\" = 'false' " + + $"AND \"{SelectCommandByTableName("LanguageText")}\".\"IsDeleted\" = 'false' " + + $"AND \"{SelectCommandByTableName("LanguageText")}\".\"CultureName\" = 'tr' " + + $"ORDER BY \"{SelectCommandByTableName("LanguageKey")}\".\"Key\";"; - var lookupQueryCountryValues = $"SELECT \"{SelectCommandByTableName("Country", Prefix.DbTableDefinition)}\".\"Code\" AS \"Key\", \"{SelectCommandByTableName("Country", Prefix.DbTableDefinition)}\".\"Name\" as \"Name\" FROM \"{SelectCommandByTableName("Country", Prefix.DbTableDefinition)}\" ORDER BY \"{SelectCommandByTableName("Country", Prefix.DbTableDefinition)}\".\"Name\""; - var lookupQueryCityValues = $"SELECT \"{SelectCommandByTableName("City", Prefix.DbTableDefinition)}\".\"Code\" AS \"Key\", \"{SelectCommandByTableName("City", Prefix.DbTableDefinition)}\".\"Name\" as \"Name\" FROM \"{SelectCommandByTableName("City", Prefix.DbTableDefinition)}\" WHERE \"{SelectCommandByTableName("City", Prefix.DbTableDefinition)}\".\"Country\" = @param0 OR @param0 IS NULL ORDER BY \"{SelectCommandByTableName("City", Prefix.DbTableDefinition)}\".\"Name\""; - var lookupQueryDistrictValues = $"SELECT \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Name\" AS \"Key\", \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Name\" as \"Name\" FROM \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\" WHERE (\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Country\" = @param0 OR @param0 IS NULL) AND (\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"City\" = @param1 OR @param1 IS NULL) GROUP BY \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Name\" ORDER BY \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Name\""; - var lookupQueryStreetValues = $"SELECT \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Street\" AS \"Key\", \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Street\" as \"Name\" FROM \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\" WHERE (\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Country\" = @param0 OR @param0 IS NULL) AND (\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"City\" = @param1 OR @param1 IS NULL) AND (\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Name\" = @param2 OR @param2 IS NULL) GROUP BY \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Street\" ORDER BY \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Street\""; + var lookupQueryCultureValues = + $"SELECT " + + $"\"CultureName\" AS \"Key\", " + + $"\"DisplayName\" AS \"Name\", " + + $"\"CreationTime\" " + + $"FROM \"{SelectCommandByTableName("Language")}\" " + + $"WHERE " + + $"\"IsEnabled\" = 'true' " + + $"AND \"IsDeleted\" = 'false';"; - 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 lookupQueryCountryValues = + $"SELECT " + + $"\"{SelectCommandByTableName("Country", Prefix.DbTableDefinition)}\".\"Code\" AS \"Key\", " + + $"\"{SelectCommandByTableName("Country", Prefix.DbTableDefinition)}\".\"Name\" AS \"Name\" " + + $"FROM \"{SelectCommandByTableName("Country", Prefix.DbTableDefinition)}\" " + + $"ORDER BY \"{SelectCommandByTableName("Country", Prefix.DbTableDefinition)}\".\"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\""; + var lookupQueryCityValues = + $"SELECT " + + $"\"{SelectCommandByTableName("City", Prefix.DbTableDefinition)}\".\"Code\" AS \"Key\", " + + $"\"{SelectCommandByTableName("City", Prefix.DbTableDefinition)}\".\"Name\" AS \"Name\" " + + $"FROM \"{SelectCommandByTableName("City", Prefix.DbTableDefinition)}\" " + + $"WHERE " + + $"\"{SelectCommandByTableName("City", Prefix.DbTableDefinition)}\".\"Country\" = @param0 " + + $"OR @param0 IS NULL " + + $"ORDER BY \"{SelectCommandByTableName("City", Prefix.DbTableDefinition)}\".\"Name\";"; + + var lookupQueryDistrictValues = + $"SELECT " + + $"\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Name\" AS \"Key\", " + + $"\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Name\" AS \"Name\" " + + $"FROM \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\" " + + $"WHERE " + + $"(\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Country\" = @param0 OR @param0 IS NULL) " + + $"AND (\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"City\" = @param1 OR @param1 IS NULL) " + + $"GROUP BY \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Name\" " + + $"ORDER BY \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Name\";"; + + var lookupQueryStreetValues = + $"SELECT " + + $"\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Street\" AS \"Key\", " + + $"\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Street\" AS \"Name\" " + + $"FROM \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\" " + + $"WHERE " + + $"(\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Country\" = @param0 OR @param0 IS NULL) " + + $"AND (\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"City\" = @param1 OR @param1 IS NULL) " + + $"AND (\"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Name\" = @param2 OR @param2 IS NULL) " + + $"GROUP BY \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Street\" " + + $"ORDER BY \"{SelectCommandByTableName("District", Prefix.DbTableDefinition)}\".\"Street\";"; + + var lookupQueryTenantValues = + $"SELECT * FROM (" + + $"SELECT NULL AS \"Key\", 'Host' AS \"Name\" " + + $"UNION ALL " + + $"SELECT " + + $"\"AbpTenants\".\"Id\" AS \"Key\", " + + $"\"AbpTenants\".\"Name\" AS \"Name\" " + + $"FROM \"AbpTenants\"" + + $") AS \"List\" " + + $"ORDER BY \"Name\""; + + + var lookupQueryBranchValues = + $"SELECT \"{SelectCommandByTableName("Branch")}\".\"Id\" AS \"Key\", " + + $"\"{SelectCommandByTableName("Branch")}\".\"Name\" as \"Name\" " + + $"FROM \"{SelectCommandByTableName("Branch")}\" " + + $"WHERE \"{SelectCommandByTableName("Branch")}\".\"TenantId\" = '@TENANTID' " + + $"AND \"{SelectCommandByTableName("Branch")}\".\"Id\" IN ( " + + $"SELECT [BranchId] " + + $"FROM [PBranchUsers] " + + $"WHERE [UserId] = '@USERID' " + + $") " + + $"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)}\" " + + $"WHERE " + + $"(\"{SelectCommandByTableName("RegistrationType", Prefix.DbTableDefinition)}\".\"BranchId\" = @param0 OR @param0 IS NULL) " + + $"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)}\" " + + $"WHERE " + + $"(\"{SelectCommandByTableName("ClassType", Prefix.DbTableDefinition)}\".\"BranchId\" = @param0 OR @param0 IS NULL) " + + $"ORDER BY \"{SelectCommandByTableName("ClassType", Prefix.DbTableDefinition)}\".\"Name\";"; var htmlEditorOptions = "{\"toolbar\": {\"multiline\": true, \"items\": [{\"name\": \"undo\"},{\"name\": \"redo\"},{\"name\": \"separator\"},{\"name\": \"size\",\"acceptedValues\": [\"8pt\",\"10pt\",\"12pt\",\"14pt\",\"18pt\",\"24pt\",\"36pt\"],\"options\": {\"inputAttr\": {\"aria-label\": \"Font size\"}}},{\"name\": \"font\",\"acceptedValues\": [\"Arial\",\"Courier New\",\"Georgia\",\"Impact\",\"Lucida Console\",\"Tahoma\",\"Times New Roman\",\"Verdana\"],\"options\": {\"inputAttr\": {\"aria-label\": \"Font family\"}}},{\"name\": \"separator\"},{\"name\": \"bold\"},{\"name\": \"italic\"},{\"name\": \"strike\"},{\"name\": \"underline\"},{\"name\": \"separator\"},{\"name\": \"alignLeft\"},{\"name\": \"alignCenter\"},{\"name\": \"alignRight\"},{\"name\": \"alignJustify\"},{\"name\": \"separator\"},{\"name\": \"orderedList\"},{\"name\": \"bulletList\"},{\"name\": \"separator\"},{\"name\": \"header\",\"acceptedValues\": [false,1,2,3,4,5],\"options\": {\"inputAttr\": {\"aria-label\": \"Font family\"}}},{\"name\": \"separator\"},{\"name\": \"color\"},{\"name\": \"background\"},{\"name\": \"separator\"},{\"name\": \"link\"},{\"name\": \"image\"},{\"name\": \"separator\"},{\"name\": \"clear\"},{\"name\": \"codeBlock\"},{\"name\": \"blockquote\"},{\"name\": \"separator\"},{\"name\": \"insertTable\"},{\"name\": \"deleteTable\"},{\"name\": \"insertRowAbove\"},{\"name\": \"insertRowBelow\"},{\"name\": \"deleteRow\"},{\"name\": \"insertColumnLeft\"},{\"name\": \"insertColumnRight\"},{\"name\": \"deleteColumn\"}]}}"; var showClearButton = "{ \"showClearButton\" : true }"; @@ -767,7 +863,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc ColSpan = 2, ItemType = "group", Items = [ - 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}, @@ -817,7 +912,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc SourceDbType = DbType.Guid, FieldName = "Id", Width = 100, - ListOrderNo = 0, + ListOrderNo = 1, Visible = false, IsActive = true, IsDeleted = false, @@ -839,37 +934,6 @@ 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() { @@ -2798,32 +2862,32 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc }), EditingFormJson = JsonSerializer.Serialize(new List() { - new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items = - [ - new EditingFormItemDto { Order=1, DataField="TenantId", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, - new EditingFormItemDto { Order=2, DataField="Code", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=3, DataField="Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=4, DataField="VknTckn", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order=5, DataField="TaxOffice", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=6, DataField="Mobile", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order=7, DataField="Phone", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxNumberBox }, - new EditingFormItemDto { Order=8, DataField="Fax", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=9, DataField="IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, - ] - }, - new() { Order=2, ColCount=1, ColSpan=1, ItemType="group", Items = - [ - new EditingFormItemDto { Order=1, DataField="Country", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, - new EditingFormItemDto { Order=2, DataField="City", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, - new EditingFormItemDto { Order=3, DataField="District", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, - new EditingFormItemDto { Order=4, DataField="Street", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, - new EditingFormItemDto { Order=5, DataField="Address", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=6, DataField="Address2", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=7, DataField="PostalCode", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=8, DataField="Email", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - new EditingFormItemDto { Order=9, DataField="Website", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, - ] - } + new() { Order=1, ColCount=1, ColSpan=1, ItemType="group", Items = + [ + new EditingFormItemDto { Order=1, DataField="TenantId", ColSpan=2, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order=2, DataField="Code", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=3, DataField="Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=4, DataField="VknTckn", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order=5, DataField="TaxOffice", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=6, DataField="Mobile", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order=7, DataField="Phone", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order=8, DataField="Fax", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=9, DataField="IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, + ] + }, + new() { Order=2, ColCount=1, ColSpan=1, ItemType="group", Items = + [ + new EditingFormItemDto { Order=1, DataField="Country", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order=2, DataField="City", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order=3, DataField="District", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order=4, DataField="Street", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton }, + new EditingFormItemDto { Order=5, DataField="Address", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=6, DataField="Address2", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=7, DataField="PostalCode", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=8, DataField="Email", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + new EditingFormItemDto { Order=9, DataField="Website", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox }, + ] + } }), DeleteCommand = $"UPDATE \"{Prefix.DbTableDefault}Branch\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] { @@ -23418,7 +23482,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc ItemType = "group", Items = [ - 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 }, @@ -23474,39 +23537,6 @@ 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() { @@ -23704,7 +23734,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc ItemType = "group", Items = [ - 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 }, @@ -23760,39 +23789,6 @@ 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() { @@ -23810,6 +23806,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc DisplayExpr = "Name", ValueExpr = "Key", LookupQuery = lookupQueryBranchValues, + CascadeEmptyFields = "RegistrationTypeId" }), ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { @@ -23843,6 +23840,9 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc DisplayExpr = "Name", ValueExpr = "Key", LookupQuery = lookupQueryRegistrationTypeValues, + CascadeRelationField = "BranchId", + CascadeFilterOperator="=", + CascadeParentFields = "BranchId", }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { @@ -24019,7 +24019,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc ItemType = "group", Items = [ - 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 }, @@ -24080,39 +24079,6 @@ 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, @@ -24128,6 +24094,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc DisplayExpr = "Name", ValueExpr = "Key", LookupQuery = lookupQueryBranchValues, + CascadeEmptyFields = "RegistrationTypeId" }), ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { @@ -24161,6 +24128,9 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc DisplayExpr = "Name", ValueExpr = "Key", LookupQuery = lookupQueryRegistrationTypeValues, + CascadeRelationField = "BranchId", + CascadeFilterOperator="=", + CascadeParentFields = "BranchId", }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { @@ -24383,7 +24353,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc ItemType = "group", Items = [ - 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 }, @@ -24439,39 +24408,6 @@ 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() { @@ -24489,6 +24425,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc DisplayExpr = "Name", ValueExpr = "Key", LookupQuery = lookupQueryBranchValues, + CascadeEmptyFields = "ClassTypeId" }), ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { @@ -24522,6 +24459,9 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc DisplayExpr = "Name", ValueExpr = "Key", LookupQuery = lookupQueryClassTypeValues, + CascadeRelationField = "BranchId", + CascadeFilterOperator="=", + CascadeParentFields = "BranchId", }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { @@ -24698,7 +24638,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc ItemType = "group", Items = [ - 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 }, @@ -24758,39 +24697,6 @@ 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() { @@ -24808,6 +24714,7 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc DisplayExpr = "Name", ValueExpr = "Key", LookupQuery = lookupQueryBranchValues, + CascadeEmptyFields = "ClassTypeId" }), ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] { @@ -24841,6 +24748,9 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc DisplayExpr = "Name", ValueExpr = "Key", LookupQuery = lookupQueryClassTypeValues, + CascadeRelationField = "BranchId", + CascadeFilterOperator="=", + CascadeParentFields = "BranchId", }), PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto { @@ -25109,7 +25019,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc ItemType = "group", Items = [ - 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 }, @@ -25162,40 +25071,6 @@ 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() { @@ -25529,7 +25404,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc Order = 1, ColCount = 2, ColSpan = 2, ItemType = "group", Items = [ - 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 }, @@ -25648,34 +25522,6 @@ 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, @@ -26250,7 +26096,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc ItemType = "group", Items = [ - 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 }, @@ -26318,35 +26163,6 @@ 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() { @@ -26589,7 +26405,6 @@ public class PlatformListFormsSeeder : IDataSeedContributor, ITransientDependenc EditingFormJson = JsonSerializer.Serialize(new List() { new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items= [ - 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}, @@ -26672,37 +26487,6 @@ 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() { diff --git a/api/src/Kurs.Platform.Domain/Entities/Tenant/Branch.cs b/api/src/Kurs.Platform.Domain/Entities/Tenant/Branch.cs index b40e8fcc..697b9dc3 100644 --- a/api/src/Kurs.Platform.Domain/Entities/Tenant/Branch.cs +++ b/api/src/Kurs.Platform.Domain/Entities/Tenant/Branch.cs @@ -6,7 +6,7 @@ namespace Kurs.Platform.Entities; public class Branch : FullAuditedEntity { - public Guid TenantId { get; set; } + public Guid? TenantId { get; set; } public string Code { get; set; } public string Name { get; set; } diff --git a/api/src/Kurs.Platform.Domain/ListForms/ListFormManager.cs b/api/src/Kurs.Platform.Domain/ListForms/ListFormManager.cs index fda6f1ca..7a866f7e 100644 --- a/api/src/Kurs.Platform.Domain/ListForms/ListFormManager.cs +++ b/api/src/Kurs.Platform.Domain/ListForms/ListFormManager.cs @@ -130,31 +130,31 @@ public class ListFormManager : PlatformDomainService, IListFormManager } } - if (listForm.IsBranch) - { - var ids = await branchUsersRepository.GetListAsync((a) => a.UserId == CurrentUser.Id.Value); - if (ids.Count > 0) - { - fields.Add("BranchId", $"IN ({string.Join(",", ids.Select(a => $"'{a.BranchId}'"))})"); - } - else - { - fields.Add("BranchId", $"IN ('{Guid.Empty}')"); - } - } + // if (listForm.IsBranch) + // { + // var ids = await branchUsersRepository.GetListAsync((a) => a.UserId == CurrentUser.Id.Value); + // if (ids.Count > 0) + // { + // fields.Add("BranchId", $"IN ({string.Join(",", ids.Select(a => $"'{a.BranchId}'"))})"); + // } + // else + // { + // fields.Add("BranchId", $"IN ('{Guid.Empty}')"); + // } + // } - if (listForm.IsOrganizationUnit) - { - var ids = await ouRepository.GetOrganizationUnitIdsWithChildren(CurrentUser.Id.Value); - if (ids.Count > 0) - { - fields.Add("OrganizationUnitId", $"IN ({string.Join(",", ids.Select(a => $"'{a}'"))})"); - } - else - { - fields.Add("OrganizationUnitId", $"IN ('{Guid.Empty}')"); - } - } + // if (listForm.IsOrganizationUnit) + // { + // var ids = await ouRepository.GetOrganizationUnitIdsWithChildren(CurrentUser.Id.Value); + // if (ids.Count > 0) + // { + // fields.Add("OrganizationUnitId", $"IN ({string.Join(",", ids.Select(a => $"'{a}'"))})"); + // } + // else + // { + // fields.Add("OrganizationUnitId", $"IN ('{Guid.Empty}')"); + // } + // } foreach (var item in defaultFields) { diff --git a/api/src/Kurs.Platform.Domain/Queries/DefaultValueHelper.cs b/api/src/Kurs.Platform.Domain/Queries/DefaultValueHelper.cs index 95fa7b14..122427e1 100644 --- a/api/src/Kurs.Platform.Domain/Queries/DefaultValueHelper.cs +++ b/api/src/Kurs.Platform.Domain/Queries/DefaultValueHelper.cs @@ -7,8 +7,8 @@ using Volo.Abp.Users; public class DefaultValueHelper : ITransientDependency { - private ICurrentUser _currentUser; - private ICurrentTenant _currentTenant; + private readonly ICurrentUser _currentUser; + private readonly ICurrentTenant _currentTenant; public DefaultValueHelper( ICurrentUser currentUser, @@ -24,11 +24,33 @@ public class DefaultValueHelper : ITransientDependency 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()); + // 🔹 TenantId değişimi özel ele alınacak + var result = strValue + .Replace(PlatformConsts.DefaultValues.UserId, _currentUser.Id?.ToString() ?? Guid.Empty.ToString()) + .Replace(PlatformConsts.DefaultValues.UserName, _currentUser.UserName ?? string.Empty) + .Replace(PlatformConsts.DefaultValues.Roles, string.Join("','", _currentUser.Roles ?? Array.Empty())) + .Replace(PlatformConsts.DefaultValues.Now, DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture)); + + // 🔹 TenantId özel durumu: NULL => IS NULL, varsa => = 'GUID' + if (result.Contains(PlatformConsts.DefaultValues.TenantId)) + { + if (_currentTenant.Id.HasValue) + { + result = result.Replace( + $"= '{PlatformConsts.DefaultValues.TenantId}'", + $"= '{_currentTenant.Id}'" + ); + } + else + { + // Boşsa: TenantId IS NULL yaz + result = result.Replace( + $"= '{PlatformConsts.DefaultValues.TenantId}'", + "IS NULL" + ); + } + } + + return result; } } diff --git a/api/src/Kurs.Platform.Domain/Queries/QueryHelper.cs b/api/src/Kurs.Platform.Domain/Queries/QueryHelper.cs index f0f18e1a..d6e3011b 100644 --- a/api/src/Kurs.Platform.Domain/Queries/QueryHelper.cs +++ b/api/src/Kurs.Platform.Domain/Queries/QueryHelper.cs @@ -35,7 +35,17 @@ public class QueryHelper switch (fieldDbSource) { case DbType.Guid: - var guidValues = values.Select(a => Guid.Parse(a.ToString())).ToArray(); + var guidValues = values.Select(a => + { + if (a == null) + return (Guid?)null; + + var str = a.ToString(); + if (string.IsNullOrWhiteSpace(str)) + return (Guid?)null; + + return Guid.TryParse(str, out var g) ? g : (Guid?)null; + }).ToArray(); value = isArray ? guidValues : guidValues[0]; break; case DbType.String: diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index f29a8303..6ad23bc9 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -220,7 +220,6 @@ public class PlatformDbContext : b.ToTable(Prefix.DbTableDefault + nameof(Branch), Prefix.DbSchema); b.ConfigureByConvention(); - b.Property(a => a.TenantId).IsRequired(); b.Property(a => a.Code).IsRequired().HasMaxLength(64); b.Property(a => a.Name).IsRequired().HasMaxLength(128); b.Property(a => a.VknTckn).IsRequired(); diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251007120118_Initial.Designer.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008085215_Initial.Designer.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251007120118_Initial.Designer.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008085215_Initial.Designer.cs index 233287b1..ebae6d07 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251007120118_Initial.Designer.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008085215_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Kurs.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20251007120118_Initial")] + [Migration("20251008085215_Initial")] partial class Initial { /// @@ -1336,7 +1336,7 @@ namespace Kurs.Platform.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnType("uniqueidentifier"); b.Property("VknTckn") diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251007120118_Initial.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008085215_Initial.cs similarity index 99% rename from api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251007120118_Initial.cs rename to api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008085215_Initial.cs index b2dbc489..8d83e09e 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251007120118_Initial.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/20251008085215_Initial.cs @@ -1272,7 +1272,7 @@ namespace Kurs.Platform.Migrations columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), - TenantId = table.Column(type: "uniqueidentifier", nullable: false), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), Code = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), VknTckn = table.Column(type: "bigint", nullable: false), diff --git a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 222354a2..d9013d5c 100644 --- a/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Kurs.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -1333,7 +1333,7 @@ namespace Kurs.Platform.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); - b.Property("TenantId") + b.Property("TenantId") .HasColumnType("uniqueidentifier"); b.Property("VknTckn")