Adding the update logs when creating payment request from recurring template
This commit is contained in:
parent
14be381f5f
commit
985dc616c7
@ -3028,6 +3028,7 @@ namespace Marco.Pms.Services.Service
|
||||
|
||||
var updatedRecurringPayments = new List<RecurringPayment>();
|
||||
var paymentRequests = new List<PaymentRequest>();
|
||||
var statusUpdateLogs = new List<StatusUpdateLog>();
|
||||
|
||||
// Generate UID prefix for payment requests for this period (month/year)
|
||||
string uIDPrefix = $"PR/{DateTime.Now:MMyy}";
|
||||
@ -3081,6 +3082,29 @@ namespace Marco.Pms.Services.Service
|
||||
IsActive = true,
|
||||
TenantId = recurringPayment.TenantId
|
||||
};
|
||||
statusUpdateLogs.Add(new StatusUpdateLog
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
EntityId = newPaymentRequest.Id,
|
||||
//StatusId = Draft,
|
||||
NextStatusId = Draft,
|
||||
UpdatedById = loggedInEmployee.Id,
|
||||
UpdatedAt = DateTime.UtcNow,
|
||||
Comment = "Payment request is submited as draft",
|
||||
TenantId = tenantId
|
||||
});
|
||||
statusUpdateLogs.Add(new StatusUpdateLog
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
EntityId = newPaymentRequest.Id,
|
||||
StatusId = Draft,
|
||||
NextStatusId = Review,
|
||||
UpdatedById = loggedInEmployee.Id,
|
||||
UpdatedAt = DateTime.UtcNow.AddMilliseconds(1),
|
||||
Comment = "Payment request is submited for Review",
|
||||
TenantId = tenantId
|
||||
});
|
||||
|
||||
paymentRequests.Add(newPaymentRequest);
|
||||
|
||||
uIDPostfix++;
|
||||
@ -3104,6 +3128,12 @@ namespace Marco.Pms.Services.Service
|
||||
_context.PaymentRequests.AddRange(paymentRequests);
|
||||
}
|
||||
|
||||
// Add update logs from new payment requests
|
||||
if (statusUpdateLogs.Any())
|
||||
{
|
||||
_context.StatusUpdateLogs.AddRange(statusUpdateLogs);
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
var newRecurringTemplateIds = updatedRecurringPayments.Select(rp => rp.Id).ToList();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user