Handle BuyInstitutionContractInstallment items in invoice processing and add GetIdByInstallmentId method
This commit is contained in:
@@ -145,4 +145,6 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
Task<long> GetIdByInstallmentId(long installmentId);
|
||||
}
|
||||
@@ -253,6 +253,8 @@ public interface IInstitutionContractApplication
|
||||
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
|
||||
|
||||
Task<OperationResult> SetPendingWorkflow(long entityId);
|
||||
Task<long> GetIdByInstallmentId(long installmentId);
|
||||
|
||||
}
|
||||
|
||||
public class InstitutionContractPrintViewModel
|
||||
|
||||
@@ -1485,12 +1485,12 @@ public class EmployerApplication : IEmployerApplication
|
||||
return opration.Failed("نام شرکت وارد شده تکراری است");
|
||||
}
|
||||
|
||||
if (_EmployerRepository.Exists(x =>
|
||||
x.RegisterId == command.RegisterId && !string.IsNullOrWhiteSpace(command.RegisterId) &&
|
||||
x.RegisterId != null))
|
||||
{
|
||||
return opration.Failed(" شماره ثبت وارد شده تکراری است");
|
||||
}
|
||||
// if (_EmployerRepository.Exists(x =>
|
||||
// x.RegisterId == command.RegisterId && !string.IsNullOrWhiteSpace(command.RegisterId) &&
|
||||
// x.RegisterId != null))
|
||||
// {
|
||||
// return opration.Failed(" شماره ثبت وارد شده تکراری است");
|
||||
// }
|
||||
|
||||
if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1726,6 +1726,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
{
|
||||
return await _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x=> x.InitialWorkshops)
|
||||
.Include(x=>x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractId);
|
||||
}
|
||||
|
||||
@@ -4201,7 +4204,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<long> GetIdByInstallmentId(long installmentId)
|
||||
{
|
||||
return await _context.InstitutionContractSet.Include(x=>x.Installments)
|
||||
.Where(x=>x.Installments.Any(i=>i.Id==installmentId))
|
||||
.Select(x=>x.id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ public class GeneralController : GeneralBaseController
|
||||
payResponse.cardnumber, payResponse.issuerbank, payResponse.rrn.ToString(),
|
||||
payResponse.digitalreceipt);
|
||||
|
||||
if (financialInvoice.Items?.Any(x => x.Type == FinancialInvoiceItemType.BuyInstitutionContract) ?? false)
|
||||
if (financialInvoice.Items?.Any(x => x.Type is FinancialInvoiceItemType.BuyInstitutionContract or FinancialInvoiceItemType.BuyInstitutionContractInstallment) ?? false)
|
||||
{
|
||||
var financialItems = financialInvoice.Items
|
||||
.Where(x => x.Type == FinancialInvoiceItemType.BuyInstitutionContract);
|
||||
@@ -158,6 +158,16 @@ public class GeneralController : GeneralBaseController
|
||||
{
|
||||
await _institutionContractApplication.SetPendingWorkflow(editFinancialInvoiceItem.EntityId);
|
||||
}
|
||||
var financialInstallmentItems = financialInvoice.Items
|
||||
.Where(x => x.Type == FinancialInvoiceItemType.BuyInstitutionContractInstallment);
|
||||
|
||||
foreach (var editFinancialInvoiceItem in financialInstallmentItems)
|
||||
{
|
||||
var institutionContractId =
|
||||
await _institutionContractApplication.GetIdByInstallmentId(
|
||||
editFinancialInvoiceItem.Id);
|
||||
await _institutionContractApplication.SetPendingWorkflow(institutionContractId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!setSuccessResult.IsSuccedded)
|
||||
|
||||
Reference in New Issue
Block a user