seed/data Seeder Uoms

This commit is contained in:
Sedat ÖZTÜRK 2026-09-04 14:41:51 +03:00
parent 43e3aeebd0
commit 63653dd974
5 changed files with 300 additions and 304 deletions

View file

@ -2497,6 +2497,10 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
Description = $"{listFormName}.Description",
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.UomCategory)),
SeedFilePath = SeedPathResolver.GetDataFilePath(listFormName),
SeedSyncInsert = false,
SeedSyncUpdate = false,
SeedSyncDelete = false,
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.String,
DefaultFilter = DefaultFilterJson,
@ -2602,6 +2606,10 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
Description = $"{listFormName}.Description",
SelectCommandType = SelectCommandTypeEnum.Table,
SelectCommand = TableNameResolver.GetFullTableName(nameof(TableNameEnum.Uom)),
SeedFilePath = SeedPathResolver.GetDataFilePath(listFormName),
SeedSyncInsert = false,
SeedSyncUpdate = false,
SeedSyncDelete = false,
KeyFieldName = "Id",
KeyFieldDbSourceType = DbType.String,
DefaultFilter = DefaultFilterJson,

View file

@ -391,252 +391,6 @@
}
}
],
"UomCategories": [
{
"Name": "Adet"
},
{
"Name": "Ağırlık"
},
{
"Name": "Çalışma Süresi"
},
{
"Name": "Uzunluk / Mesafe"
},
{
"Name": "Yüzey"
},
{
"Name": "Hacim"
}
],
"Uoms": [
{
"Name": "Adet",
"Type": "Reference",
"Ratio": 1.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Adet"
},
{
"Name": "Deste",
"Type": "SmallerThanReference",
"Ratio": 10.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Adet"
},
{
"Name": "Düzine",
"Type": "BiggerThanReference",
"Ratio": 12.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Adet"
},
{
"Name": "g",
"Type": "SmallerThanReference",
"Ratio": 1000.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Ağırlık"
},
{
"Name": "ons",
"Type": "SmallerThanReference",
"Ratio": 35.274,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Ağırlık"
},
{
"Name": "pound",
"Type": "SmallerThanReference",
"Ratio": 2.20462,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Ağırlık"
},
{
"Name": "kg",
"Type": "Reference",
"Ratio": 1.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Ağırlık"
},
{
"Name": "t",
"Type": "BiggerThanReference",
"Ratio": 1000.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Ağırlık"
},
{
"Name": "Saat",
"Type": "SmallerThanReference",
"Ratio": 8.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Çalışma Süresi"
},
{
"Name": "Gün",
"Type": "Reference",
"Ratio": 1.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Çalışma Süresi"
},
{
"Name": "mm",
"Type": "SmallerThanReference",
"Ratio": 1000.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Uzunluk / Mesafe"
},
{
"Name": "cm",
"Type": "SmallerThanReference",
"Ratio": 100.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Uzunluk / Mesafe"
},
{
"Name": "inç",
"Type": "SmallerThanReference",
"Ratio": 39.3701,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Uzunluk / Mesafe"
},
{
"Name": "ayak",
"Type": "SmallerThanReference",
"Ratio": 3.28084,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Uzunluk / Mesafe"
},
{
"Name": "yd",
"Type": "SmallerThanReference",
"Ratio": 1.09361,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Uzunluk / Mesafe"
},
{
"Name": "m",
"Type": "Reference",
"Ratio": 1.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Uzunluk / Mesafe"
},
{
"Name": "MT",
"Type": "SmallerThanReference",
"Ratio": 1.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Uzunluk / Mesafe"
},
{
"Name": "km",
"Type": "BiggerThanReference",
"Ratio": 1000.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Uzunluk / Mesafe"
},
{
"Name": "mil",
"Type": "BiggerThanReference",
"Ratio": 1609.34,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Uzunluk / Mesafe"
},
{
"Name": "ft²",
"Type": "SmallerThanReference",
"Ratio": 10.76391,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Yüzey"
},
{
"Name": "m²",
"Type": "Reference",
"Ratio": 1.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Yüzey"
},
{
"Name": "inç³",
"Type": "SmallerThanReference",
"Ratio": 61.0237,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Hacim"
},
{
"Name": "sıvı ons (Amerikan)",
"Type": "SmallerThanReference",
"Ratio": 33.814,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Hacim"
},
{
"Name": "çeyrek(Amerikan)",
"Type": "SmallerThanReference",
"Ratio": 1.05669,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Hacim"
},
{
"Name": "L",
"Type": "Reference",
"Ratio": 1.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Hacim"
},
{
"Name": "galon (Amerikan)",
"Type": "BiggerThanReference",
"Ratio": 3.78541,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Hacim"
},
{
"Name": "ayak³",
"Type": "BiggerThanReference",
"Ratio": 28.3168,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Hacim"
},
{
"Name": "m³",
"Type": "BiggerThanReference",
"Ratio": 1000.0,
"IsActive": true,
"Rounding": 0.01,
"UomCategoryName": "Hacim"
}
],
"ReportCategories": [
{
"name": "Raporlar",

View file

@ -25,8 +25,6 @@ public class TenantSeederDto
//Definitions
public List<WorkHourSeedDto> WorkHours { get; set; }
public List<UomCategorySeedDto> UomCategories { get; set; }
public List<UomSeedDto> Uoms { get; set; }
public List<DepartmentSeedDto> Departments { get; set; }
public List<JobPositionSeedDto> JobPositions { get; set; }
@ -216,23 +214,6 @@ public class DepartmentSeedDto
public string ParentName { get; set; }
}
public class UomCategorySeedDto
{
public Guid Id { get; set; }
public string Name { get; set; }
}
public class UomSeedDto
{
public string Name { get; set; }
public string Type { get; set; }
public decimal Ratio { get; set; }
public bool IsActive { get; set; }
public decimal Rounding { get; set; }
public string UomCategoryName { get; set; }
}
public class ForumCategorySeedDto
{
public string Name { get; set; }
@ -362,8 +343,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
private readonly IRepository<About, Guid> _aboutRepository;
private readonly IRepository<Service, Guid> _servicesRepository;
private readonly IRepository<Contact, Guid> _contactRepository;
private readonly IRepository<UomCategory, string> _uomCategoryRepository;
private readonly IRepository<Uom, string> _uomRepository;
private readonly IRepository<ForumCategory, Guid> _forumCategoryRepository;
private readonly IRepository<WorkHour, Guid> _workHourRepository;
private readonly IIdentityUserRepository _repositoryUser;
@ -389,8 +368,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
ILookupNormalizer lookupNormalizer,
IIdentityUserRepository repositoryUser,
IRepository<Branch, Guid> branchRepository,
IRepository<UomCategory, string> uomCategoryRepository,
IRepository<Uom, string> uomRepository,
IRepository<ReportCategory, Guid> reportCategoriesRepository,
IRepository<ReportTemplate, Guid> reportTemplatesRepository,
IRepository<Home, Guid> homeRepository,
@ -420,8 +397,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
_lookupNormalizer = lookupNormalizer;
_repositoryUser = repositoryUser;
_branchRepository = branchRepository;
_uomCategoryRepository = uomCategoryRepository;
_uomRepository = uomRepository;
_reportCategoriesRepository = reportCategoriesRepository;
_reportTemplatesRepository = reportTemplatesRepository;
_homeRepository = homeRepository;
@ -461,39 +436,6 @@ public class TenantDataSeeder : IDataSeedContributor, ITransientDependency
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
foreach (var item in items.UomCategories)
{
var exists = await _uomCategoryRepository.AnyAsync(x => x.Name == item.Name);
if (!exists)
{
await _uomCategoryRepository.InsertAsync(new UomCategory(item.Name) { Name = item.Name }, autoSave: true);
}
}
foreach (var item in items.Uoms)
{
var exists = await _uomRepository.AnyAsync(x => x.Name == item.Name);
if (!exists)
{
var category = await _uomCategoryRepository.FirstOrDefaultAsync(x => x.Name == item.UomCategoryName);
if (category != null)
{
await _uomRepository.InsertAsync(new Uom(item.Name)
{
Name = item.Name,
Type = item.Type,
Ratio = item.Ratio,
IsActive = item.IsActive,
Rounding = item.Rounding,
UomCategoryId = category.Id
});
}
}
}
foreach (var item in items.ForumCategories)
{
var exists = await _forumCategoryRepository.AnyAsync(x => x.Name == item.Name);

View file

@ -0,0 +1,260 @@
{
"ListFormCode": "App.Definitions.Uom",
"KeyFieldName": "Id",
"GeneratedAt": "2026-09-04T00:00:00Z",
"Order": 20,
"Rows": [
{
"Id": "Adet",
"Name": "Adet",
"Type": "Reference",
"Ratio": 1.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Adet"
},
{
"Id": "Deste",
"Name": "Deste",
"Type": "SmallerThanReference",
"Ratio": 10.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Adet"
},
{
"Id": "Düzine",
"Name": "Düzine",
"Type": "BiggerThanReference",
"Ratio": 12.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Adet"
},
{
"Id": "g",
"Name": "g",
"Type": "SmallerThanReference",
"Ratio": 1000.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Ağırlık"
},
{
"Id": "ons",
"Name": "ons",
"Type": "SmallerThanReference",
"Ratio": 35.274,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Ağırlık"
},
{
"Id": "pound",
"Name": "pound",
"Type": "SmallerThanReference",
"Ratio": 2.20462,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Ağırlık"
},
{
"Id": "kg",
"Name": "kg",
"Type": "Reference",
"Ratio": 1.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Ağırlık"
},
{
"Id": "t",
"Name": "t",
"Type": "BiggerThanReference",
"Ratio": 1000.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Ağırlık"
},
{
"Id": "Saat",
"Name": "Saat",
"Type": "SmallerThanReference",
"Ratio": 8.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Çalışma Süresi"
},
{
"Id": "Gün",
"Name": "Gün",
"Type": "Reference",
"Ratio": 1.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Çalışma Süresi"
},
{
"Id": "mm",
"Name": "mm",
"Type": "SmallerThanReference",
"Ratio": 1000.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Uzunluk / Mesafe"
},
{
"Id": "cm",
"Name": "cm",
"Type": "SmallerThanReference",
"Ratio": 100.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Uzunluk / Mesafe"
},
{
"Id": "inç",
"Name": "inç",
"Type": "SmallerThanReference",
"Ratio": 39.3701,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Uzunluk / Mesafe"
},
{
"Id": "ayak",
"Name": "ayak",
"Type": "SmallerThanReference",
"Ratio": 3.28084,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Uzunluk / Mesafe"
},
{
"Id": "yd",
"Name": "yd",
"Type": "SmallerThanReference",
"Ratio": 1.09361,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Uzunluk / Mesafe"
},
{
"Id": "m",
"Name": "m",
"Type": "Reference",
"Ratio": 1.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Uzunluk / Mesafe"
},
{
"Id": "MT",
"Name": "MT",
"Type": "SmallerThanReference",
"Ratio": 1.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Uzunluk / Mesafe"
},
{
"Id": "km",
"Name": "km",
"Type": "BiggerThanReference",
"Ratio": 1000.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Uzunluk / Mesafe"
},
{
"Id": "mil",
"Name": "mil",
"Type": "BiggerThanReference",
"Ratio": 1609.34,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Uzunluk / Mesafe"
},
{
"Id": "ft²",
"Name": "ft²",
"Type": "SmallerThanReference",
"Ratio": 10.76391,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Yüzey"
},
{
"Id": "m²",
"Name": "m²",
"Type": "Reference",
"Ratio": 1.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Yüzey"
},
{
"Id": "inç³",
"Name": "inç³",
"Type": "SmallerThanReference",
"Ratio": 61.0237,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Hacim"
},
{
"Id": "sıvı ons (Amerikan)",
"Name": "sıvı ons (Amerikan)",
"Type": "SmallerThanReference",
"Ratio": 33.814,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Hacim"
},
{
"Id": "çeyrek(Amerikan)",
"Name": "çeyrek(Amerikan)",
"Type": "SmallerThanReference",
"Ratio": 1.05669,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Hacim"
},
{
"Id": "L",
"Name": "L",
"Type": "Reference",
"Ratio": 1.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Hacim"
},
{
"Id": "galon (Amerikan)",
"Name": "galon (Amerikan)",
"Type": "BiggerThanReference",
"Ratio": 3.78541,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Hacim"
},
{
"Id": "ayak³",
"Name": "ayak³",
"Type": "BiggerThanReference",
"Ratio": 28.3168,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Hacim"
},
{
"Id": "m³",
"Name": "m³",
"Type": "BiggerThanReference",
"Ratio": 1000.0,
"Rounding": 0.01,
"IsActive": true,
"UomCategoryId": "Hacim"
}
]
}

View file

@ -0,0 +1,32 @@
{
"ListFormCode": "App.Definitions.UomCategory",
"KeyFieldName": "Id",
"GeneratedAt": "2026-09-04T00:00:00Z",
"Order": 10,
"Rows": [
{
"Id": "Adet",
"Name": "Adet"
},
{
"Id": "Ağırlık",
"Name": "Ağırlık"
},
{
"Id": "Çalışma Süresi",
"Name": "Çalışma Süresi"
},
{
"Id": "Uzunluk / Mesafe",
"Name": "Uzunluk / Mesafe"
},
{
"Id": "Yüzey",
"Name": "Yüzey"
},
{
"Id": "Hacim",
"Name": "Hacim"
}
]
}