Bank ve Bank Account Seeder

This commit is contained in:
Sedat ÖZTÜRK 2025-10-02 13:37:27 +03:00
parent 3406bccb25
commit b3ba87a8fa
7 changed files with 446 additions and 18 deletions

View file

@ -680,6 +680,434 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
}
#endregion
#region Bank
if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Forms.FormBank))
{
var formBank = await _listFormRepository.InsertAsync(
new ListForm()
{
ListFormType = ListFormTypeEnum.Form,
IsSubForm = false,
LayoutJson = JsonSerializer.Serialize(new LayoutDto()
{
Grid = true,
Card = true,
Pivot = true,
Chart = true,
DefaultLayout = "grid",
CardLayoutColumn = 4
}),
SubFormsJson = JsonSerializer.Serialize(new List<dynamic>() {
new {
TabTitle = "Bank Accounts",
TabType = ListFormTabTypeEnum.List,
Code = ListFormCodes.Lists.BankAccount,
Relation = new List<dynamic>() {
new {
ParentFieldName = "Id",
ChildFieldName = "BankId"
}
}
},
}),
CultureName = LanguageCodes.En,
ListFormCode = ListFormCodes.Forms.FormBank,
Name = AppCodes.Definitions.Bank,
Title = AppCodes.Definitions.Bank,
DataSourceCode = SeedConsts.DataSources.DefaultCode,
IsTenant = false,
IsBranch = false,
IsOrganizationUnit = false,
Description = AppCodes.Definitions.Bank,
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = SelectCommandByTableName("Bank"),
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.Guid,
DefaultFilter = "\"IsDeleted\" = 'false'",
SortMode = GridOptions.SortModeSingle,
PermissionJson = JsonSerializer.Serialize(new PermissionCrudDto
{
C = AppCodes.Definitions.Bank + ".Create",
R = AppCodes.Definitions.Bank,
U = AppCodes.Definitions.Bank + ".Update",
D = AppCodes.Definitions.Bank + ".Delete",
E = AppCodes.Definitions.Bank + ".Export",
I = AppCodes.Definitions.Bank + ".Import"
}),
DeleteCommand = $"UPDATE \"{DbTablePrefix}Bank\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id",
DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
new() {
FieldName = "DeleterId",
FieldDbType = DbType.Guid,
Value = "@USERID",
CustomValueType = FieldCustomValueTypeEnum.CustomKey },
new() {
FieldName = "Id",
FieldDbType = DbType.Guid,
Value = "@ID",
CustomValueType = FieldCustomValueTypeEnum.CustomKey }
}),
EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto
{
AllowDeleting = true,
AllowAdding = true,
AllowUpdating = true,
ConfirmDelete = true,
}),
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
new() {
Order = 1,
ColCount = 1,
ColSpan = 2,
ItemType = "group",
Items = [
new EditingFormItemDto { Order = 1, DataField = "Name", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 2, DataField = "IdentifierCode", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxTextBox},
new EditingFormItemDto { Order = 3, DataField = "AddressLine1", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 4, DataField = "AddressLine2", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 5, DataField = "Country", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 6, DataField = "City", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 7, DataField = "District", ColSpan = 2, IsRequired = true, EditorType2=EditorTypes.dxSelectBox, EditorOptions=showClearButton },
new EditingFormItemDto { Order = 8, DataField = "PostalCode", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 9, DataField = "Phone", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order = 10, DataField = "Email", ColSpan = 2, EditorType2=EditorTypes.dxTextBox },
]
}
}),
InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new FieldsDefaultValue[] {
new() {
FieldName = "CreationTime",
FieldDbType = DbType.DateTime,
Value = "@NOW",
CustomValueType = FieldCustomValueTypeEnum.CustomKey },
new() {
FieldName = "CreatorId",
FieldDbType = DbType.Guid,
Value = "@USERID",
CustomValueType = FieldCustomValueTypeEnum.CustomKey },
new() {
FieldName = "IsDeleted",
FieldDbType = DbType.Boolean,
Value = "false",
CustomValueType = FieldCustomValueTypeEnum.Value }
}),
}
);
#region Bank Fields
await _listFormFieldRepository.InsertManyAsync(new ListFormField[] {
new() {
ListFormCode = formBank.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Name",
Width = 150,
ListOrderNo = 1,
Visible = true,
IsActive = true,
IsDeleted = false,
SortIndex = 1,
SortDirection = GridColumnOptions.SortOrderAsc,
AllowSearch = true,
ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] {
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required)}
}),
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
})
},
new() {
ListFormCode = formBank.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "IdentifierCode",
Width = 150,
ListOrderNo = 2,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] {
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required)}
}),
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
})
},
new() {
ListFormCode = formBank.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "AddressLine1",
Width = 150,
ListOrderNo = 3,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
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
})
},
new() {
ListFormCode = formBank.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "AddressLine2",
Width = 150,
ListOrderNo = 4,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
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
})
},
new() {
ListFormCode = formBank.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Country",
Width = 100,
ListOrderNo = 5,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
LookupJson = JsonSerializer.Serialize(new LookupDto
{
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = $"SELECT \"{DbTablePrefix}Country\".\"Code\" AS \"Key\", \"{DbTablePrefix}Country\".\"Name\" as \"Name\" FROM \"{DbTablePrefix}Country\" ORDER BY \"{DbTablePrefix}Country\".\"Name\"",
CascadeEmptyFields = "City,District,Street"
}),
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
})
},
new() {
ListFormCode = formBank.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "City",
Width = 100,
ListOrderNo = 6,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
LookupJson = JsonSerializer.Serialize(new LookupDto
{
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = $"SELECT \"{DbTablePrefix}City\".\"Code\" AS \"Key\", \"{DbTablePrefix}City\".\"Name\" as \"Name\" FROM \"{DbTablePrefix}City\" WHERE \"PCity\".\"CountryCode\" = @param0 OR @param0 IS NULL ORDER BY \"{DbTablePrefix}City\".\"Name\"",
CascadeRelationField = "Country",
CascadeFilterOperator="=",
CascadeParentFields = "Country",
CascadeEmptyFields = "District,Street"
}),
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
})
},
new() {
ListFormCode = formBank.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "District",
Width = 100,
ListOrderNo = 7,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
LookupJson = JsonSerializer.Serialize(new LookupDto
{
DataSourceType = UiLookupDataSourceTypeEnum.Query,
DisplayExpr = "Name",
ValueExpr = "Key",
LookupQuery = $"SELECT \"{DbTablePrefix}District\".\"Name\" AS \"Key\", \"{DbTablePrefix}District\".\"Name\" as \"Name\" FROM \"{DbTablePrefix}District\" WHERE (\"{DbTablePrefix}District\".\"CountryCode\" = @param0 OR @param0 IS NULL) AND (\"{DbTablePrefix}District\".\"CityCode\" = @param1 OR @param1 IS NULL) GROUP BY \"{DbTablePrefix}District\".\"Name\" ORDER BY \"{DbTablePrefix}District\".\"Name\"",
CascadeRelationField = "City",
CascadeFilterOperator="=",
CascadeParentFields = "Country,City",
CascadeEmptyFields = "Street",
}),
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
})
},
new() {
ListFormCode = formBank.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "PostalCode",
Width = 150,
ListOrderNo = 8,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
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
})
},
new() {
ListFormCode = formBank.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Phone",
Width = 150,
ListOrderNo = 9,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
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
})
},
new() {
ListFormCode = formBank.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Email",
Width = 150,
ListOrderNo = 10,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
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
})
},
});
#endregion
}
#endregion
#endregion
#region List
@ -12286,6 +12714,15 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
Value = "false",
CustomValueType = FieldCustomValueTypeEnum.Value }
}),
CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] {
new() {
Hint = "Manage",
Text ="Manage",
UrlTarget="_blank",
AuthName = AppCodes.Definitions.Bank + ".Update",
Url=$"/admin/form/{ListFormCodes.Forms.FormBank}/@Id"
},
}),
}
);

View file

@ -6601,17 +6601,7 @@
"RequiredPermissionName": "App.Definitions.Bank",
"IsDisabled": false
},
{
"ParentCode": "App.Definitions",
"Code": "App.Definitions.BankAccount",
"DisplayName": "App.Definitions.BankAccount",
"Order": 10,
"Url": "/admin/list/list-bankaccount",
"Icon": "FaMoneyCheckAlt",
"RequiredPermissionName": "App.Definitions.BankAccount",
"IsDisabled": false
},
{
"ParentCode": null,
"Code": "App.Participant",

View file

@ -386,6 +386,7 @@ public static class PlatformConsts
public const string FormLanguage = "form-language";
public const string FormUomCategory = "form-uomcategory";
public const string FormSkillType = "form-skilltype";
public const string FormBank = "form-bank";
}
public static class Charts

View file

@ -338,7 +338,7 @@ public class PlatformDbContext :
b.ToTable(PlatformConsts.DbTablePrefix + nameof(Bank), PlatformConsts.DbSchema);
b.ConfigureByConvention();
b.Property(x => x.Name).IsRequired().HasMaxLength(8);
b.Property(x => x.Name).IsRequired().HasMaxLength(128);
});
builder.Entity<BankAccount>(b =>

View file

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace Kurs.Platform.Migrations
{
[DbContext(typeof(PlatformDbContext))]
[Migration("20251002081543_Initial")]
[Migration("20251002102738_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -988,8 +988,8 @@ namespace Kurs.Platform.Migrations
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("nvarchar(8)");
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Phone")
.HasMaxLength(64)

View file

@ -638,7 +638,7 @@ namespace Kurs.Platform.Migrations
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(8)", maxLength: 8, nullable: false),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
IdentifierCode = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
AddressLine1 = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
AddressLine2 = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),

View file

@ -985,8 +985,8 @@ namespace Kurs.Platform.Migrations
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("nvarchar(8)");
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Phone")
.HasMaxLength(64)