Esempio n. 1
0
        public override void Execute()
        {
            Guard.ArgumentNotNull(_patient, "_patient");
            Guard.ArgumentNotNullOrEmpty(_patient.IssuerOfPatientID, "IssuerOfPatientID");

            var broker = new BrokerService();

            var p = broker.FindPatient(_patient.PatientID, _patient.IssuerOfPatientID);

            if (p != null)
            {
                throw new ArgumentException("Patient already exist");
            }

            broker.AddPatient(_patient, State as MWLDataset);
        }
Esempio n. 2
0
        public override void Execute()
        {
            Guard.ArgumentNotNull(_patient, "_patient");
            Guard.ArgumentNotNullOrEmpty(_patient.IssuerOfPatientID, "IssuerOfPatientID");

            var broker = new BrokerService();

            var p = broker.FindPatient(_patient.PatientID, _patient.IssuerOfPatientID);

            if (p != null)
            {
                //deletes patient only and leave the cascade operation to db engine:
                //broker.DeletePatient(_patient.PatientID, _patient.IssuerOfPatientID);

                //enforce deleting all logically related records:
                broker.DeletePatientAndRelatedRecords(_patient.PatientID, _patient.IssuerOfPatientID);
            }
        }
Esempio n. 3
0
        public override void Execute()
        {
            Guard.ArgumentNotNull(_patient, "_patient");
            Guard.ArgumentNotNullOrEmpty(_patient.IssuerOfPatientID, "IssuerOfPatientID");

            var broker = new BrokerService();

            var p = broker.FindPatient(_patient.PatientID, _patient.IssuerOfPatientID);

            if (p != null)
            {
                broker.UpdatePatient(_patient.PatientID, _patient.IssuerOfPatientID, _patient);
            }
            else
            {
                broker.AddPatient(_patient);
            }
        }