AbpTenant Extension

This commit is contained in:
Sedat ÖZTÜRK 2025-06-13 17:42:50 +03:00
parent 58d91ad366
commit 83be43b4f2
12 changed files with 4481 additions and 10 deletions

View file

@ -11,4 +11,17 @@ public class CreateUpdateTenantInput
public string AdminEmail { get; set; } public string AdminEmail { get; set; }
public string AdminPassword { get; set; } public string AdminPassword { get; set; }
public string ConnectionString { get; set; } public string ConnectionString { get; set; }
public string InstitutionName { get; set; }
public long VknTckn { get; set; }
public string TaxOffice { get; set; }
public string Address { get; set; }
public string Address2 { get; set; }
public string District { get; set; }
public string City { get; set; }
public string PostalCode { get; set; }
public long Phone { get; set; }
public long Mobile { get; set; }
public long Fax { get; set; }
public string Email { get; set; }
public string Website { get; set; }
} }

View file

@ -113,6 +113,19 @@ public class ListFormDynamicApiAppService : PlatformAppService, IListFormDynamic
var entity = await tenantRepository.InsertAsync(tenant, autoSave: true); var entity = await tenantRepository.InsertAsync(tenant, autoSave: true);
entity.SetIsActiveTenant(input.Data.IsActive); entity.SetIsActiveTenant(input.Data.IsActive);
entity.SetInstitutionName(input.Data.InstitutionName);
entity.SetVknTckn(input.Data.VknTckn);
entity.SetTaxOffice(input.Data.TaxOffice);
entity.SetAddress(input.Data.Address);
entity.SetAddress2(input.Data.Address2);
entity.SetDistrict(input.Data.District);
entity.SetCity(input.Data.City);
entity.SetPostalCode(input.Data.PostalCode);
entity.SetPhone(input.Data.Phone);
entity.SetMobile(input.Data.Mobile);
entity.SetFax(input.Data.Fax);
entity.SetEmail(input.Data.Email);
entity.SetWebsite(input.Data.Website);
await tenantRepository.UpdateAsync(entity, autoSave: true); await tenantRepository.UpdateAsync(entity, autoSave: true);
} }
@ -131,6 +144,19 @@ public class ListFormDynamicApiAppService : PlatformAppService, IListFormDynamic
await tenantManager.ChangeNameAsync(entity, input.Data.Name); await tenantManager.ChangeNameAsync(entity, input.Data.Name);
entity.SetIsActiveTenant(input.Data.IsActive); entity.SetIsActiveTenant(input.Data.IsActive);
entity.SetInstitutionName(input.Data.InstitutionName);
entity.SetVknTckn(input.Data.VknTckn);
entity.SetTaxOffice(input.Data.TaxOffice);
entity.SetAddress(input.Data.Address);
entity.SetAddress2(input.Data.Address2);
entity.SetDistrict(input.Data.District);
entity.SetCity(input.Data.City);
entity.SetPostalCode(input.Data.PostalCode);
entity.SetPhone(input.Data.Phone);
entity.SetMobile(input.Data.Mobile);
entity.SetFax(input.Data.Fax);
entity.SetEmail(input.Data.Email);
entity.SetWebsite(input.Data.Website);
await tenantRepository.UpdateAsync(entity, autoSave: true); await tenantRepository.UpdateAsync(entity, autoSave: true);
} }

View file

@ -4,12 +4,13 @@ using System.Threading.Tasks;
using Kurs.Languages.Entities; using Kurs.Languages.Entities;
using Kurs.Languages.Languages; using Kurs.Languages.Languages;
using Kurs.Platform.Entities; using Kurs.Platform.Entities;
using Kurs.Platform.Identity; using Kurs.Platform.Enums;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.MultiTenancy; using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement; using Volo.Abp.PermissionManagement;
using static Kurs.Settings.SettingsConsts;
namespace Kurs.Platform.ListForms; namespace Kurs.Platform.ListForms;
@ -133,6 +134,7 @@ public class ListFormWizardAppService(
await repoDataSource.InsertAsync(new DataSource await repoDataSource.InsertAsync(new DataSource
{ {
Code = input.DataSourceCode, Code = input.DataSourceCode,
DataSourceType = input.DataSourceConnectionString.IndexOf("Server") >= 0 ? DataSourceTypeEnum.Mssql : DataSourceTypeEnum.Postgresql,
ConnectionString = input.DataSourceConnectionString ConnectionString = input.DataSourceConnectionString
}); });
} }

View file

@ -135,7 +135,7 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
{ {
Title = "Tenant Form", Title = "Tenant Form",
Width = 500, Width = 500,
Height = 350 Height = 550
}, },
AllowDeleting = true, AllowDeleting = true,
AllowAdding = true, AllowAdding = true,
@ -147,7 +147,24 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
new() { Order=1, ColCount=1, ColSpan=2, ItemType="group", Items = 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=1, DataField="Name", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=2, DataField="IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox }, new EditingFormItemDto { Order=2, DataField="InstitutionName", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=3, DataField="VknTckn", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox },
new EditingFormItemDto { Order=4, DataField="TaxOffice", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=5, DataField="Mobile", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxNumberBox },
new EditingFormItemDto { Order=6, DataField="Phone", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxNumberBox },
new EditingFormItemDto { Order=7, DataField="Fax", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=8, DataField="IsActive", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxCheckBox },
]
},
new() { Order=2, ColCount=1, ColSpan=2, ItemType="group", Items =
[
new EditingFormItemDto { Order=1, DataField="Address", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=2, DataField="Address2", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=3, DataField="City", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=4, DataField="District", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=5, DataField="PostalCode", ColSpan=2, IsRequired=false, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=6, DataField="Email", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
new EditingFormItemDto { Order=7, DataField="Website", ColSpan=2, IsRequired=true, EditorType2=EditorTypes.dxTextBox },
] ]
} }
}), }),
@ -221,7 +238,7 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
CultureName = LanguageCodes.En, CultureName = LanguageCodes.En,
SourceDbType = DbType.String, SourceDbType = DbType.String,
FieldName = "Name", FieldName = "Name",
Width = 800, Width = 100,
ListOrderNo = 2, ListOrderNo = 2,
Visible = true, Visible = true,
IsActive = true, IsActive = true,
@ -240,6 +257,357 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
IsPivot = true IsPivot = true
}) })
}, },
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "InstitutionName",
Width = 200,
ListOrderNo = 3,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "VknTckn",
Width = 100,
ListOrderNo = 4,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "TaxOffice",
Width = 150,
ListOrderNo = 5,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Address",
Width = 150,
ListOrderNo = 6,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Address2",
Width = 150,
ListOrderNo = 7,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "City",
Width = 100,
ListOrderNo = 8,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "District",
Width = 100,
ListOrderNo = 9,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "PostalCode",
Width = 100,
ListOrderNo = 10,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Email",
Width = 170,
ListOrderNo = 11,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Website",
Width = 170,
ListOrderNo = 12,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Mobile",
Width = 100,
ListOrderNo = 13,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Phone",
Width = 100,
ListOrderNo = 14,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField
{
ListFormCode = listFormTenants.ListFormCode,
RoleId = null,
UserId = null,
CultureName = LanguageCodes.En,
SourceDbType = DbType.String,
FieldName = "Fax",
Width = 100,
ListOrderNo = 15,
Visible = true,
IsActive = true,
IsDeleted = false,
AllowSearch = true,
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
{
C = TenantManagementPermissions.Tenants.Create,
R = TenantManagementPermissions.Tenants.Default,
U = TenantManagementPermissions.Tenants.Update,
E = true,
Deny = false
}),
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
{
IsPivot = true
})
},
new ListFormField new ListFormField
{ {
ListFormCode = listFormTenants.ListFormCode, ListFormCode = listFormTenants.ListFormCode,
@ -249,7 +617,7 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency
SourceDbType = DbType.Boolean, SourceDbType = DbType.Boolean,
FieldName = "IsActive", FieldName = "IsActive",
Width = 100, Width = 100,
ListOrderNo = 3, ListOrderNo = 16,
Visible = true, Visible = true,
IsActive = true, IsActive = true,
IsDeleted = false, IsDeleted = false,

View file

@ -3,7 +3,6 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using Kurs.Languages.Languages; using Kurs.Languages.Languages;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using static Kurs.Settings.SettingsConsts;
namespace Kurs.Platform; namespace Kurs.Platform;
@ -27,6 +26,19 @@ public static class PlatformConsts
public static class Tenants public static class Tenants
{ {
public const string IsActive = "IsActive"; public const string IsActive = "IsActive";
public const string InstitutionName = "InstitutionName";
public const string VknTckn = "VknTckn";
public const string TaxOffice = "TaxOffice";
public const string Address = "Address";
public const string Address2 = "Address2";
public const string District = "District";
public const string City = "City";
public const string PostalCode = "PostalCode";
public const string Phone = "Phone";
public const string Mobile = "Mobile";
public const string Fax = "Fax";
public const string Email = "Email";
public const string Website = "Website";
} }
public static class AbpIdentity public static class AbpIdentity

View file

@ -1,4 +1,5 @@
using Volo.Abp.Data; using System;
using Volo.Abp.Data;
using Volo.Abp.TenantManagement; using Volo.Abp.TenantManagement;
namespace Kurs.Platform.Extensions; namespace Kurs.Platform.Extensions;
@ -14,4 +15,121 @@ public static class AbpTenantExtensions
{ {
return tenant.GetProperty<bool>(PlatformConsts.Tenants.IsActive); return tenant.GetProperty<bool>(PlatformConsts.Tenants.IsActive);
} }
public static void SetInstitutionName(this Tenant tenant, string institutionName)
{
tenant.SetProperty(PlatformConsts.Tenants.InstitutionName, institutionName);
}
public static string GetInstitutionName(this Tenant tenant)
{
return tenant.GetProperty<string>(PlatformConsts.Tenants.InstitutionName);
}
public static void SetVknTckn(this Tenant tenant, long vknTckn)
{
tenant.SetProperty(PlatformConsts.Tenants.VknTckn, vknTckn);
}
public static long GetVknTckn(this Tenant tenant)
{
return tenant.GetProperty<int>(PlatformConsts.Tenants.VknTckn);
}
public static void SetTaxOffice(this Tenant tenant, string taxOffice)
{
tenant.SetProperty(PlatformConsts.Tenants.TaxOffice, taxOffice);
}
public static string GetTaxOffice(this Tenant tenant)
{
return tenant.GetProperty<string>(PlatformConsts.Tenants.TaxOffice);
}
public static void SetAddress(this Tenant tenant, string address)
{
tenant.SetProperty(PlatformConsts.Tenants.Address, address);
}
public static string GetAddress(this Tenant tenant)
{
return tenant.GetProperty<string>(PlatformConsts.Tenants.Address);
}
public static void SetAddress2(this Tenant tenant, string address2)
{
tenant.SetProperty(PlatformConsts.Tenants.Address2, address2);
}
public static string GetAddress2(this Tenant tenant)
{
return tenant.GetProperty<string>(PlatformConsts.Tenants.Address2);
}
public static void SetDistrict(this Tenant tenant, string district)
{
tenant.SetProperty(PlatformConsts.Tenants.District, district);
}
public static string GetDistrict(this Tenant tenant)
{
return tenant.GetProperty<string>(PlatformConsts.Tenants.District);
}
public static void SetCity(this Tenant tenant, string city)
{
tenant.SetProperty(PlatformConsts.Tenants.City, city);
}
public static string GetCityState(this Tenant tenant)
{
return tenant.GetProperty<string>(PlatformConsts.Tenants.City);
}
public static void SetPostalCode(this Tenant tenant, string postalCode)
{
tenant.SetProperty(PlatformConsts.Tenants.PostalCode, postalCode);
}
public static string GetPostalCode(this Tenant tenant)
{
return tenant.GetProperty<string>(PlatformConsts.Tenants.PostalCode);
}
public static void SetPhone(this Tenant tenant, long phone)
{
tenant.SetProperty(PlatformConsts.Tenants.Phone, phone);
}
public static long GetPhone(this Tenant tenant)
{
return tenant.GetProperty<long>(PlatformConsts.Tenants.Phone);
}
public static void SetMobile(this Tenant tenant, long mobile)
{
tenant.SetProperty(PlatformConsts.Tenants.Mobile, mobile);
}
public static long GetMobile(this Tenant tenant)
{
return tenant.GetProperty<long>(PlatformConsts.Tenants.Mobile);
}
public static void SetFax(this Tenant tenant, long fax)
{
tenant.SetProperty(PlatformConsts.Tenants.Fax, fax);
}
public static long GetFax(this Tenant tenant)
{
return tenant.GetProperty<long>(PlatformConsts.Tenants.Fax);
}
public static void SetEmail(this Tenant tenant, string email)
{
tenant.SetProperty(PlatformConsts.Tenants.Email, email);
}
public static string GetEmail(this Tenant tenant)
{
return tenant.GetProperty<string>(PlatformConsts.Tenants.Email);
}
public static void SetWebsite(this Tenant tenant, string website)
{
tenant.SetProperty(PlatformConsts.Tenants.Website, website);
}
public static string GetWebsite(this Tenant tenant)
{
return tenant.GetProperty<string>(PlatformConsts.Tenants.Website);
}
} }

View file

@ -1,11 +1,13 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Kurs.Platform.Entities; using Kurs.Platform.Entities;
using Kurs.Platform.Enums;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events; using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.TenantManagement; using Volo.Abp.TenantManagement;
using static Kurs.Settings.SettingsConsts;
namespace Kurs.Platform.Tenants; namespace Kurs.Platform.Tenants;
@ -36,7 +38,7 @@ public class TenantConnectionStringEventHandler :
{ {
Code = tenant.Name, Code = tenant.Name,
ConnectionString = entity.Value, ConnectionString = entity.Value,
DataSourceType = Enums.DataSourceTypeEnum.Postgresql DataSourceType = entity.Value.IndexOf("Server") >= 0 ? DataSourceTypeEnum.Mssql : DataSourceTypeEnum.Postgresql,
}); });
} }

View file

@ -55,6 +55,123 @@ public static class PlatformEfCoreEntityExtensionMappings
} }
); );
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, string>(
PlatformConsts.Tenants.InstitutionName,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasMaxLength(64).HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, long>(
PlatformConsts.Tenants.VknTckn,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, string>(
PlatformConsts.Tenants.TaxOffice,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasMaxLength(64).HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, string>(
PlatformConsts.Tenants.Address,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasMaxLength(256).HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, string>(
PlatformConsts.Tenants.Address2,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasMaxLength(256).HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, string>(
PlatformConsts.Tenants.District,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasMaxLength(128).HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, string>(
PlatformConsts.Tenants.City,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasMaxLength(128).HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, string>(
PlatformConsts.Tenants.PostalCode,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasMaxLength(10).HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, long>(
PlatformConsts.Tenants.Phone,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, long>(
PlatformConsts.Tenants.Mobile,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, long>(
PlatformConsts.Tenants.Fax,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, string>(
PlatformConsts.Tenants.Email,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasMaxLength(256).HasDefaultValue(null);
}
);
ObjectExtensionManager.Instance
.MapEfCoreProperty<Tenant, string>(
PlatformConsts.Tenants.Website,
(entityBuilder, propertyBuilder) =>
{
propertyBuilder.HasMaxLength(256).HasDefaultValue(null);
}
);
/* You can configure extra properties for the /* You can configure extra properties for the
* entities defined in the modules used by your application. * entities defined in the modules used by your application.
* *

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,161 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kurs.Platform.Migrations
{
/// <inheritdoc />
public partial class TenantExtensions : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Address",
table: "AbpTenants",
type: "nvarchar(256)",
maxLength: 256,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Address2",
table: "AbpTenants",
type: "nvarchar(256)",
maxLength: 256,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "City",
table: "AbpTenants",
type: "nvarchar(128)",
maxLength: 128,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "District",
table: "AbpTenants",
type: "nvarchar(128)",
maxLength: 128,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Email",
table: "AbpTenants",
type: "nvarchar(256)",
maxLength: 256,
nullable: true);
migrationBuilder.AddColumn<long>(
name: "Fax",
table: "AbpTenants",
type: "bigint",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<string>(
name: "InstitutionName",
table: "AbpTenants",
type: "nvarchar(64)",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<long>(
name: "Mobile",
table: "AbpTenants",
type: "bigint",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<long>(
name: "Phone",
table: "AbpTenants",
type: "bigint",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<string>(
name: "PostalCode",
table: "AbpTenants",
type: "nvarchar(10)",
maxLength: 10,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "TaxOffice",
table: "AbpTenants",
type: "nvarchar(64)",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<long>(
name: "VknTckn",
table: "AbpTenants",
type: "bigint",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<string>(
name: "Website",
table: "AbpTenants",
type: "nvarchar(256)",
maxLength: 256,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Address",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "Address2",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "City",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "District",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "Email",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "Fax",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "InstitutionName",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "Mobile",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "Phone",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "PostalCode",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "TaxOffice",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "VknTckn",
table: "AbpTenants");
migrationBuilder.DropColumn(
name: "Website",
table: "AbpTenants");
}
}
}

View file

@ -3245,6 +3245,18 @@ namespace Kurs.Platform.Migrations
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("Address")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("Address2")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("City")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ConcurrencyStamp") b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.IsRequired() .IsRequired()
@ -3268,6 +3280,14 @@ namespace Kurs.Platform.Migrations
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasColumnName("DeletionTime"); .HasColumnName("DeletionTime");
b.Property<string>("District")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<int>("EntityVersion") b.Property<int>("EntityVersion")
.HasColumnType("int"); .HasColumnType("int");
@ -3276,6 +3296,13 @@ namespace Kurs.Platform.Migrations
.HasColumnType("nvarchar(max)") .HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties"); .HasColumnName("ExtraProperties");
b.Property<long>("Fax")
.HasColumnType("bigint");
b.Property<string>("InstitutionName")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit") .HasColumnType("bit")
@ -3295,6 +3322,9 @@ namespace Kurs.Platform.Migrations
.HasColumnType("uniqueidentifier") .HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId"); .HasColumnName("LastModifierId");
b.Property<long>("Mobile")
.HasColumnType("bigint");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasMaxLength(64) .HasMaxLength(64)
@ -3305,6 +3335,24 @@ namespace Kurs.Platform.Migrations
.HasMaxLength(64) .HasMaxLength(64)
.HasColumnType("nvarchar(64)"); .HasColumnType("nvarchar(64)");
b.Property<long>("Phone")
.HasColumnType("bigint");
b.Property<string>("PostalCode")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("TaxOffice")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<long>("VknTckn")
.HasColumnType("bigint");
b.Property<string>("Website")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name"); b.HasIndex("Name");

View file

@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812" "revision": "3ca0b8505b4bec776b69afdba2768812"
}, { }, {
"url": "index.html", "url": "index.html",
"revision": "0.tgk2t9rlh7" "revision": "0.j0e979frdf8"
}], {}); }], {});
workbox.cleanupOutdatedCaches(); workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {