feat: add workshop details handling to InstitutionContract and InstitutionContractApplication

This commit is contained in:
MahanCh
2025-08-19 14:52:52 +03:30
parent 82f68d1bbe
commit f0daa0b283
2 changed files with 13 additions and 3 deletions

View File

@@ -163,18 +163,22 @@ public class InstitutionContract : EntityBase
{
Status = InstitutionContractStatus.Completed;
}
public void SetWorkshopDetails(List<InstitutionContractWorkshopDetail> commandWorkshops)
{
WorkshopDetails = commandWorkshops;
}
}
public class InstitutionContractWorkshopDetail:EntityBase
{
public InstitutionContractWorkshopDetail( string workshopName, bool hasRollCallPlan,
bool hasCustomizeCheckoutPlan, bool hasContractPlan,int personnelCount,long institutionContractId)
bool hasCustomizeCheckoutPlan, bool hasContractPlan,int personnelCount)
{
WorkshopName = workshopName;
HasRollCallPlan = hasRollCallPlan;
HasCustomizeCheckoutPlan = hasCustomizeCheckoutPlan;
HasContractPlan = hasContractPlan;
InstitutionContractId = institutionContractId;
PersonnelCount = personnelCount;
}
@@ -210,7 +214,7 @@ public class InstitutionContractWorkshopDetail:EntityBase
/// </summary>
public long InstitutionContractId { get; private set; }
public InstitutionContractWorkshopDetail()
private InstitutionContractWorkshopDetail()
{
}

View File

@@ -967,6 +967,12 @@ public class InstitutionContractApplication : IInstitutionContractApplication
command.Workshops.Sum(x => x.PersonnelCount).ToString(), command.Description,
"Official", "JobRelation",hasValueAddedTax
, command.TaxAmount);
var workshopDetails = command.Workshops.Select(x =>
new InstitutionContractWorkshopDetail(x.WorkshopName, x.HasRollCallPlan, x.HasCustomizeCheckoutPlan,
x.HasContractPlan, x.PersonnelCount)).ToList();
entity.SetWorkshopDetails(workshopDetails);
await _institutionContractRepository.CreateAsync(entity);
await _institutionContractRepository.SaveChangesAsync();
await transaction.CommitAsync();