feat: add amendment verification details retrieval methods and update related classes
This commit is contained in:
@@ -77,4 +77,5 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
|
||||
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
|
||||
Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request);
|
||||
Task<GetInstitutionVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// شناسه کارگاه
|
||||
/// </summary>
|
||||
@@ -42,7 +45,11 @@ public class InstitutionContractWorkshopBase:EntityBase
|
||||
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// جهت نمایش دادن اینکه آیا این کارگاه مربوط به ارتقا قرارداد است یا خیر
|
||||
/// </summary>
|
||||
public bool IsAmendment { get; set; }
|
||||
|
||||
public List<InstitutionContractWorkshopDetailEmployer> Employers { get; private set; } = new();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -31,6 +31,13 @@ public class InstitutionContractWorkshopGroup : EntityBase
|
||||
InitialWorkshops = initialWorkshops.ToList();
|
||||
LastModifiedDate = DateTime.Now;
|
||||
}
|
||||
|
||||
public void AddAmendmentWorkshops(List<InstitutionContractWorkshopInitial> amendmentDetails)
|
||||
{
|
||||
InitialWorkshops.AddRange(amendmentDetails);
|
||||
LastModifiedDate = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
public void UpdateCurrentWorkshops(List<InstitutionContractWorkshopCurrent> updatedDetails)
|
||||
{
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -251,6 +251,16 @@ public interface IInstitutionContractApplication
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
|
||||
|
||||
Task<GetInstitutionAmendmentVerificationDetailsViewModel> 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
|
||||
|
||||
@@ -1387,6 +1387,11 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
|
||||
}
|
||||
|
||||
public Task<GetInstitutionVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId)
|
||||
{
|
||||
return _institutionContractRepository.GetAmendmentVerificationDetails(id,amendmentId);
|
||||
}
|
||||
|
||||
public async Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request)
|
||||
{
|
||||
await _institutionContractRepository.AmendmentComplete(request);
|
||||
|
||||
@@ -2804,7 +2804,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
}
|
||||
var newWorkshops = amendmentTemp
|
||||
.NewWorkshops.Where(x=>x.CurrentWorkshopId ==0).ToList();
|
||||
|
||||
|
||||
var newWorkshopTempIds = newWorkshops.Select(x=>x.Id).ToList();
|
||||
|
||||
var changes = newWorkshops.Select(x=>
|
||||
@@ -2886,6 +2886,29 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
public async Task<GetInstitutionVerificationDetailsViewModel> 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("این ارتقا قبلا تایید شده است");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -556,9 +556,9 @@ public class institutionContractController : AdminBaseController
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpPost("amendment/complete/")]
|
||||
[HttpPost("amendment/complete")]
|
||||
public async Task<ActionResult> AmendmentComplete(
|
||||
InstitutionContractAmendmentCompleteRequest request)
|
||||
[FromBody] InstitutionContractAmendmentCompleteRequest request)
|
||||
{
|
||||
|
||||
await _institutionContractApplication.AmendmentComplete(request);
|
||||
@@ -571,11 +571,11 @@ public class institutionContractController : AdminBaseController
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/api/institutionContract/amendment-Verification/{id:guid}")]
|
||||
[HttpGet("/api/institutionContract/amendment-Verification/{id:guid}/{amendmentId:long}")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<GetInstitutionVerificationDetailsViewModel>> GetAmendmentVerificationDetails(Guid id)
|
||||
public async Task<ActionResult<GetInstitutionVerificationDetailsViewModel>> GetAmendmentVerificationDetails(Guid id,long amendmentId)
|
||||
{
|
||||
return await _institutionContractApplication.GetAmendmentVerificationDetails(id);
|
||||
return await _institutionContractApplication.GetAmendmentVerificationDetails(id,amendmentId);
|
||||
}
|
||||
|
||||
[HttpPost("/api/institutionContract/Verify-amendment")]
|
||||
|
||||
Reference in New Issue
Block a user