private void SetLienNoticeAmount() { var lienWaivers = LienWaiverDataProvider.GetNotVoidedLienWaivers(generationKey); var lienNoticeAmounts = lienWaivers.Select(lw => lw.LienNoticeAmount).Where(lna => lna != null).Distinct(); lienWaiver.LienNoticeAmount = lienNoticeAmounts.SingleOrNull(); }
public bool IsLienWaiverFinal(LienWaiverGenerationKey generationKey, bool isConditional) { graph.Caches <ComplianceDocument>().ClearQueryCache(); var lienWaivers = lienWaiverDataProvider.GetNotVoidedLienWaivers(generationKey).ToList(); var lienNoticeAmounts = lienWaivers.Select(lw => lw.LienNoticeAmount) .Where(lna => lna != null).Distinct().ToList(); if (lienNoticeAmounts.IsSingleElement()) { try { var totalAmount = GetTotalAmount(lienWaivers); var lienWaiverAmount = GetLienWaiverAmount(generationKey, isConditional); return(totalAmount + lienWaiverAmount == lienNoticeAmounts.First()); } catch (Exception e) { var waiverIDs = lienWaivers?.Where(w => w.LienNoticeAmount != null) .Select(w => w.ComplianceDocumentID).ToArray(); throw new PXException(ComplianceMessages.LienWaiver.LienWaiverGenerationFailed, waiverIDs?.JoinIntoStringForMessageNoQuotes()); } } return(false); }