feat: add workshop details handling to InstitutionContract and InstitutionContractApplication
This commit is contained in:
@@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user