Table of Contents

Class AddPrescriptionCommand

Namespace
Core.CliniCore.Commands.Clinical
Assembly
Core.CliniCore.dll

Command that adds a prescription entry to an existing clinical document.

public class AddPrescriptionCommand : AbstractCommand, ICommand
Inheritance
AddPrescriptionCommand
Implements
Inherited Members

Remarks

Prescriptions created by this command must be linked to a diagnosis within the same document to maintain clinical traceability and support auditing.

Constructors

AddPrescriptionCommand(ClinicalDocumentService)

Initializes a new instance of the AddPrescriptionCommand class.

public AddPrescriptionCommand(ClinicalDocumentService clinicalDocService)

Parameters

clinicalDocService ClinicalDocumentService

The clinical document service used to access and modify documents.

Exceptions

ArgumentNullException

Thrown when clinicalDocService is null.

Fields

Key

The unique key used to identify this command.

public const string Key = "addprescription"

Field Value

string

Properties

CanUndo

Whether this command can be undone - defaults to false

public override bool CanUndo { get; }

Property Value

bool

CommandKey

Unique key identifier for this command type Generated from the class name, converted to lowercase without "Command" suffix E.g., "LoginCommand" becomes "login", "CreatePatientCommand" becomes "createpatient"

public override string CommandKey { get; }

Property Value

string

Description

Description of what this command does

public override string Description { get; }

Property Value

string

Methods

CaptureStateForUndo(CommandParameters, SessionContext?)

Captures state before execution for undo - override if undo is supported

protected override object? CaptureStateForUndo(CommandParameters parameters, SessionContext? session)

Parameters

parameters CommandParameters
session SessionContext

Returns

object

ExecuteCore(CommandParameters, SessionContext?)

Executes the core command logic - must be implemented by derived classes

protected override CommandResult ExecuteCore(CommandParameters parameters, SessionContext? session)

Parameters

parameters CommandParameters
session SessionContext

Returns

CommandResult

GetRequiredPermission()

Gets the required permission to execute this command

public override Permission? GetRequiredPermission()

Returns

Permission?

UndoCore(object, SessionContext?)

Performs the undo operation - override if undo is supported

protected override CommandResult UndoCore(object previousState, SessionContext? session)

Parameters

previousState object
session SessionContext

Returns

CommandResult

ValidateParameters(CommandParameters)

Validates command parameters - override in derived classes

protected override CommandValidationResult ValidateParameters(CommandParameters parameters)

Parameters

parameters CommandParameters

The parameters to validate (never null, but may be empty)

Returns

CommandValidationResult

Validation result indicating success or failure with error messages