77 lines
3.4 KiB
C#
77 lines
3.4 KiB
C#
using System;
|
|
using _0_Framework.Application;
|
|
using Company.Domain.CheckoutAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace CompanyManagment.EFCore.Mapping;
|
|
|
|
class CheckoutMapping : IEntityTypeConfiguration<Checkout>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Checkout> builder)
|
|
{
|
|
|
|
builder.ToTable("Checkouts");
|
|
builder.HasKey(x => x.id);
|
|
|
|
builder.Property(x => x.EmployeeFullName).HasMaxLength(50);
|
|
builder.Property(x => x.ContractNo).HasMaxLength(50);
|
|
builder.Property(x => x.FathersName).HasMaxLength(20);
|
|
builder.Property(x => x.NationalCode).HasMaxLength(10);
|
|
builder.Property(x => x.DateOfBirth).HasMaxLength(10);
|
|
builder.Property(x => x.WorkshopName).HasMaxLength(70);
|
|
builder.Property(x => x.Month).HasMaxLength(10);
|
|
builder.Property(x => x.Year).HasMaxLength(4);
|
|
builder.Property(x => x.SumOfWorkingDays).HasMaxLength(6);
|
|
builder.Property(x => x.ArchiveCode).HasMaxLength(15);
|
|
builder.Property(x => x.PersonnelCode).HasMaxLength(10);
|
|
builder.Property(x => x.TotalClaims).HasMaxLength(25);
|
|
builder.Property(x => x.TotalDeductions).HasMaxLength(25);
|
|
builder.Property(x => x.IsActiveString).HasMaxLength(10);
|
|
builder.Property(x => x.Signature).HasMaxLength(20);
|
|
builder.Property(x => x.MarriedAllowance);
|
|
builder.Property(x => x.FamilyAllowance);
|
|
builder.Property(x => x.HousingAllowance);
|
|
builder.Property(x => x.ConsumableItems);
|
|
builder.Property(x => x.RewardPay).HasColumnType("float").IsRequired(false);
|
|
|
|
builder.Property(x => x.LeaveCheckout);
|
|
builder.Property(x => x.CreditLeaves);
|
|
builder.Property(x => x.AbsencePeriod);
|
|
builder.Property(x => x.AverageHoursPerDay);
|
|
builder.Property(x => x.HasRollCall);
|
|
|
|
builder.Property(x => x.OverTimeWorkValue).HasMaxLength(10);
|
|
builder.Property(x => x.OverNightWorkValue).HasMaxLength(10);
|
|
builder.Property(x => x.FridayWorkValue).HasMaxLength(10);
|
|
builder.Property(x => x.RotatingShiftValue).HasMaxLength(10);
|
|
builder.Property(x => x.AbsenceValue).HasMaxLength(10);
|
|
builder.Property(x => x.TotalDayOfLeaveCompute).HasMaxLength(10);
|
|
builder.Property(x => x.TotalDayOfYearsCompute).HasMaxLength(10);
|
|
builder.Property(x => x.TotalDayOfBunosesCompute).HasMaxLength(10);
|
|
|
|
builder.HasOne(x => x.Workshop)
|
|
.WithMany(x => x.Checkouts)
|
|
.HasForeignKey(x => x.WorkshopId);
|
|
|
|
builder.OwnsMany(x => x.LoanInstallments, installments =>
|
|
{
|
|
installments.Property(x => x.AmountForMonth).HasMaxLength(25);
|
|
installments.Property(x => x.IsActive).HasConversion(
|
|
v => v.ToString(),
|
|
v => (IsActive)Enum.Parse(typeof(IsActive), v)).HasMaxLength(5);
|
|
installments.Property(x => x.Year).HasMaxLength(4);
|
|
installments.Property(x => x.Month).HasMaxLength(2);
|
|
installments.Property(x => x.LoanRemaining).HasMaxLength(25);
|
|
installments.Property(x => x.LoanAmount).HasMaxLength(30);
|
|
|
|
});
|
|
|
|
builder.OwnsMany(x => x.SalaryAids, salaryAid =>
|
|
{
|
|
salaryAid.Property(x => x.SalaryAidDateTimeFa).HasMaxLength(15);
|
|
salaryAid.Property(x => x.Amount).HasMaxLength(25);
|
|
salaryAid.Property(x => x.CalculationDateTimeFa).HasMaxLength(15);
|
|
});
|
|
}
|
|
} |