feat: add previous ID handling and price difference validation to institution contract amendment workshops
This commit is contained in:
@@ -17,7 +17,7 @@ public class InstitutionContractAmendmentTemp
|
||||
NewWorkshops = prevWorkshops.Select(x=> new InstitutionContractAmendmentTempNewWorkshop(
|
||||
x.WorkshopName, x.CountPerson, x.ContractAndCheckout, x.ContractAndCheckoutInPerson, x.Insurance,
|
||||
x.InsuranceInPerson, x.RollCall, x.RollCallInPerson, x.CustomizeCheckout, x.Price, x.WorkshopId,
|
||||
x.CurrentWorkshopId, 0)).ToList();
|
||||
x.CurrentWorkshopId, 0,x.Id)).ToList();
|
||||
InstitutionContractId = institutionContractId;
|
||||
}
|
||||
|
||||
@@ -47,10 +47,11 @@ public class InstitutionContractAmendmentTempNewWorkshop : InstitutionContractAm
|
||||
{
|
||||
public InstitutionContractAmendmentTempNewWorkshop(string workshopName, int countPerson, bool contractAndCheckout,
|
||||
bool contractAndCheckoutInPerson, bool insurance, bool insuranceInPerson, bool rollCall, bool rollCallInPerson,
|
||||
bool customizeCheckout, double price, long workshopId, long currentWorkshopId,double priceDifference) : base(
|
||||
bool customizeCheckout, double price, long workshopId, long currentWorkshopId,double priceDifference,Guid prevId) : base(
|
||||
workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance, insuranceInPerson,
|
||||
rollCall, rollCallInPerson, customizeCheckout, price, workshopId, currentWorkshopId)
|
||||
{
|
||||
Id = prevId;
|
||||
PriceDifference = priceDifference;
|
||||
}
|
||||
|
||||
|
||||
@@ -2562,7 +2562,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
request.Insurance, request.InsuranceInPerson,
|
||||
request.RollCall, request.RollCallInPerson,
|
||||
request.CustomizeCheckout, price,
|
||||
request.WorkshopId,0,price);
|
||||
request.WorkshopId,0,price,Guid.NewGuid());
|
||||
|
||||
workshopTemp = newWorkshopTemp;
|
||||
|
||||
@@ -2577,6 +2577,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
amendmentTemp.NewWorkshops.Remove(workshopTemp);
|
||||
|
||||
var differencePrice = price - workshopTemp.Price;
|
||||
if (differencePrice<0)
|
||||
{
|
||||
differencePrice = 0;
|
||||
}
|
||||
workshopTemp.Edit(request.WorkshopName, request.CountPerson,
|
||||
request.ContractAndCheckout, request.ContractAndCheckoutInPerson,
|
||||
request.Insurance, request.InsuranceInPerson,
|
||||
|
||||
Reference in New Issue
Block a user