feat: integrate RollCallService repository into InstitutionContractApplication and WorkshopApplication
This commit is contained in:
@@ -22,6 +22,7 @@ using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using Company.Domain.RepresentativeAgg;
|
||||
using Company.Domain.RollCallServiceAgg;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.FinancialInvoice;
|
||||
@@ -59,6 +60,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
private readonly IFinancialInvoiceRepository _financialInvoiceRepository;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
private readonly IPaymentTransactionRepository _paymentTransactionRepository;
|
||||
private readonly IRollCallServiceRepository _rollCallServiceRepository;
|
||||
|
||||
|
||||
public InstitutionContractApplication(IInstitutionContractRepository institutionContractRepository,
|
||||
@@ -70,7 +72,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
IFinancialStatmentRepository financialStatmentRepository, IContactInfoApplication contactInfoApplication,
|
||||
IAccountApplication accountApplication, ISmsService smsService, IUidService uidService,
|
||||
IFinancialInvoiceRepository financialInvoiceRepository, IHttpClientFactory httpClientFactory,
|
||||
IPaymentTransactionRepository paymentTransactionRepository)
|
||||
IPaymentTransactionRepository paymentTransactionRepository, IRollCallServiceRepository rollCallServiceRepository)
|
||||
{
|
||||
_institutionContractRepository = institutionContractRepository;
|
||||
_contractingPartyRepository = contractingPartyRepository;
|
||||
@@ -88,6 +90,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
_uidService = uidService;
|
||||
_financialInvoiceRepository = financialInvoiceRepository;
|
||||
_paymentTransactionRepository = paymentTransactionRepository;
|
||||
_rollCallServiceRepository = rollCallServiceRepository;
|
||||
_paymentGateway = new SepehrPaymentGateway(httpClientFactory);
|
||||
}
|
||||
|
||||
@@ -1555,28 +1558,48 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
.Where(x => x.WorkshopCreated && x.WorkshopId is > 0).ToList();
|
||||
|
||||
var currentWorkshops = institutionContract.WorkshopGroup.CurrentWorkshops.ToList();
|
||||
var accountId = _contractingPartyRepository
|
||||
.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId).Id;
|
||||
foreach (var createdWorkshop in initialCreatedWorkshops)
|
||||
{
|
||||
if (currentWorkshops.Any(x => x.WorkshopId == createdWorkshop.WorkshopId))
|
||||
{
|
||||
continue;
|
||||
//rollcall serviecs
|
||||
if (createdWorkshop.Services.RollCall)
|
||||
{
|
||||
var ActiveService = _rollCallServiceRepository.GetActiveServiceByWorkshopId(createdWorkshop.WorkshopId!.Value);
|
||||
var startTime = institutionContract.ContractStartGr;
|
||||
var endTime = institutionContract.ContractEndGr;
|
||||
if (ActiveService != null)
|
||||
{
|
||||
if (ActiveService.EndService> startTime)
|
||||
{
|
||||
startTime = ActiveService.EndService;
|
||||
}
|
||||
|
||||
}
|
||||
var rollCallService = new RollCallService("BasedOnIC",
|
||||
startTime, endTime, createdWorkshop.WorkshopId.Value,accountId,createdWorkshop.PersonnelCount,
|
||||
0,"12");
|
||||
await _rollCallServiceRepository.CreateAsync(rollCallService);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var currentWorkshop = new InstitutionContractWorkshopCurrent(createdWorkshop.WorkshopName,
|
||||
createdWorkshop.Services.RollCall, createdWorkshop.Services.RollCallInPerson,
|
||||
createdWorkshop.Services.CustomizeCheckout, createdWorkshop.Services.Contract,
|
||||
createdWorkshop.Services.ContractInPerson, createdWorkshop.Services.Insurance,
|
||||
createdWorkshop.Services.InsuranceInPerson,createdWorkshop.PersonnelCount, createdWorkshop.Price,
|
||||
createdWorkshop.InstitutionContractWorkshopGroupId,createdWorkshop.WorkshopGroup,
|
||||
createdWorkshop.WorkshopId!.Value, createdWorkshop.id);
|
||||
institutionContract.WorkshopGroup.AddCurrentWorkshop(currentWorkshop);
|
||||
}
|
||||
|
||||
var currentWorkshop = new InstitutionContractWorkshopCurrent(createdWorkshop.WorkshopName,
|
||||
createdWorkshop.Services.RollCall, createdWorkshop.Services.RollCallInPerson,
|
||||
createdWorkshop.Services.CustomizeCheckout, createdWorkshop.Services.Contract,
|
||||
createdWorkshop.Services.ContractInPerson, createdWorkshop.Services.Insurance,
|
||||
createdWorkshop.Services.InsuranceInPerson,createdWorkshop.PersonnelCount, createdWorkshop.Price,
|
||||
createdWorkshop.InstitutionContractWorkshopGroupId,createdWorkshop.WorkshopGroup,
|
||||
createdWorkshop.WorkshopId!.Value, createdWorkshop.id);
|
||||
institutionContract.WorkshopGroup.AddCurrentWorkshop(currentWorkshop);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (institutionContract.WorkshopGroup.InitialWorkshops.All(x => x.WorkshopCreated && x.WorkshopId is > 0))
|
||||
{
|
||||
|
||||
institutionContract.Verified();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1092,7 +1092,9 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
Amount = 1000,
|
||||
MaxPersonValid = 500,
|
||||
Duration = "12",
|
||||
HasCustomizeCheckoutService = command.HasCustomizeCheckoutService
|
||||
HasCustomizeCheckoutService = command.HasCustomizeCheckoutService,
|
||||
StartService = institutionContract.ContractStartGr,
|
||||
|
||||
};
|
||||
_rollCallServiceApplication.Create(commandSave);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user