예제 #1
0
파일: PersonName.cs 프로젝트: girish66/REM
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public bool Equals(PersonName other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.Prefix, Prefix) && Equals(other.First, First) && Equals(other.Middle, Middle) && Equals(other.Last, Last) && Equals(other.Suffix, Suffix));
 }
예제 #2
0
파일: Patient.cs 프로젝트: divyang4481/REM
        /// <summary>
        /// Initializes a new instance of the <see cref="Patient"/> class.
        /// </summary>
        /// <param name="agency">The agency.</param>
        /// <param name="patientName">Name of the patient.</param>
        /// <param name="profile">The profile.</param>
        protected internal Patient(
            Agency agency,
            PersonName patientName,
            PatientProfile profile )
            : this()
        {
            Check.IsNotNull ( agency, "Agency is required." );
            Check.IsNotNull ( patientName, "Patient name is required" );
            Check.IsNotNull ( profile, "Patient profile is required" );

            Agency = agency;
            _name = patientName;

            _profile = profile;
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientAccount"/> class.
        /// </summary>
        /// <param name="billingOffice">The billing office.</param>
        /// <param name="medicalRecordNumber">The medical record number.</param>
        /// <param name="name">The name.</param>
        /// <param name="birthDate">The birth date.</param>
        /// <param name="homeAddress">The home address.</param>
        /// <param name="administrativeGender">The administrative gender.</param>
        protected internal PatientAccount( BillingOffice billingOffice, long medicalRecordNumber, PersonName name, DateTime? birthDate, Address homeAddress, AdministrativeGender administrativeGender )
            : this()
        {
            Check.IsNotNull ( billingOffice, "Billing office is required." );
            Check.IsNotNull ( name, "Name is required." );
            Check.IsNotNull ( medicalRecordNumber, "Medical record number is required." );
            Check.IsNotNull ( homeAddress, () => HomeAddress );
            Check.IsNotNull( administrativeGender, "Gender is required.");

            BillingOffice = billingOffice;
            MedicalRecordNumber = medicalRecordNumber;
            Name = name;
            BirthDate = birthDate;
            HomeAddress = homeAddress;
            AdministrativeGender = administrativeGender;
        }
예제 #4
0
        /// <summary>
        /// Creates the patient.
        /// </summary>
        /// <param name="agency">The agency.</param>
        /// <param name="patientName">Name of the patient.</param>
        /// <param name="patientProfile">The patient profile.</param>
        /// <returns>
        /// A Patient.
        /// </returns>
        public Patient CreatePatient(Agency agency, PersonName patientName, PatientProfile patientProfile )
        {
            var newPatient = new Patient(agency, patientName, patientProfile);
            Patient createdPatient = null;

            DomainRuleEngine.CreateRuleEngine ( newPatient, "CreatePatientRuleSet" )
                .WithContext ( newPatient.Profile )
                .Execute(() =>
                    {
                        createdPatient = newPatient;

                        newPatient.UpdateUniqueIdentifier(_patientUniqueIdentifierCalculator.GenerateUniqueIdentifier(newPatient));

                        _patientRepository.MakePersistent ( newPatient );

                        DomainEvent.Raise ( new PatientCreatedEvent { Patient = newPatient } );
                });

            return createdPatient;
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StaffProfile"/> class.
        /// </summary>
        /// <param name="staffName">Name of the staff.</param>
        /// <param name="gender">The gender.</param>
        /// <param name="birthDate">The birth date.</param>
        /// <param name="socialSecurityNumber">The social security number.</param>
        /// <param name="staffType">Type of the staff.</param>
        /// <param name="professionalCredentialNote">The professional credential note.</param>
        /// <param name="emailAddress">The email address.</param>
        /// <param name="employmentDateRange">The employment date range.</param>
        /// <param name="note">The note.</param>
        protected internal StaffProfile(
            PersonName staffName,
            Gender gender,
            DateTime? birthDate,
            string socialSecurityNumber,
            StaffType staffType,
            string professionalCredentialNote,
            EmailAddress emailAddress,
            DateRange employmentDateRange,
            string note)
        {
            Check.IsNotNull(staffName, () => StaffName);

            StaffName = staffName;
            Gender = gender;
            BirthDate = birthDate;
            SocialSecurityNumber = socialSecurityNumber;
            StaffType = staffType;
            ProfessionalCredentialNote = professionalCredentialNote;
            EmailAddress = emailAddress;
            EmploymentDateRange = employmentDateRange;
            Note = note;
        }
예제 #6
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public bool Equals(PersonName other)
 {
     if (ReferenceEquals(null, other))
     {
         return false;
     }
     if (ReferenceEquals(this, other))
     {
         return true;
     }
     return Equals(other.Prefix, Prefix) && Equals(other.First, First) && Equals(other.Middle, Middle) && Equals(other.Last, Last) && Equals(other.Suffix, Suffix);
 }
예제 #7
0
 /// <summary>
 /// Assigns the name of the staff.
 /// </summary>
 /// <param name="staffName">Name of the staff.</param>
 /// <returns>A StaffProfileBuilder.</returns>
 public StaffProfileBuilder WithStaffName(PersonName staffName)
 {
     _staffName = staffName;
     return this;
 }
예제 #8
0
 /// <summary>
 /// Creates the patient account.
 /// </summary>
 /// <param name="billingOffice">The billing office.</param>
 /// <param name="medicalRecordNumber">The medical record number.</param>
 /// <param name="name">The name.</param>
 /// <param name="birthDate">The birth date.</param>
 /// <param name="homeAddress">The home address.</param>
 /// <param name="administrativeGender">The administrative gender.</param>
 /// <returns>A patient account.</returns>
 public virtual PatientAccount CreatePatientAccount( BillingOffice billingOffice, long medicalRecordNumber, PersonName name, DateTime? birthDate, Address homeAddress, AdministrativeGender administrativeGender)
 {
     var patientAccount = new PatientAccount ( billingOffice, medicalRecordNumber, name, birthDate, homeAddress, administrativeGender );
     _patientAccountRepository.MakePersistent ( patientAccount );
     return patientAccount;
 }
예제 #9
0
 /// <summary>
 /// Changes the name on the patient account.
 /// </summary>
 /// <param name="name">The name.</param>
 public virtual void ReviseName( PersonName name )
 {
     Check.IsNotNull ( name, "Name cannot be null." );
     Name = name;
 }
예제 #10
0
 public void PersonName_WithValidProperties_Succeeds()
 {
     var name = new PersonName("prefix", "first", "middle", "last", "suffix");
     Assert.AreEqual("prefix first middle last suffix", name.Complete);
 }
예제 #11
0
파일: Patient.cs 프로젝트: divyang4481/REM
        /// <summary>
        /// Renames the specified patient name.
        /// </summary>
        /// <param name="patientName">Name of the patient.</param>
        public virtual void Rename( PersonName patientName )
        {
            Check.IsNotNull ( patientName, "Patient name is required." );

            DomainRuleEngine.CreateRuleEngine<Patient, PersonName> ( this, () => Rename )
                .WithContext ( patientName )
                .Execute ( () =>
                             {
                                 Name = patientName;
                                 DomainEvent.Raise(new PatientRenamedEvent { Patient = this });
                             });
        }