diff --git a/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs b/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs index d4b70e4b..4cf49b73 100644 --- a/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs +++ b/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs @@ -77,4 +77,5 @@ public interface IInstitutionContractRepository : IRepository> GetInstitutionContractSelectList(string search, string selected); Task> PrintAllAsync(List ids); Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request); + Task GetAmendmentVerificationDetails(Guid id, long amendmentId); } \ No newline at end of file diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopBase.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopBase.cs index 046cfe21..bfdceb00 100644 --- a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopBase.cs +++ b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopBase.cs @@ -9,7 +9,7 @@ public class InstitutionContractWorkshopBase:EntityBase protected InstitutionContractWorkshopBase(){} public InstitutionContractWorkshopBase(string workshopName, bool hasRollCallPlan,bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,bool hasContractPlanInPerson,bool hasInsurancePlan,bool hasInsurancePlanInPerson, - int personnelCount, double price ) + int personnelCount, double price,bool isAmendment ) { WorkshopName = workshopName; Services = new WorkshopServices(hasInsurancePlan, hasInsurancePlanInPerson, @@ -17,7 +17,10 @@ public class InstitutionContractWorkshopBase:EntityBase PersonnelCount = personnelCount; Price = price; Employers = []; + IsAmendment = isAmendment; } + + /// /// شناسه کارگاه /// @@ -42,7 +45,11 @@ public class InstitutionContractWorkshopBase:EntityBase public double Price { get; private set; } - + + /// + /// جهت نمایش دادن اینکه آیا این کارگاه مربوط به ارتقا قرارداد است یا خیر + /// + public bool IsAmendment { get; set; } public List Employers { get; private set; } = new(); diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs index f133fa70..b030af3f 100644 --- a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs +++ b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopCurrent.cs @@ -10,9 +10,10 @@ public class InstitutionContractWorkshopCurrent:InstitutionContractWorkshopBase public InstitutionContractWorkshopCurrent(string workshopName, bool hasRollCallPlan, bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson, - int personnelCount, double price,long institutionContractWorkshopGroupId,InstitutionContractWorkshopGroup workshopGroup,long workshopId) : base(workshopName, hasRollCallPlan, + int personnelCount, double price,long institutionContractWorkshopGroupId, + InstitutionContractWorkshopGroup workshopGroup,long workshopId,bool isAmendment) : base(workshopName, hasRollCallPlan, hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, - hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price) + hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment) { InstitutionContractWorkshopGroupId = institutionContractWorkshopGroupId; WorkshopGroup = workshopGroup; diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopGroup.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopGroup.cs index 20797f04..d69130e6 100644 --- a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopGroup.cs +++ b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopGroup.cs @@ -31,6 +31,13 @@ public class InstitutionContractWorkshopGroup : EntityBase InitialWorkshops = initialWorkshops.ToList(); LastModifiedDate = DateTime.Now; } + + public void AddAmendmentWorkshops(List amendmentDetails) + { + InitialWorkshops.AddRange(amendmentDetails); + LastModifiedDate = DateTime.Now; + } + public void UpdateCurrentWorkshops(List updatedDetails) { diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs index cceaeefb..f4953d6c 100644 --- a/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs +++ b/Company.Domain/InstitutionContractAgg/InstitutionContractWorkshopInitial.cs @@ -11,9 +11,9 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase public InstitutionContractWorkshopInitial(string workshopName, bool hasRollCallPlan, bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson, - int personnelCount, double price) : base(workshopName, hasRollCallPlan, + int personnelCount, double price,bool isAmendment =false) : base(workshopName, hasRollCallPlan, hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson, - hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price) + hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment) { WorkshopCreated = false; } @@ -31,7 +31,8 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase WorkshopCreated = true; WorkshopCurrent = new InstitutionContractWorkshopCurrent(WorkshopName,Services.RollCall,Services.RollCallInPerson, Services.CustomizeCheckout,Services.Contract,Services.ContractInPerson,Services.Insurance, - Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId); + Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId, + IsAmendment); WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList()); } diff --git a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs index 3aa9a8f5..91a76ddc 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs @@ -251,6 +251,16 @@ public interface IInstitutionContractApplication /// /// Task PrintOneAsync(long id); + + Task GetAmendmentVerificationDetails(Guid id, long amendmentId); +} + +public class GetInstitutionAmendmentVerificationDetailsViewModel +{ + public InstitutionContratVerificationParty FirstParty { get; set; } + public InstitutionContratVerificationParty SecondParty { get; set; } + public string ContractNo { get; set; } + } public class InstitutionContractAmendmentCompleteRequest diff --git a/CompanyManagment.Application/InstitutionContractApplication.cs b/CompanyManagment.Application/InstitutionContractApplication.cs index c01e95c2..5e1aea70 100644 --- a/CompanyManagment.Application/InstitutionContractApplication.cs +++ b/CompanyManagment.Application/InstitutionContractApplication.cs @@ -1387,6 +1387,11 @@ public class InstitutionContractApplication : IInstitutionContractApplication return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault(); } + public Task GetAmendmentVerificationDetails(Guid id, long amendmentId) + { + return _institutionContractRepository.GetAmendmentVerificationDetails(id,amendmentId); + } + public async Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request) { await _institutionContractRepository.AmendmentComplete(request); diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index 753e7674..915b728a 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -2804,7 +2804,7 @@ public class InstitutionContractRepository : RepositoryBasex.CurrentWorkshopId ==0).ToList(); - + var newWorkshopTempIds = newWorkshops.Select(x=>x.Id).ToList(); var changes = newWorkshops.Select(x=> @@ -2886,6 +2886,29 @@ public class InstitutionContractRepository : RepositoryBase GetAmendmentVerificationDetails(Guid id, long amendmentId) + { + var institutionContract = await _context.InstitutionContractSet + .Include(x => x.Amendments) + .FirstOrDefaultAsync(x => x.PublicId == id); + + if (institutionContract == null) + throw new NotFoundException("قرارداد مؤسسه یافت نشد"); + + var amendment = institutionContract.Amendments + .FirstOrDefault(x => x.id == amendmentId); + if (amendment == null) + throw new NotFoundException("ارتقا یافت نشد"); + + if (amendment.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify) + throw new BadRequestException("این ارتقا قبلا تایید شده است"); + + + + + } diff --git a/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs b/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs index c383efec..7483aa57 100644 --- a/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs +++ b/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs @@ -556,9 +556,9 @@ public class institutionContractController : AdminBaseController return res; } - [HttpPost("amendment/complete/")] + [HttpPost("amendment/complete")] public async Task AmendmentComplete( - InstitutionContractAmendmentCompleteRequest request) + [FromBody] InstitutionContractAmendmentCompleteRequest request) { await _institutionContractApplication.AmendmentComplete(request); @@ -571,11 +571,11 @@ public class institutionContractController : AdminBaseController /// /// /// - [HttpGet("/api/institutionContract/amendment-Verification/{id:guid}")] + [HttpGet("/api/institutionContract/amendment-Verification/{id:guid}/{amendmentId:long}")] [AllowAnonymous] - public async Task> GetAmendmentVerificationDetails(Guid id) + public async Task> GetAmendmentVerificationDetails(Guid id,long amendmentId) { - return await _institutionContractApplication.GetAmendmentVerificationDetails(id); + return await _institutionContractApplication.GetAmendmentVerificationDetails(id,amendmentId); } [HttpPost("/api/institutionContract/Verify-amendment")]