Skip to content

AuditNote

AuditNote wraps a CbpNote entity and implements the note-attachment behaviour of OP-DOM-15: a new note is routed to either the claim or the bill based on its category code — category "C" notes attach to the claim and are added to the repository directly, while category "B" notes attach to the owning bill instead (DOM-BR-150). Bill.ModifyStatus constructs an AuditNote from AuditNoteArguments whenever a status change carries optional note text, and BillRegenerator's cloned bill can likewise gain a note this way.

Purpose

  • Creates a new CbpNote from AuditNoteArguments, resolving its note-type code and routing it to the claim or bill depending on category (DOM-BR-150).
  • Modifies an existing note's text, type, and active flag, and moves its claim/bill reference when the category code changes.
  • Deletes a note from the repository.

Context

  • Namespace: SAIF.Domain.Model.Claims.Bills.Notes
  • Assembly/package: SAIF.Domain (packaged in SAIF.SAIFCode.Core)

Public members

Member Signature Purpose
AuditNote (constructor by id) public AuditNote(IRepositoryFactory factory, IAuditNoteQueryProvider auditNoteQueryProvider, IClaimQueryProvider claimQueryProvider, long noteId) Loads an existing note by noteId.
AuditNote (constructor from entity) public AuditNote(IRepositoryFactory factory, CbpNote data, IAuditNoteQueryProvider auditNoteQueryProvider, IClaimQueryProvider claimQueryProvider) Wraps an already-loaded CbpNote entity.
AuditNote (constructor, create from arguments) public AuditNote(IRepositoryFactory factory, AuditNoteArguments noteArguments, IAuditNoteQueryProvider auditNoteQueryProvider, IClaimQueryProvider claimQueryProvider) Builds a new CbpNote from noteArguments (resolving its note-type code) and routes it to the claim (category "C", added directly to the repository) or to the bill (category "B", appended via bill.AddNote) (DOM-BR-150); if the note-type lookup returns null, DataItem is left unset and the subsequent category routing throws a NullReferenceException*.
AuditNote (constructor, provider variant) public AuditNote(IRepositoryFactory factory, AuditNoteQueryProvider auditNoteQueryProvider, IClaimQueryProvider claimQueryProvider) Creates an empty wrapper bound to a concrete AuditNoteQueryProvider rather than the IAuditNoteQueryProvider interface used elsewhere in this type*.
Data public CbpNote Data { get; } Exposes the underlying CbpNote entity.
GetNoteTypeCode public CbpNoteTypeCode GetNoteTypeCode(string typeCode, string categoryCode) Looks up the CbpNoteTypeCode reference row for the given type and category codes.
ModifyNote public void ModifyNote(AuditNoteArguments noteData) Updates the note's text, type, active flag, and update audit fields from noteData, then moves the note's claim/bill reference if its category changed.
Delete public void Delete() Deletes the note through Factory.GetRepository<CbpNote>().Delete.

Inherited public members

Members in this section are inherited from DomainBase<TItem> in SAIF.Domain. They are available on this type through inheritance (via the intermediate DomainRepositoryBase<TItem> base).

Member Signature Purpose Origin
HasData public virtual bool HasData { get; } Reports whether the wrapped CbpNote entity is present, evaluated as !DataItem.IsNull(). SAIF.Domain — DomainBase<TItem>

Behavioral notes

  • ModifyNote's category-change logic only moves the note when the note's current category differs from the note-type category already resolved onto DataItem.NoteType — it does not compare against noteData.CategoryCode directly, relying on GetNoteTypeCode having already updated NoteType earlier in the same call*.
  • A commented-out CreateAuditNote method duplicates the create-from-arguments constructor logic, suggesting the constructor form superseded an earlier method-based API*.

Constraints and usage notes

  • Category codes are compared as the literal strings "C" and "B"; any other category code on AuditNoteArguments results in the note being created with no claim or bill association at all.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • Domain/SAIF.Domain/Model/Claims/Bills/Notes/AuditNote.cs
  • Domain/SAIF.Domain/DomainBase.cs
  • Domain/SAIF.Domain/DomainRepositoryBase.cs