Country Curreny düzenlemesi ve View Creator
This commit is contained in:
parent
c3a1fe8790
commit
fe0a4b1c7c
16 changed files with 180 additions and 195 deletions
|
|
@ -7,7 +7,6 @@ using System.Threading.Tasks;
|
||||||
using Kurs.Languages.Entities;
|
using Kurs.Languages.Entities;
|
||||||
using Kurs.Platform.Entities;
|
using Kurs.Platform.Entities;
|
||||||
using Kurs.Platform.Enums;
|
using Kurs.Platform.Enums;
|
||||||
using Kurs.Platform.Seeds;
|
|
||||||
using Kurs.Settings.Entities;
|
using Kurs.Settings.Entities;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Volo.Abp.Data;
|
using Volo.Abp.Data;
|
||||||
|
|
@ -175,12 +174,14 @@ public class HostDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
if (!seenCodes.Add(item.Code) || existingCodes.Contains(item.Code))
|
if (!seenCodes.Add(item.Code) || existingCodes.Contains(item.Code))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
var currency = await _currencyRepository.FirstOrDefaultAsync(c => c.Code == item.CurrencyCode);
|
||||||
|
|
||||||
buffer.Add(new Country(
|
buffer.Add(new Country(
|
||||||
Guid.NewGuid(),
|
Guid.NewGuid(),
|
||||||
item.Code,
|
item.Code,
|
||||||
item.Name,
|
item.Name,
|
||||||
item.GroupName,
|
item.GroupName,
|
||||||
item.CurrencyCode,
|
currency != null ? currency.Id : null,
|
||||||
item.PhoneCode,
|
item.PhoneCode,
|
||||||
item.TaxLabel
|
item.TaxLabel
|
||||||
));
|
));
|
||||||
|
|
@ -525,7 +526,7 @@ public class HostDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
Symbol = item.Symbol,
|
Symbol = item.Symbol,
|
||||||
Name = item.Name,
|
Name = item.Name,
|
||||||
IsActive = item.IsActive
|
IsActive = item.IsActive
|
||||||
});
|
}, autoSave: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43704,7 +43704,7 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
|
||||||
IsOrganizationUnit = false,
|
IsOrganizationUnit = false,
|
||||||
Description = AppCodes.SupplyChain.MaterialGroup,
|
Description = AppCodes.SupplyChain.MaterialGroup,
|
||||||
SelectCommandType = SelectCommandTypeEnum.Table,
|
SelectCommandType = SelectCommandTypeEnum.Table,
|
||||||
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.MaterialGroup)),
|
SelectCommand = TableNameResolver.GetFullViewName(nameof(TableNameEnum.MaterialGroup)),
|
||||||
KeyFieldName = "Id",
|
KeyFieldName = "Id",
|
||||||
KeyFieldDbSourceType = DbType.Guid,
|
KeyFieldDbSourceType = DbType.Guid,
|
||||||
DefaultFilter = "\"IsDeleted\" = 'false'",
|
DefaultFilter = "\"IsDeleted\" = 'false'",
|
||||||
|
|
@ -43774,7 +43774,7 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
|
||||||
AllowDeleting = true,
|
AllowDeleting = true,
|
||||||
AllowAdding = true,
|
AllowAdding = true,
|
||||||
AllowUpdating = true,
|
AllowUpdating = true,
|
||||||
SendOnlyChangedFormValuesUpdate = false,
|
SendOnlyChangedFormValuesUpdate = true,
|
||||||
}),
|
}),
|
||||||
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
EditingFormJson = JsonSerializer.Serialize(new List<EditingFormDto>() {
|
||||||
new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=
|
new() { Order=1,ColCount=1,ColSpan=2,ItemType="group", Items=
|
||||||
|
|
@ -43856,7 +43856,7 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
|
||||||
CultureName = LanguageCodes.En,
|
CultureName = LanguageCodes.En,
|
||||||
SourceDbType = DbType.String,
|
SourceDbType = DbType.String,
|
||||||
FieldName = "Code",
|
FieldName = "Code",
|
||||||
Width = 250,
|
Width = 200,
|
||||||
ListOrderNo = 2,
|
ListOrderNo = 2,
|
||||||
Visible = true,
|
Visible = true,
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
|
|
@ -43890,13 +43890,11 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
|
||||||
CultureName = LanguageCodes.En,
|
CultureName = LanguageCodes.En,
|
||||||
SourceDbType = DbType.String,
|
SourceDbType = DbType.String,
|
||||||
FieldName = "Name",
|
FieldName = "Name",
|
||||||
Width = 350,
|
Width = 250,
|
||||||
ListOrderNo = 3,
|
ListOrderNo = 3,
|
||||||
Visible = true,
|
Visible = true,
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
SortIndex = 1,
|
|
||||||
SortDirection = GridColumnOptions.SortOrderAsc,
|
|
||||||
AllowSearch = true,
|
AllowSearch = true,
|
||||||
ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] {
|
ValidationRuleJson = JsonSerializer.Serialize(new ValidationRuleDto[] {
|
||||||
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }
|
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }
|
||||||
|
|
@ -43926,7 +43924,7 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
|
||||||
CultureName = LanguageCodes.En,
|
CultureName = LanguageCodes.En,
|
||||||
SourceDbType = DbType.String,
|
SourceDbType = DbType.String,
|
||||||
FieldName = "Description",
|
FieldName = "Description",
|
||||||
Width = 500,
|
Width = 300,
|
||||||
ListOrderNo = 4,
|
ListOrderNo = 4,
|
||||||
Visible = true,
|
Visible = true,
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
|
|
@ -43988,7 +43986,7 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
|
||||||
CultureName = LanguageCodes.En,
|
CultureName = LanguageCodes.En,
|
||||||
SourceDbType = DbType.Guid,
|
SourceDbType = DbType.Guid,
|
||||||
FieldName = "ParentGroupId",
|
FieldName = "ParentGroupId",
|
||||||
Width = 200,
|
Width = 400,
|
||||||
ListOrderNo = 6,
|
ListOrderNo = 6,
|
||||||
Visible = true,
|
Visible = true,
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
|
|
@ -44017,13 +44015,40 @@ public class ListFormSeeder : IDataSeedContributor, ITransientDependency
|
||||||
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
|
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
|
||||||
{
|
{
|
||||||
IsPivot = true
|
IsPivot = true
|
||||||
}),
|
|
||||||
GroupingJson = JsonSerializer.Serialize(new ColumnGroupingDto
|
|
||||||
{
|
|
||||||
GroupIndex = 1,
|
|
||||||
AllowGrouping = true,
|
|
||||||
AutoExpandGroup = true
|
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
new() {
|
||||||
|
ListFormCode = listFormMaterialGroup.ListFormCode,
|
||||||
|
RoleId = null,
|
||||||
|
UserId = null,
|
||||||
|
CultureName = LanguageCodes.En,
|
||||||
|
SourceDbType = DbType.String,
|
||||||
|
FieldName = "HierarchyPath",
|
||||||
|
Width = 500,
|
||||||
|
ListOrderNo = 7,
|
||||||
|
Visible = true,
|
||||||
|
IsActive = true,
|
||||||
|
IsDeleted = false,
|
||||||
|
AllowSearch = true,
|
||||||
|
SortIndex = 1,
|
||||||
|
SortDirection = GridColumnOptions.SortOrderAsc,
|
||||||
|
ColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto
|
||||||
|
{
|
||||||
|
AllowReordering = true,
|
||||||
|
}),
|
||||||
|
PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||||
|
{
|
||||||
|
C = AppCodes.SupplyChain.MaterialGroup + ".Create",
|
||||||
|
R = AppCodes.SupplyChain.MaterialGroup,
|
||||||
|
U = AppCodes.SupplyChain.MaterialGroup + ".Update",
|
||||||
|
E = true,
|
||||||
|
I = true,
|
||||||
|
Deny = false
|
||||||
|
}),
|
||||||
|
PivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
|
||||||
|
{
|
||||||
|
IsPivot = true
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,7 @@ public static class LookupQueryValues
|
||||||
public static string MaterialGroupValues =
|
public static string MaterialGroupValues =
|
||||||
$"SELECT " +
|
$"SELECT " +
|
||||||
$"\"Id\" AS \"Key\", " +
|
$"\"Id\" AS \"Key\", " +
|
||||||
$"\"Name\" AS \"Name\" " +
|
$"\"HierarchyPath\" AS \"Name\" " +
|
||||||
$"FROM \"{FullNameTable(TableNameEnum.MaterialGroup)}\" " +
|
$"FROM \"{FullNameView(TableNameEnum.MaterialGroup)}\" " +
|
||||||
$"WHERE \"IsDeleted\" = 'false' ";
|
$"WHERE \"IsDeleted\" = 'false' ";
|
||||||
}
|
}
|
||||||
|
|
@ -48,6 +48,11 @@ public static class PlatformConsts
|
||||||
return TableNameResolver.GetFullTableName($"{TableName}");
|
return TableNameResolver.GetFullTableName($"{TableName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string FullNameView(TableNameEnum TableName)
|
||||||
|
{
|
||||||
|
return TableNameResolver.GetFullViewName($"{TableName}");
|
||||||
|
}
|
||||||
|
|
||||||
public static class TablePrefix
|
public static class TablePrefix
|
||||||
{
|
{
|
||||||
public static string PlatformByName(MenuPrefix MenuGroup, TableNameEnum tableName)
|
public static string PlatformByName(MenuPrefix MenuGroup, TableNameEnum tableName)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ namespace Kurs.Platform.Enums;
|
||||||
|
|
||||||
public static class TableNameResolver
|
public static class TableNameResolver
|
||||||
{
|
{
|
||||||
|
public const string ViewPrefix = "V_";
|
||||||
|
|
||||||
// Tüm tabloların hangi prefix tipine ve menü grubuna ait olduğunu belirten harita
|
// Tüm tabloların hangi prefix tipine ve menü grubuna ait olduğunu belirten harita
|
||||||
private static readonly Dictionary<string, (Func<MenuPrefix, TableNameEnum, string> Method, MenuPrefix PrefixGroup)> _map
|
private static readonly Dictionary<string, (Func<MenuPrefix, TableNameEnum, string> Method, MenuPrefix PrefixGroup)> _map
|
||||||
= new(StringComparer.OrdinalIgnoreCase)
|
= new(StringComparer.OrdinalIgnoreCase)
|
||||||
|
|
@ -174,4 +176,15 @@ public static class TableNameResolver
|
||||||
|
|
||||||
return entry.Method(entry.PrefixGroup, tableEnum);
|
return entry.Method(entry.PrefixGroup, tableEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetFullViewName(string tableName)
|
||||||
|
{
|
||||||
|
if (!Enum.TryParse<TableNameEnum>(tableName, out var tableEnum))
|
||||||
|
throw new ArgumentException($"'{tableName}' geçerli bir TableNameEnum değil.");
|
||||||
|
|
||||||
|
if (!_map.TryGetValue(tableName, out var entry))
|
||||||
|
throw new KeyNotFoundException($"'{tableName}' için tablo eşlemesi bulunamadı.");
|
||||||
|
|
||||||
|
return ViewPrefix + entry.Method(entry.PrefixGroup, tableEnum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ public class BankAccount : FullAuditedEntity<Guid>, IMultiTenant
|
||||||
public Bank Bank { get; set; }
|
public Bank Bank { get; set; }
|
||||||
public string AccountOwner { get; set; }
|
public string AccountOwner { get; set; }
|
||||||
public Guid? CurrencyId { get; set; } // Currency entity'sine referans
|
public Guid? CurrencyId { get; set; } // Currency entity'sine referans
|
||||||
public Currency Currency { get; set; }
|
|
||||||
public bool CanTransferMoney { get; set; }
|
public bool CanTransferMoney { get; set; }
|
||||||
public string Company { get; set; }
|
public string Company { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ public class Country : FullAuditedEntity<Guid>
|
||||||
public string Code { get; set; } // TR, US
|
public string Code { get; set; } // TR, US
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string GroupName { get; set; }
|
public string GroupName { get; set; }
|
||||||
public string CurrencyCode { get; set; }
|
public Guid? CurrencyId { get; set; }
|
||||||
public int PhoneCode { get; set; }
|
public int PhoneCode { get; set; }
|
||||||
public string TaxLabel { get; set; }
|
public string TaxLabel { get; set; }
|
||||||
public bool ZipRequired { get; set; }
|
public bool ZipRequired { get; set; }
|
||||||
|
|
@ -24,7 +24,7 @@ public class Country : FullAuditedEntity<Guid>
|
||||||
string code,
|
string code,
|
||||||
string name,
|
string name,
|
||||||
string groupName,
|
string groupName,
|
||||||
string currentyCode,
|
Guid? currencyId,
|
||||||
int phoneCode,
|
int phoneCode,
|
||||||
string taxLabel,
|
string taxLabel,
|
||||||
bool zipRequired = false,
|
bool zipRequired = false,
|
||||||
|
|
@ -34,7 +34,7 @@ public class Country : FullAuditedEntity<Guid>
|
||||||
Code = code;
|
Code = code;
|
||||||
Name = name;
|
Name = name;
|
||||||
GroupName = groupName;
|
GroupName = groupName;
|
||||||
CurrencyCode = currentyCode;
|
CurrencyId = currencyId;
|
||||||
PhoneCode = phoneCode;
|
PhoneCode = phoneCode;
|
||||||
TaxLabel = taxLabel;
|
TaxLabel = taxLabel;
|
||||||
ZipRequired = zipRequired;
|
ZipRequired = zipRequired;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ public class CostCenter : FullAuditedEntity<Guid>, IMultiTenant
|
||||||
public decimal BudgetedAmount { get; set; }
|
public decimal BudgetedAmount { get; set; }
|
||||||
public decimal ActualAmount { get; set; }
|
public decimal ActualAmount { get; set; }
|
||||||
public Guid? CurrencyId { get; set; }
|
public Guid? CurrencyId { get; set; }
|
||||||
public Currency Currency { get; set; }
|
|
||||||
public string FiscalYear { get; set; }
|
public string FiscalYear { get; set; }
|
||||||
public bool IsActive { get; set; }
|
public bool IsActive { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ public class Employee : FullAuditedEntity<Guid>, IMultiTenant
|
||||||
|
|
||||||
public decimal BaseSalary { get; set; }
|
public decimal BaseSalary { get; set; }
|
||||||
public Guid? CurrencyId { get; set; }
|
public Guid? CurrencyId { get; set; }
|
||||||
public Currency Currency { get; set; }
|
|
||||||
|
|
||||||
public string PayrollGroup { get; set; } // e.g., Monthly, Biweekly, Weekly
|
public string PayrollGroup { get; set; } // e.g., Monthly, Biweekly, Weekly
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ public class Expense : FullAuditedEntity<Guid>, IMultiTenant
|
||||||
public string Category { get; set; }
|
public string Category { get; set; }
|
||||||
public decimal Amount { get; set; }
|
public decimal Amount { get; set; }
|
||||||
public Guid? CurrencyId { get; set; }
|
public Guid? CurrencyId { get; set; }
|
||||||
public Currency Currency { get; set; }
|
|
||||||
|
|
||||||
public DateTime RequestDate { get; set; }
|
public DateTime RequestDate { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ public class JobPosition : FullAuditedEntity<Guid>, IMultiTenant
|
||||||
public decimal MinSalary { get; set; }
|
public decimal MinSalary { get; set; }
|
||||||
public decimal MaxSalary { get; set; }
|
public decimal MaxSalary { get; set; }
|
||||||
public Guid? CurrencyId { get; set; }
|
public Guid? CurrencyId { get; set; }
|
||||||
public Currency Currency { get; set; }
|
|
||||||
public string RequiredSkills { get; set; }
|
public string RequiredSkills { get; set; }
|
||||||
public string Responsibilities { get; set; }
|
public string Responsibilities { get; set; }
|
||||||
public string Qualifications { get; set; }
|
public string Qualifications { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -831,7 +831,6 @@ public class PlatformDbContext :
|
||||||
b.Property(x => x.Code).IsRequired().HasMaxLength(8);
|
b.Property(x => x.Code).IsRequired().HasMaxLength(8);
|
||||||
b.Property(x => x.Name).IsRequired().HasMaxLength(128);
|
b.Property(x => x.Name).IsRequired().HasMaxLength(128);
|
||||||
b.Property(x => x.GroupName).HasMaxLength(128);
|
b.Property(x => x.GroupName).HasMaxLength(128);
|
||||||
b.Property(x => x.CurrencyCode).HasMaxLength(8);
|
|
||||||
b.Property(x => x.TaxLabel).HasMaxLength(64);
|
b.Property(x => x.TaxLabel).HasMaxLength(64);
|
||||||
|
|
||||||
b.HasIndex(x => x.Code).IsUnique();
|
b.HasIndex(x => x.Code).IsUnique();
|
||||||
|
|
@ -1647,19 +1646,12 @@ public class PlatformDbContext :
|
||||||
b.Property(x => x.Company).HasMaxLength(256);
|
b.Property(x => x.Company).HasMaxLength(256);
|
||||||
|
|
||||||
b.Property(x => x.BankId).IsRequired();
|
b.Property(x => x.BankId).IsRequired();
|
||||||
b.Property(x => x.CurrencyId);
|
|
||||||
|
|
||||||
b.HasOne(x => x.Bank)
|
b.HasOne(x => x.Bank)
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasPrincipalKey(x => x.Id)
|
.HasPrincipalKey(x => x.Id)
|
||||||
.HasForeignKey(x => x.BankId)
|
.HasForeignKey(x => x.BankId)
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
b.HasOne(x => x.Currency)
|
|
||||||
.WithMany()
|
|
||||||
.HasPrincipalKey(x => x.Id)
|
|
||||||
.HasForeignKey(x => x.CurrencyId)
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Entity<EmploymentType>(b =>
|
builder.Entity<EmploymentType>(b =>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
|
||||||
namespace Kurs.Platform.Migrations
|
namespace Kurs.Platform.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(PlatformDbContext))]
|
[DbContext(typeof(PlatformDbContext))]
|
||||||
[Migration("20251030104555_Initial")]
|
[Migration("20251030134034_Initial")]
|
||||||
partial class Initial
|
partial class Initial
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
@ -1259,8 +1259,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.HasIndex("BankId");
|
b.HasIndex("BankId");
|
||||||
|
|
||||||
b.HasIndex("CurrencyId");
|
|
||||||
|
|
||||||
b.ToTable("T_Acc_BankAccount", (string)null);
|
b.ToTable("T_Acc_BankAccount", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -2545,8 +2543,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CurrencyId");
|
|
||||||
|
|
||||||
b.HasIndex("DepartmentId");
|
b.HasIndex("DepartmentId");
|
||||||
|
|
||||||
b.HasIndex("ParentCostCenterId");
|
b.HasIndex("ParentCostCenterId");
|
||||||
|
|
@ -2574,9 +2570,8 @@ namespace Kurs.Platform.Migrations
|
||||||
.HasColumnType("uniqueidentifier")
|
.HasColumnType("uniqueidentifier")
|
||||||
.HasColumnName("CreatorId");
|
.HasColumnName("CreatorId");
|
||||||
|
|
||||||
b.Property<string>("CurrencyCode")
|
b.Property<Guid?>("CurrencyId")
|
||||||
.HasMaxLength(8)
|
.HasColumnType("uniqueidentifier");
|
||||||
.HasColumnType("nvarchar(8)");
|
|
||||||
|
|
||||||
b.Property<Guid?>("DeleterId")
|
b.Property<Guid?>("DeleterId")
|
||||||
.HasColumnType("uniqueidentifier")
|
.HasColumnType("uniqueidentifier")
|
||||||
|
|
@ -3650,8 +3645,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.HasIndex("BankAccountId");
|
b.HasIndex("BankAccountId");
|
||||||
|
|
||||||
b.HasIndex("CurrencyId");
|
|
||||||
|
|
||||||
b.HasIndex("DepartmentId");
|
b.HasIndex("DepartmentId");
|
||||||
|
|
||||||
b.HasIndex("EmploymentTypeId");
|
b.HasIndex("EmploymentTypeId");
|
||||||
|
|
@ -4102,8 +4095,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.HasIndex("ApproverId");
|
b.HasIndex("ApproverId");
|
||||||
|
|
||||||
b.HasIndex("CurrencyId");
|
|
||||||
|
|
||||||
b.HasIndex("EmployeeId");
|
b.HasIndex("EmployeeId");
|
||||||
|
|
||||||
b.ToTable("T_Hr_Expense", (string)null);
|
b.ToTable("T_Hr_Expense", (string)null);
|
||||||
|
|
@ -4401,8 +4392,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CurrencyId");
|
|
||||||
|
|
||||||
b.HasIndex("DepartmentId");
|
b.HasIndex("DepartmentId");
|
||||||
|
|
||||||
b.ToTable("T_Hr_JobPosition", (string)null);
|
b.ToTable("T_Hr_JobPosition", (string)null);
|
||||||
|
|
@ -11629,14 +11618,7 @@ namespace Kurs.Platform.Migrations
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Currency", "Currency")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrencyId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
|
|
||||||
b.Navigation("Bank");
|
b.Navigation("Bank");
|
||||||
|
|
||||||
b.Navigation("Currency");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Kurs.Platform.Entities.BlogPost", b =>
|
modelBuilder.Entity("Kurs.Platform.Entities.BlogPost", b =>
|
||||||
|
|
@ -11733,10 +11715,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
modelBuilder.Entity("Kurs.Platform.Entities.CostCenter", b =>
|
modelBuilder.Entity("Kurs.Platform.Entities.CostCenter", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Kurs.Platform.Entities.Currency", "Currency")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrencyId");
|
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("DepartmentId");
|
.HasForeignKey("DepartmentId");
|
||||||
|
|
@ -11749,8 +11727,6 @@ namespace Kurs.Platform.Migrations
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ResponsibleEmployeeId");
|
.HasForeignKey("ResponsibleEmployeeId");
|
||||||
|
|
||||||
b.Navigation("Currency");
|
|
||||||
|
|
||||||
b.Navigation("Department");
|
b.Navigation("Department");
|
||||||
|
|
||||||
b.Navigation("ParentCostCenter");
|
b.Navigation("ParentCostCenter");
|
||||||
|
|
@ -11820,10 +11796,6 @@ namespace Kurs.Platform.Migrations
|
||||||
.HasForeignKey("BankAccountId")
|
.HasForeignKey("BankAccountId")
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Currency", "Currency")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrencyId");
|
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("DepartmentId");
|
.HasForeignKey("DepartmentId");
|
||||||
|
|
@ -11844,8 +11816,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.Navigation("BankAccount");
|
b.Navigation("BankAccount");
|
||||||
|
|
||||||
b.Navigation("Currency");
|
|
||||||
|
|
||||||
b.Navigation("Department");
|
b.Navigation("Department");
|
||||||
|
|
||||||
b.Navigation("EmploymentType");
|
b.Navigation("EmploymentType");
|
||||||
|
|
@ -11910,10 +11880,6 @@ namespace Kurs.Platform.Migrations
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ApproverId");
|
.HasForeignKey("ApproverId");
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Currency", "Currency")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrencyId");
|
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Employee", "Employee")
|
b.HasOne("Kurs.Platform.Entities.Employee", "Employee")
|
||||||
.WithMany("ExpenseRequests")
|
.WithMany("ExpenseRequests")
|
||||||
.HasForeignKey("EmployeeId")
|
.HasForeignKey("EmployeeId")
|
||||||
|
|
@ -11922,23 +11888,15 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.Navigation("Approver");
|
b.Navigation("Approver");
|
||||||
|
|
||||||
b.Navigation("Currency");
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
b.Navigation("Employee");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Kurs.Platform.Entities.JobPosition", b =>
|
modelBuilder.Entity("Kurs.Platform.Entities.JobPosition", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Kurs.Platform.Entities.Currency", "Currency")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrencyId");
|
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("DepartmentId");
|
.HasForeignKey("DepartmentId");
|
||||||
|
|
||||||
b.Navigation("Currency");
|
|
||||||
|
|
||||||
b.Navigation("Department");
|
b.Navigation("Department");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -2817,7 +2817,7 @@ namespace Kurs.Platform.Migrations
|
||||||
Code = table.Column<string>(type: "nvarchar(8)", maxLength: 8, nullable: false),
|
Code = table.Column<string>(type: "nvarchar(8)", maxLength: 8, nullable: false),
|
||||||
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
|
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
|
||||||
GroupName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
|
GroupName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
|
||||||
CurrencyCode = table.Column<string>(type: "nvarchar(8)", maxLength: 8, nullable: true),
|
CurrencyId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||||
PhoneCode = table.Column<int>(type: "int", nullable: false),
|
PhoneCode = table.Column<int>(type: "int", nullable: false),
|
||||||
TaxLabel = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
TaxLabel = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
||||||
ZipRequired = table.Column<bool>(type: "bit", nullable: false),
|
ZipRequired = table.Column<bool>(type: "bit", nullable: false),
|
||||||
|
|
@ -3020,12 +3020,6 @@ namespace Kurs.Platform.Migrations
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_T_Acc_BankAccount", x => x.Id);
|
table.PrimaryKey("PK_T_Acc_BankAccount", x => x.Id);
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_T_Acc_BankAccount_P_Sas_Currency_CurrencyId",
|
|
||||||
column: x => x.CurrencyId,
|
|
||||||
principalTable: "P_Sas_Currency",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Restrict);
|
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_T_Acc_BankAccount_T_Acc_Bank_BankId",
|
name: "FK_T_Acc_BankAccount_T_Acc_Bank_BankId",
|
||||||
column: x => x.BankId,
|
column: x => x.BankId,
|
||||||
|
|
@ -3938,11 +3932,6 @@ namespace Kurs.Platform.Migrations
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_T_Hr_CostCenter", x => x.Id);
|
table.PrimaryKey("PK_T_Hr_CostCenter", x => x.Id);
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_T_Hr_CostCenter_P_Sas_Currency_CurrencyId",
|
|
||||||
column: x => x.CurrencyId,
|
|
||||||
principalTable: "P_Sas_Currency",
|
|
||||||
principalColumn: "Id");
|
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_T_Hr_CostCenter_T_Hr_CostCenter_ParentCostCenterId",
|
name: "FK_T_Hr_CostCenter_T_Hr_CostCenter_ParentCostCenterId",
|
||||||
column: x => x.ParentCostCenterId,
|
column: x => x.ParentCostCenterId,
|
||||||
|
|
@ -4018,11 +4007,6 @@ namespace Kurs.Platform.Migrations
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_T_Hr_JobPosition", x => x.Id);
|
table.PrimaryKey("PK_T_Hr_JobPosition", x => x.Id);
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_T_Hr_JobPosition_P_Sas_Currency_CurrencyId",
|
|
||||||
column: x => x.CurrencyId,
|
|
||||||
principalTable: "P_Sas_Currency",
|
|
||||||
principalColumn: "Id");
|
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_T_Hr_JobPosition_T_Hr_Department_DepartmentId",
|
name: "FK_T_Hr_JobPosition_T_Hr_Department_DepartmentId",
|
||||||
column: x => x.DepartmentId,
|
column: x => x.DepartmentId,
|
||||||
|
|
@ -4120,11 +4104,6 @@ namespace Kurs.Platform.Migrations
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_T_Hr_Employee", x => x.Id);
|
table.PrimaryKey("PK_T_Hr_Employee", x => x.Id);
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_T_Hr_Employee_P_Sas_Currency_CurrencyId",
|
|
||||||
column: x => x.CurrencyId,
|
|
||||||
principalTable: "P_Sas_Currency",
|
|
||||||
principalColumn: "Id");
|
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_T_Hr_Employee_T_Acc_BankAccount_BankAccountId",
|
name: "FK_T_Hr_Employee_T_Acc_BankAccount_BankAccountId",
|
||||||
column: x => x.BankAccountId,
|
column: x => x.BankAccountId,
|
||||||
|
|
@ -4187,11 +4166,6 @@ namespace Kurs.Platform.Migrations
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_T_Hr_Expense", x => x.Id);
|
table.PrimaryKey("PK_T_Hr_Expense", x => x.Id);
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_T_Hr_Expense_P_Sas_Currency_CurrencyId",
|
|
||||||
column: x => x.CurrencyId,
|
|
||||||
principalTable: "P_Sas_Currency",
|
|
||||||
principalColumn: "Id");
|
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_T_Hr_Expense_T_Hr_Employee_ApproverId",
|
name: "FK_T_Hr_Expense_T_Hr_Employee_ApproverId",
|
||||||
column: x => x.ApproverId,
|
column: x => x.ApproverId,
|
||||||
|
|
@ -5195,11 +5169,6 @@ namespace Kurs.Platform.Migrations
|
||||||
table: "T_Acc_BankAccount",
|
table: "T_Acc_BankAccount",
|
||||||
column: "BankId");
|
column: "BankId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_T_Acc_BankAccount_CurrencyId",
|
|
||||||
table: "T_Acc_BankAccount",
|
|
||||||
column: "CurrencyId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_T_Adm_BlogCategory_Slug",
|
name: "IX_T_Adm_BlogCategory_Slug",
|
||||||
table: "T_Adm_BlogCategory",
|
table: "T_Adm_BlogCategory",
|
||||||
|
|
@ -5312,11 +5281,6 @@ namespace Kurs.Platform.Migrations
|
||||||
table: "T_Crd_QuestionOption",
|
table: "T_Crd_QuestionOption",
|
||||||
column: "QuestionId");
|
column: "QuestionId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_T_Hr_CostCenter_CurrencyId",
|
|
||||||
table: "T_Hr_CostCenter",
|
|
||||||
column: "CurrencyId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_T_Hr_CostCenter_DepartmentId",
|
name: "IX_T_Hr_CostCenter_DepartmentId",
|
||||||
table: "T_Hr_CostCenter",
|
table: "T_Hr_CostCenter",
|
||||||
|
|
@ -5357,11 +5321,6 @@ namespace Kurs.Platform.Migrations
|
||||||
table: "T_Hr_Employee",
|
table: "T_Hr_Employee",
|
||||||
column: "BankAccountId");
|
column: "BankAccountId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_T_Hr_Employee_CurrencyId",
|
|
||||||
table: "T_Hr_Employee",
|
|
||||||
column: "CurrencyId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_T_Hr_Employee_DepartmentId",
|
name: "IX_T_Hr_Employee_DepartmentId",
|
||||||
table: "T_Hr_Employee",
|
table: "T_Hr_Employee",
|
||||||
|
|
@ -5387,21 +5346,11 @@ namespace Kurs.Platform.Migrations
|
||||||
table: "T_Hr_Expense",
|
table: "T_Hr_Expense",
|
||||||
column: "ApproverId");
|
column: "ApproverId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_T_Hr_Expense_CurrencyId",
|
|
||||||
table: "T_Hr_Expense",
|
|
||||||
column: "CurrencyId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_T_Hr_Expense_EmployeeId",
|
name: "IX_T_Hr_Expense_EmployeeId",
|
||||||
table: "T_Hr_Expense",
|
table: "T_Hr_Expense",
|
||||||
column: "EmployeeId");
|
column: "EmployeeId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_T_Hr_JobPosition_CurrencyId",
|
|
||||||
table: "T_Hr_JobPosition",
|
|
||||||
column: "CurrencyId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_T_Hr_JobPosition_DepartmentId",
|
name: "IX_T_Hr_JobPosition_DepartmentId",
|
||||||
table: "T_Hr_JobPosition",
|
table: "T_Hr_JobPosition",
|
||||||
|
|
@ -5615,22 +5564,6 @@ namespace Kurs.Platform.Migrations
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_T_Acc_BankAccount_P_Sas_Currency_CurrencyId",
|
|
||||||
table: "T_Acc_BankAccount");
|
|
||||||
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_T_Hr_CostCenter_P_Sas_Currency_CurrencyId",
|
|
||||||
table: "T_Hr_CostCenter");
|
|
||||||
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_T_Hr_Employee_P_Sas_Currency_CurrencyId",
|
|
||||||
table: "T_Hr_Employee");
|
|
||||||
|
|
||||||
migrationBuilder.DropForeignKey(
|
|
||||||
name: "FK_T_Hr_JobPosition_P_Sas_Currency_CurrencyId",
|
|
||||||
table: "T_Hr_JobPosition");
|
|
||||||
|
|
||||||
migrationBuilder.DropForeignKey(
|
migrationBuilder.DropForeignKey(
|
||||||
name: "FK_T_Acc_BankAccount_T_Acc_Bank_BankId",
|
name: "FK_T_Acc_BankAccount_T_Acc_Bank_BankId",
|
||||||
table: "T_Acc_BankAccount");
|
table: "T_Acc_BankAccount");
|
||||||
|
|
@ -5767,6 +5700,9 @@ namespace Kurs.Platform.Migrations
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "P_Sas_ContactTitle");
|
name: "P_Sas_ContactTitle");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "P_Sas_Currency");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "P_Sas_DataSource");
|
name: "P_Sas_DataSource");
|
||||||
|
|
||||||
|
|
@ -6124,9 +6060,6 @@ namespace Kurs.Platform.Migrations
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "P_Sas_CountryGroup");
|
name: "P_Sas_CountryGroup");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "P_Sas_Currency");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "T_Acc_Bank");
|
name: "T_Acc_Bank");
|
||||||
|
|
||||||
|
|
@ -1256,8 +1256,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.HasIndex("BankId");
|
b.HasIndex("BankId");
|
||||||
|
|
||||||
b.HasIndex("CurrencyId");
|
|
||||||
|
|
||||||
b.ToTable("T_Acc_BankAccount", (string)null);
|
b.ToTable("T_Acc_BankAccount", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -2542,8 +2540,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CurrencyId");
|
|
||||||
|
|
||||||
b.HasIndex("DepartmentId");
|
b.HasIndex("DepartmentId");
|
||||||
|
|
||||||
b.HasIndex("ParentCostCenterId");
|
b.HasIndex("ParentCostCenterId");
|
||||||
|
|
@ -2571,9 +2567,8 @@ namespace Kurs.Platform.Migrations
|
||||||
.HasColumnType("uniqueidentifier")
|
.HasColumnType("uniqueidentifier")
|
||||||
.HasColumnName("CreatorId");
|
.HasColumnName("CreatorId");
|
||||||
|
|
||||||
b.Property<string>("CurrencyCode")
|
b.Property<Guid?>("CurrencyId")
|
||||||
.HasMaxLength(8)
|
.HasColumnType("uniqueidentifier");
|
||||||
.HasColumnType("nvarchar(8)");
|
|
||||||
|
|
||||||
b.Property<Guid?>("DeleterId")
|
b.Property<Guid?>("DeleterId")
|
||||||
.HasColumnType("uniqueidentifier")
|
.HasColumnType("uniqueidentifier")
|
||||||
|
|
@ -3647,8 +3642,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.HasIndex("BankAccountId");
|
b.HasIndex("BankAccountId");
|
||||||
|
|
||||||
b.HasIndex("CurrencyId");
|
|
||||||
|
|
||||||
b.HasIndex("DepartmentId");
|
b.HasIndex("DepartmentId");
|
||||||
|
|
||||||
b.HasIndex("EmploymentTypeId");
|
b.HasIndex("EmploymentTypeId");
|
||||||
|
|
@ -4099,8 +4092,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.HasIndex("ApproverId");
|
b.HasIndex("ApproverId");
|
||||||
|
|
||||||
b.HasIndex("CurrencyId");
|
|
||||||
|
|
||||||
b.HasIndex("EmployeeId");
|
b.HasIndex("EmployeeId");
|
||||||
|
|
||||||
b.ToTable("T_Hr_Expense", (string)null);
|
b.ToTable("T_Hr_Expense", (string)null);
|
||||||
|
|
@ -4398,8 +4389,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CurrencyId");
|
|
||||||
|
|
||||||
b.HasIndex("DepartmentId");
|
b.HasIndex("DepartmentId");
|
||||||
|
|
||||||
b.ToTable("T_Hr_JobPosition", (string)null);
|
b.ToTable("T_Hr_JobPosition", (string)null);
|
||||||
|
|
@ -11626,14 +11615,7 @@ namespace Kurs.Platform.Migrations
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Currency", "Currency")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrencyId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
|
|
||||||
b.Navigation("Bank");
|
b.Navigation("Bank");
|
||||||
|
|
||||||
b.Navigation("Currency");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Kurs.Platform.Entities.BlogPost", b =>
|
modelBuilder.Entity("Kurs.Platform.Entities.BlogPost", b =>
|
||||||
|
|
@ -11730,10 +11712,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
modelBuilder.Entity("Kurs.Platform.Entities.CostCenter", b =>
|
modelBuilder.Entity("Kurs.Platform.Entities.CostCenter", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Kurs.Platform.Entities.Currency", "Currency")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrencyId");
|
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("DepartmentId");
|
.HasForeignKey("DepartmentId");
|
||||||
|
|
@ -11746,8 +11724,6 @@ namespace Kurs.Platform.Migrations
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ResponsibleEmployeeId");
|
.HasForeignKey("ResponsibleEmployeeId");
|
||||||
|
|
||||||
b.Navigation("Currency");
|
|
||||||
|
|
||||||
b.Navigation("Department");
|
b.Navigation("Department");
|
||||||
|
|
||||||
b.Navigation("ParentCostCenter");
|
b.Navigation("ParentCostCenter");
|
||||||
|
|
@ -11817,10 +11793,6 @@ namespace Kurs.Platform.Migrations
|
||||||
.HasForeignKey("BankAccountId")
|
.HasForeignKey("BankAccountId")
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Currency", "Currency")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrencyId");
|
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("DepartmentId");
|
.HasForeignKey("DepartmentId");
|
||||||
|
|
@ -11841,8 +11813,6 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.Navigation("BankAccount");
|
b.Navigation("BankAccount");
|
||||||
|
|
||||||
b.Navigation("Currency");
|
|
||||||
|
|
||||||
b.Navigation("Department");
|
b.Navigation("Department");
|
||||||
|
|
||||||
b.Navigation("EmploymentType");
|
b.Navigation("EmploymentType");
|
||||||
|
|
@ -11907,10 +11877,6 @@ namespace Kurs.Platform.Migrations
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ApproverId");
|
.HasForeignKey("ApproverId");
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Currency", "Currency")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrencyId");
|
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Employee", "Employee")
|
b.HasOne("Kurs.Platform.Entities.Employee", "Employee")
|
||||||
.WithMany("ExpenseRequests")
|
.WithMany("ExpenseRequests")
|
||||||
.HasForeignKey("EmployeeId")
|
.HasForeignKey("EmployeeId")
|
||||||
|
|
@ -11919,23 +11885,15 @@ namespace Kurs.Platform.Migrations
|
||||||
|
|
||||||
b.Navigation("Approver");
|
b.Navigation("Approver");
|
||||||
|
|
||||||
b.Navigation("Currency");
|
|
||||||
|
|
||||||
b.Navigation("Employee");
|
b.Navigation("Employee");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Kurs.Platform.Entities.JobPosition", b =>
|
modelBuilder.Entity("Kurs.Platform.Entities.JobPosition", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Kurs.Platform.Entities.Currency", "Currency")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CurrencyId");
|
|
||||||
|
|
||||||
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
b.HasOne("Kurs.Platform.Entities.Department", "Department")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("DepartmentId");
|
.HasForeignKey("DepartmentId");
|
||||||
|
|
||||||
b.Navigation("Currency");
|
|
||||||
|
|
||||||
b.Navigation("Department");
|
b.Navigation("Department");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Kurs.Platform.EntityFrameworkCore;
|
||||||
|
using Kurs.Platform.Enums;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Volo.Abp.Data;
|
||||||
|
using Volo.Abp.DependencyInjection;
|
||||||
|
using Volo.Abp.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Kurs.Platform.Data.Seeds;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Database view seeder for creating or updating database views
|
||||||
|
/// </summary>
|
||||||
|
public class DatabaseViewSeeder : IDataSeedContributor, ITransientDependency
|
||||||
|
{
|
||||||
|
private readonly IDbContextProvider<PlatformDbContext> _dbContextProvider;
|
||||||
|
private readonly ILogger<DatabaseViewSeeder> _logger;
|
||||||
|
|
||||||
|
public DatabaseViewSeeder(
|
||||||
|
IDbContextProvider<PlatformDbContext> dbContextProvider,
|
||||||
|
ILogger<DatabaseViewSeeder> logger)
|
||||||
|
{
|
||||||
|
_dbContextProvider = dbContextProvider;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task SeedAsync(DataSeedContext context)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dbContext = await _dbContextProvider.GetDbContextAsync();
|
||||||
|
|
||||||
|
_logger.LogInformation("Starting database view seeding...");
|
||||||
|
|
||||||
|
await CreateOrUpdateMaterialGroupView(dbContext, nameof(TableNameEnum.MaterialGroup));
|
||||||
|
|
||||||
|
_logger.LogInformation("Database view seeding completed successfully.");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Error occurred while seeding database views.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates or updates the V_T_Scp_MaterialGroup view
|
||||||
|
/// </summary>
|
||||||
|
private async Task CreateOrUpdateMaterialGroupView(PlatformDbContext dbContext, string tableName)
|
||||||
|
{
|
||||||
|
string fullTableName = TableNameResolver.GetFullTableName(tableName);
|
||||||
|
string fullViewName = TableNameResolver.GetFullViewName(tableName);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var createViewSql = $@"
|
||||||
|
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[{fullViewName}]'))
|
||||||
|
DROP VIEW [dbo].[{fullViewName}];
|
||||||
|
|
||||||
|
EXEC('
|
||||||
|
CREATE VIEW [dbo].[{fullViewName}]
|
||||||
|
AS
|
||||||
|
SELECT TOP 100 PERCENT
|
||||||
|
lvl5.TenantId,
|
||||||
|
lvl5.Id,
|
||||||
|
lvl5.ParentGroupId,
|
||||||
|
lvl5.Code,
|
||||||
|
lvl5.Name,
|
||||||
|
lvl5.Description,
|
||||||
|
lvl5.IsActive,
|
||||||
|
lvl5.CreatorId,
|
||||||
|
lvl5.CreationTime,
|
||||||
|
lvl5.LastModificationTime,
|
||||||
|
lvl5.IsDeleted,
|
||||||
|
COALESCE(lvl1.Name, '''')
|
||||||
|
+ CASE WHEN lvl1.Name IS NOT NULL THEN N'' -> '' ELSE N'''' END
|
||||||
|
+ COALESCE(lvl2.Name, '''')
|
||||||
|
+ CASE WHEN lvl2.Name IS NOT NULL THEN N'' -> '' ELSE N'''' END
|
||||||
|
+ COALESCE(lvl3.Name, '''')
|
||||||
|
+ CASE WHEN lvl3.Name IS NOT NULL THEN N'' -> '' ELSE N'''' END
|
||||||
|
+ COALESCE(lvl4.Name, '''')
|
||||||
|
+ CASE WHEN lvl4.Name IS NOT NULL THEN N'' -> '' ELSE N'''' END
|
||||||
|
+ lvl5.Name AS HierarchyPath
|
||||||
|
FROM T_Scp_MaterialGroup lvl5
|
||||||
|
LEFT JOIN {fullTableName} lvl4 ON lvl5.ParentGroupId = lvl4.Id
|
||||||
|
LEFT JOIN {fullTableName} lvl3 ON lvl4.ParentGroupId = lvl3.Id
|
||||||
|
LEFT JOIN {fullTableName} lvl2 ON lvl3.ParentGroupId = lvl2.Id
|
||||||
|
LEFT JOIN {fullTableName} lvl1 ON lvl2.ParentGroupId = lvl1.Id
|
||||||
|
ORDER BY HierarchyPath
|
||||||
|
')
|
||||||
|
";
|
||||||
|
|
||||||
|
await dbContext.Database.ExecuteSqlRawAsync(createViewSql);
|
||||||
|
|
||||||
|
_logger.LogInformation($"Created/Updated {fullViewName} view successfully.");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"Error occurred while creating {fullViewName} view.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue