コード例 #1
0
ファイル: Visit.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Initializes a new instance of the <see cref="Visit"/> class.
        /// </summary>
        /// <param name="staff">The staff.</param>
        /// <param name="appointmentDateTimeRange">The appointment date time range.</param>
        /// <param name="clinicalCase">The clinical case.</param>
        /// <param name="visitStatus">The visit status.</param>
        /// <param name="placeOfService">The place of service.</param>
        /// <param name="name">The name.</param>
        /// <param name="cptCode">The CPT code.</param>
        protected internal Visit(Staff staff, 
            DateTimeRange appointmentDateTimeRange,
            ClinicalCase clinicalCase,
            VisitStatus visitStatus,
            Location placeOfService,
            string name,
            string cptCode )
            : base(staff, appointmentDateTimeRange)
        {
            Check.IsNotNull ( clinicalCase, "Clinical case is required." );
            Check.IsNotNull ( visitStatus, "Visit status is required." );
            Check.IsNotNull ( placeOfService, "Location is required." );
            Check.IsNotNull ( name, "Name is required." );
            Check.IsNotNull ( cptCode, "CptCode is required." );

            if ( visitStatus.WellKnownName != WellKnownNames.VisitModule.VisitStatus.Scheduled )
            {
                throw new ArgumentException ( "Visits must always be created as scheduled visits." );
            }

            _clinicalCase = clinicalCase;
            _visitStatus = visitStatus;
            _serviceLocation = placeOfService;
            _name = name;
            _cptCode = cptCode;
            _activities = new List<Activity> ();
            _problems = new List<VisitProblem> ();
        }
コード例 #2
0
ファイル: AppointmentFactory.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Creates the appointment.
        /// </summary>
        /// <param name="staff">
        /// The staff.
        /// </param>
        /// <param name="appointmentDateTimeRange">
        /// The appointment date time range.
        /// </param>
        /// <returns>
        /// An Appointment.
        /// </returns>
        public Appointment CreateAppointment( Staff staff, DateTimeRange appointmentDateTimeRange )
        {
            var appointment = new Appointment ( staff, appointmentDateTimeRange );

            _appointmentRepository.MakePersistent ( appointment );

            return appointment;
        }
コード例 #3
0
ファイル: Appointment.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Initializes a new instance of the <see cref="Appointment"/> class.
        /// </summary>
        /// <param name="staff">The staff.</param>
        /// <param name="appointmentDateTimeRange">The appointment date time range.</param>
        protected internal Appointment( Staff staff, DateTimeRange appointmentDateTimeRange )
        {
            Check.IsNotNull ( staff, "Staff is required." );
            Check.IsNotNull ( appointmentDateTimeRange, "AppointmentDateTimeRange is required." );

            _staff = staff;
            _appointmentDateTimeRange = appointmentDateTimeRange;
        }
コード例 #4
0
ファイル: SignOnService.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Login to a session as given staff.
        /// </summary>
        /// <param name="staff">The staff.</param>
        public void LoginAs( Staff staff )
        {
            Check.IsNotNull ( staff, "Staff is required." );

            var claimsPrincipal = _currentClaimsPrincipalService.GetCurrentPrincipal ();

            _permissionClaimsManager.IssueSystemPermissionClaimsForStaff ( claimsPrincipal, staff );
            _permissionClaimsManager.IssueStaffKeyClaims ( claimsPrincipal, staff );
        }
コード例 #5
0
ファイル: StaffFactory.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Creates the staff.
        /// </summary>
        /// <param name="agency">The agency.</param>
        /// <param name="staffProfile">The staff profile.</param>
        /// <returns>
        /// A Staff
        /// </returns>
        public Staff CreateStaff( Agency agency, StaffProfile staffProfile)
        {
            var staff = new Staff(agency, staffProfile);

            AddStaffChecklistItemsAndStaffEvents(staff);

            _staffRepository.MakePersistent ( staff );

            return staff;
        }
コード例 #6
0
ファイル: VisitFactory.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Creates the visit.
        /// </summary>
        /// <param name="staff">The staff.</param>
        /// <param name="appointmentDateTimeRange">The appointment date time range.</param>
        /// <param name="clinicalCase">The clinical case.</param>
        /// <param name="visitTemplate">The visit template.</param>
        /// <param name="serviceLocation">The service location.</param>
        /// <returns>
        /// A Visit.
        /// </returns>
        public Visit CreateVisit(Staff staff, 
            DateTimeRange appointmentDateTimeRange,
            ClinicalCase clinicalCase,
            VisitTemplate visitTemplate,
            Location serviceLocation )
        {
            var visitStatus = _visitStatusRepository.GetByWellKnownName ( WellKnownNames.VisitModule.VisitStatus.Scheduled );
            var visit = new Visit (staff, appointmentDateTimeRange, clinicalCase, visitStatus, serviceLocation, visitTemplate.Name, visitTemplate.CptCode );

            _visitRepository.MakePersistent ( visit );
            return visit;
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClinicalCaseSignedComment"/> class.
        /// </summary>
        /// <param name="staff">The staff.</param>
        /// <param name="signedTimestamp">The signed timestamp.</param>
        /// <param name="signedNote">The signed note.</param>
        public ClinicalCaseSignedComment(
            Staff staff,
            DateTimeOffset signedTimestamp,
            string signedNote )
        {
            Check.IsNotNull ( staff, "Staff is required." );
            Check.IsNotNull ( signedTimestamp, "Signed timestamp is required." );
            Check.IsNotNullOrWhitespace ( signedNote, "Signed note is required." );

            _staff = staff;
            _signedTimestamp = signedTimestamp;
            _signedNote = signedNote;
        }
コード例 #8
0
ファイル: BillingOffice.cs プロジェクト: divyang4481/REM
 /// <summary>
 /// Initializes a new instance of the <see cref="BillingOffice"/> class.
 /// </summary>
 /// <param name="agency">The agency.</param>
 /// <param name="administratorStaff">The administrator staff.</param>
 /// <param name="electronicTransmitterIdentificationNumber">The electronic transmitter identification number.</param>
 /// <param name="profile">The profile.</param>
 protected internal BillingOffice(
     Agency agency, Staff administratorStaff, string electronicTransmitterIdentificationNumber, BillingOfficeProfile profile )
     : this()
 {
     Check.IsNotNull ( agency, () => Agency );
     Check.IsNotNull ( administratorStaff, () => AdministratorStaff );
     Check.IsNotNull ( electronicTransmitterIdentificationNumber, () => ElectronicTransmitterIdentificationNumber );
     Check.IsNotNull ( profile, () => Profile );
     Agency = agency;
     AdministratorStaff = administratorStaff;
     ElectronicTransmitterIdentificationNumber = electronicTransmitterIdentificationNumber;
     Profile = profile;
 }
コード例 #9
0
ファイル: ProgramEnrollment.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Initializes a new instance of the <see cref="ProgramEnrollment"/> class.
        /// </summary>
        /// <param name="programOffering">The program offering.</param>
        /// <param name="clinicalCase">The clinical case.</param>
        /// <param name="enrollmentDate">The enrollment date.</param>
        /// <param name="enrollingStaff">The enrolling staff.</param>
        protected internal ProgramEnrollment(ProgramOffering programOffering, ClinicalCase clinicalCase, DateTime enrollmentDate, Staff enrollingStaff)
            : this()
        {
            Check.IsNotNull(programOffering, "Program Offering is required.");
            Check.IsNotNull(clinicalCase, "Clinical Case is required.");
            Check.IsNotNull(enrollmentDate, "Enrollment Date is required.");
            Check.IsNotNull(enrollingStaff, "Enrolling Staff is required.");

            _programOffering = programOffering;
            _clinicalCase = clinicalCase;
            _enrollmentDate = enrollmentDate;
            _enrollingStaff = enrollingStaff;
        }
コード例 #10
0
        /// <summary>
        /// Creates the billing office.
        /// </summary>
        /// <param name="agency">The agency.</param>
        /// <param name="administratorStaff">The administrator staff.</param>
        /// <param name="electronicTransmitterIdentificationNumber">The electronic transmitter identification number.</param>
        /// <param name="profile">The profile.</param>
        /// <returns>The Billing Office.</returns>
        public BillingOffice CreateBillingOffice(
            Agency agency, Staff administratorStaff, string electronicTransmitterIdentificationNumber, BillingOfficeProfile profile )
        {
            Check.IsNotNull ( agency, "Agency is required." );
            Check.IsNotNull ( administratorStaff, "Administrator Staff is required." );
            Check.IsNotNull ( electronicTransmitterIdentificationNumber, "Electronic Transmitter Identification Number is required." );

            var billingOffice = new BillingOffice ( agency, administratorStaff, electronicTransmitterIdentificationNumber, profile );

            _billingOfficeRepository.MakePersistent ( billingOffice );

            return billingOffice;
        }
コード例 #11
0
ファイル: SelfPayment.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Initializes a new instance of the <see cref="SelfPayment"/> class.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="collectedByStaff">The collected by staff.</param>
        /// <param name="money">The money.</param>
        /// <param name="paymentMethod">The payment method.</param>
        /// <param name="collectedDate">The collected date.</param>
        protected internal SelfPayment( Patient patient, Staff collectedByStaff, Money money, PaymentMethod paymentMethod, DateTime? collectedDate )
        {
            Check.IsNotNull ( patient, () => Patient );
            Check.IsNotNull ( collectedByStaff, () => CollectedByStaff );
            Check.IsNotNull ( money, () => Money );
            Check.IsNotNull ( paymentMethod, () => PaymentMethod );
            Check.IsNotNull ( collectedDate, () => CollectedDate );

            _patient = patient;
            _collectedByStaff = collectedByStaff;
            _money = money;
            _paymentMethod = paymentMethod;
            _collectedDate = collectedDate;
        }
コード例 #12
0
ファイル: SelfPaymentFactory.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Creates the self payment.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="staff">The staff.</param>
        /// <param name="money">The money.</param>
        /// <param name="paymentMethod">The payment method.</param>
        /// <param name="collectedDate">The collected date.</param>
        /// <returns>A Self Payment.</returns>
        public SelfPayment CreateSelfPayment( Patient patient, Staff staff, Money money, PaymentMethod paymentMethod, DateTime? collectedDate )
        {
            var selfPayment = new SelfPayment ( patient, staff, money, paymentMethod, collectedDate );
            SelfPayment createdSelfPayment = null;

            DomainRuleEngine.CreateRuleEngine ( selfPayment, "CreateSelfPaymentRuleSet" )
                .Execute ( () =>
                    {
                        createdSelfPayment = selfPayment;

                        _selfPaymentRepository.MakePersistent(createdSelfPayment);
                    });

            return createdSelfPayment;
        }
コード例 #13
0
ファイル: AgencyContact.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Initializes a new instance of the <see cref="AgencyContact"/> class.
        /// </summary>
        /// <param name="agencyContactType">
        /// The agency contact type.
        /// </param>
        /// <param name="contactStaff">
        /// The contact staff.
        /// </param>
        /// <param name="effectiveStartDate">
        /// The effective start date.
        /// </param>
        /// <param name="statusIndicator">
        /// The status indicator.
        /// </param>
        /// <param name="alternativeContactIndicator">
        /// The alternative contact indicator.
        /// </param>
        protected internal AgencyContact(
            AgencyContactType agencyContactType, 
            Staff contactStaff, 
            DateTime? effectiveStartDate, 
            bool statusIndicator, 
            bool alternativeContactIndicator)
        {
            Check.IsNotNull(agencyContactType, () => AgencyContactType);
            Check.IsNotNull(contactStaff, () => ContactStaff);

            _agencyContactType = agencyContactType;
            _contactStaff = contactStaff;
            _effectiveStartDate = effectiveStartDate;
            _statusIndicator = statusIndicator;
            _alternativeContactIndicator = alternativeContactIndicator;
        }
コード例 #14
0
ファイル: LocationContact.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Initializes a new instance of the <see cref="LocationContact"/> class.
        /// </summary>
        /// <param name="locationContactType">Type of the location contact.</param>
        /// <param name="contactStaff">The contact staff.</param>
        /// <param name="effectiveDateRange">The effective date range.</param>
        /// <param name="statusIndicator">If set to <c>true</c> [status indicator].</param>
        /// <param name="alternativeContactIndicator">If set to <c>true</c> [alternative contact indicator].</param>
        protected internal LocationContact(
            LocationContactType locationContactType, 
            Staff contactStaff, 
            DateRange effectiveDateRange, 
            bool statusIndicator, 
            bool alternativeContactIndicator)
        {
            Check.IsNotNull(locationContactType, () => LocationContactType);
            Check.IsNotNull(contactStaff, () => ContactStaff);

            _locationContactType = locationContactType;
            _contactStaff = contactStaff;
            _effectiveDateRange = effectiveDateRange;
            _statusIndicator = statusIndicator;
            _alternativeContactIndicator = alternativeContactIndicator;
        }
コード例 #15
0
ファイル: Encounter.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Initializes a new instance of the <see cref="Encounter"/> class.
        /// </summary>
        /// <param name="patientAccount">The patient account.</param>
        /// <param name="serviceLocation">The service location.</param>
        /// <param name="serviceProviderStaff">The service provider staff.</param>
        /// <param name="trackingNumber">The tracking number.</param>
        /// <param name="serviceDate">The service date.</param>
        protected internal Encounter(
            PatientAccount patientAccount,
            Location serviceLocation,
            Staff serviceProviderStaff,
            long trackingNumber,
            DateTime serviceDate)
            : this()
        {
            Check.IsNotNull ( patientAccount, "Patient account is required." );
            Check.IsNotNull ( serviceLocation, "Place of service is required." );
            Check.IsNotNull ( serviceProviderStaff, "Service provider staff is required." );
            Check.IsNotNull ( serviceDate, "Service date staff is required." );

            PatientAccount = patientAccount;
            ServiceLocation = serviceLocation;
            ServiceProviderStaff = serviceProviderStaff;
            TrackingNumber = trackingNumber;
            ServiceDate = serviceDate;
        }
コード例 #16
0
        /// <summary>
        /// Creates the program enrollment.
        /// </summary>
        /// <param name="programOffering">The program offering.</param>
        /// <param name="clinicalCase">The clinical case.</param>
        /// <param name="enrollmentDate">The enrollment date.</param>
        /// <param name="enrollingStaff">The enrolling staff.</param>
        /// <returns>
        /// A ProgramEnrollment.
        /// </returns>
        public ProgramEnrollment CreateProgramEnrollment(ProgramOffering programOffering, ClinicalCase clinicalCase, DateTime enrollmentDate, Staff enrollingStaff)
        {
            Check.IsNotNull(programOffering, "Program Offering is required.");
            Check.IsNotNull(clinicalCase, "Clinical Case is required.");
            Check.IsNotNull(enrollmentDate, "Enrollment Date is required.");
            Check.IsNotNull(enrollingStaff, "Enrolling Staff is required.");

            var newProgramEnrollment = new ProgramEnrollment ( programOffering, clinicalCase, enrollmentDate, enrollingStaff );
            ProgramEnrollment createdProgramEnrollment = null;

            DomainRuleEngine.CreateRuleEngine ( newProgramEnrollment, "CreateProgramEnrollmentRuleSet" )
                .WithContext ( enrollmentDate )
                .WithContext ( enrollingStaff )
                .Execute ( () =>
                    {
                        _programEnrollmentRepository.MakePersistent(newProgramEnrollment);
                        createdProgramEnrollment = newProgramEnrollment;
                    });

            return createdProgramEnrollment;
        }
コード例 #17
0
ファイル: StaffTests.cs プロジェクト: divyang4481/REM
        public void SetPrimaryLocation_GivenLocationButWithoutAgencyLocations_ValidationFailureEventIsRaised()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                var staff = new Staff(new Mock<Agency>().Object,
                          new StaffProfileBuilder().WithStaffName(new PersonNameBuilder().WithFirst("first name").WithLast("last name")));

                var location = new Location(
                    new Mock<Agency>().Object,
                    new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName("location name")));

                bool eventRaised = false;
                DomainEvent.Register<RuleViolationEvent>(p => eventRaised = true);

                // Exercise
                staff.SetPrimaryLocation(location);

                // Verify
                Assert.IsTrue(eventRaised);
            }
        }
コード例 #18
0
ファイル: StaffTests.cs プロジェクト: divyang4481/REM
        public void SetPrimaryLocation_GivenLocationButWithoutAgencyLocations_PrimaryLocationIsNotChanged()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture ( serviceLocatorFixture );

                var staff = new Staff(new Mock<Agency>().Object,
                        new StaffProfileBuilder().WithStaffName(new PersonNameBuilder().WithFirst("first name").WithLast("last name")));

                var location = new Location(
                    new Mock<Agency>().Object,
                    new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName("location name")));

                staff.SetPrimaryLocation(null);

                // Exercise
                staff.SetPrimaryLocation(location);

                // Verify
                Assert.IsTrue ( staff.PrimaryLocation == null );
            }
        }
コード例 #19
0
 /// <summary>
 /// Assigns the performed by staff.
 /// </summary>
 /// <param name="performedByStaff">The performed by staff.</param>
 /// <returns>A ClinicalCaseProfileBuilder.</returns>
 public ClinicalCaseProfileBuilder WithPerformedByStaff(Staff performedByStaff)
 {
     _performedByStaff = performedByStaff;
     return this;
 }
コード例 #20
0
ファイル: StaffFactory.cs プロジェクト: divyang4481/REM
 /// <summary>
 /// Destroys the staff.
 /// </summary>
 /// <param name="staff">The staff.</param>
 public void DestroyStaff( Staff staff )
 {
     Check.IsNotNull ( staff, "Staff is required." );
     _staffRepository.MakeTransient ( staff );
 }
コード例 #21
0
ファイル: StaffFactory.cs プロジェクト: divyang4481/REM
        private void AddStaffChecklistItemsAndStaffEvents(Staff staff)
        {
            var staffChecklistItemTypes = _lookupValueRepository.GetAll ( typeof ( StaffChecklistItemType ) );
            staffChecklistItemTypes.ForEach(staffChecklistItem => staff.AddChecklistItem(new StaffChecklistItem((StaffChecklistItemType)staffChecklistItem)));

            var staffEventTypes = _lookupValueRepository.GetAll(typeof(StaffEventType));
            staffEventTypes.ForEach(staffEventType => staff.AddEvent(new StaffEvent((StaffEventType)staffEventType)));
        }
コード例 #22
0
        /// <summary>
        /// Issues the staff key claims.
        /// </summary>
        /// <param name="claimsPrincipal">The claims principal.</param>
        /// <param name="staff">The staff.</param>
        public void IssueStaffKeyClaims( IClaimsPrincipal claimsPrincipal, Staff staff )
        {
            Check.IsNotNull ( claimsPrincipal, "ClaimsPrincipal is required." );
            Check.IsNotNull ( staff, "Staff is required." );

            var realm = _federationAuthenticationModule.Realm;

            var claim = new Claim ( ClaimTypes.StaffKeyClaimType, staff.Key + string.Empty, realm );

            var identity = ( IClaimsIdentity )claimsPrincipal.Identity;
            identity.Claims.Add ( claim );

            Logger.Debug ( "Principal ({0}) is issued the following claim ({1}).", staff.StaffProfile.StaffName.Complete, claim.ToString () );
        }
コード例 #23
0
ファイル: EncounterFactory.cs プロジェクト: divyang4481/REM
 /// <summary>
 /// Creates the encounter.
 /// </summary>
 /// <param name="patientAccount">The patient account.</param>
 /// <param name="placeOfService">The place of service.</param>
 /// <param name="serviceProvider">The service provider.</param>
 /// <param name="trackingNumber">The tracking number.</param>
 /// <param name="serviceDate">The service date.</param>
 /// <returns>An encounter.</returns>
 public Encounter CreateEncounter(PatientAccount patientAccount, Location placeOfService, Staff serviceProvider, long trackingNumber, DateTime serviceDate )
 {
     var encounter = new Encounter(patientAccount, placeOfService, serviceProvider, trackingNumber, serviceDate);
     _encounterRepository.MakePersistent(encounter);
     return encounter;
 }
コード例 #24
0
ファイル: BillingOffice.cs プロジェクト: divyang4481/REM
 /// <summary>
 /// Revises the administrator staff.
 /// </summary>
 /// <param name="administratorStaff">The administrator staff.</param>
 public virtual void ReviseAdministratorStaff( Staff administratorStaff )
 {
     Check.IsNotNull ( administratorStaff, () => AdministratorStaff );
     AdministratorStaff = administratorStaff;
 }
コード例 #25
0
        /// <summary>
        /// Issues the system permission claims for staff.
        /// </summary>
        /// <param name="claimsPrincipal">The claims principal.</param>
        /// <param name="staff">The staff.</param>
        public void IssueSystemPermissionClaimsForStaff( IClaimsPrincipal claimsPrincipal, Staff staff )
        {
            Check.IsNotNull ( claimsPrincipal, "ClaimsPrincipal is required." );
            Check.IsNotNull ( staff, "Staff is required." );

            var grantedRoles = staff.SystemRoles.Select ( x => x.SystemRole );
            var grantedPermissions = _systemPermissionService.FindGrantedSystemPermissions ( grantedRoles );
            IssueSystemPermissionClaimsForStaff ( claimsPrincipal, grantedPermissions, staff );
        }
コード例 #26
0
ファイル: NCSCriptBuilder.cs プロジェクト: divyang4481/REM
        private void LoadEntitiesFromDomain( long patientKey, long staffKey, long agencyKey, long locationKey )
        {
            Logger.Debug ( "LoadEntitiesFromDomain - Loading Entities" );

            var patientCriteria =
                DetachedCriteria.For<Patient> ( "p" ).Add ( Restrictions.Eq ( Projections.Property ( "p.Key" ), patientKey ) );

            var staffCriteria = DetachedCriteria
                .For<Staff> ( "s" )
                .Add ( Restrictions.Eq ( Projections.Property ( "s.Key" ), staffKey ) );

            var agencyCriteria =
                DetachedCriteria.For<Agency> ( "a" ).Add ( Restrictions.Eq ( Projections.Property ( "a.Key" ), agencyKey ) );

            var locationCriteria =
                DetachedCriteria.For<Location> ( "l" ).Add ( Restrictions.Eq ( Projections.Property ( "l.Key" ), locationKey ) );

            var multiCriteria =
                _session.CreateMultiCriteria ()
                    .Add ( patientCriteria )
                    .Add ( staffCriteria )
                    .Add ( agencyCriteria )
                    .Add ( locationCriteria );

            var criteriaList = multiCriteria.List ();

            try
            {
                _patient = ( ( IList )criteriaList[0] )[0] as Patient;
            }
            catch ( ArgumentOutOfRangeException )
            {
                //// No patient with an Id of [_patientKey] was found.
                _patient = null;
            }
            _staff = ( ( IList )criteriaList[1] )[0] as Staff;
            _agency = ( ( IList )criteriaList[2] )[0] as Agency;
            _location = ( ( IList )criteriaList[3] )[0] as Location;
        }
コード例 #27
0
ファイル: NCSCriptBuilder.cs プロジェクト: divyang4481/REM
 private LicensedPrescriberType BuildLicensedPrescriberType( Staff staff )
 {
     return new LicensedPrescriberType
         {
             ID = staff.Key.ToString (),
             LicensedPrescriberName = new PersonNameType
                 {
                     First = staff.StaffProfile.StaffName.First,
                     Last = staff.StaffProfile.StaffName.Last,
                     Middle = staff.StaffProfile.StaffName.Middle
                 },
             Dea = ExtractStaffIdentifier ( staff, StaffIdentifierType.Dea, true ),
             Npi = ExtractStaffIdentifier ( staff, StaffIdentifierType.Npi ),
         };
 }
コード例 #28
0
ファイル: NCSCriptBuilder.cs プロジェクト: divyang4481/REM
        private static string ExtractStaffIdentifier( Staff staff, string identifierType, bool isRequired = false )
        {
            var candidate = staff.Identifiers.FirstOrDefault ( c => c.StaffIdentifierType.WellKnownName == identifierType );

            if ( candidate != null )
            {
                return candidate.IdentifierNumber;
            }

            if ( isRequired )
            {
                throw new ApplicationException ( string.Format ( "Staff Does not contain an Identifier of type {0}", identifierType ) );
            }

            return string.Empty;
        }
コード例 #29
0
        /// <summary>
        /// Rollbacks the emergency access.
        /// </summary>
        /// <param name="claimsPrincipal">The claims principal.</param>
        /// <param name="staff">The staff.</param>
        public void RollbackEmergencyAccess( IClaimsPrincipal claimsPrincipal, Staff staff )
        {
            Check.IsNotNull ( claimsPrincipal, "ClaimsPrincipal is required." );
            Check.IsNotNull ( staff, "Staff is required." );

            var identity = ( IClaimsIdentity )claimsPrincipal.Identity;
            identity.Claims.Clear ();
            IssueSystemPermissionClaims ( claimsPrincipal, staff.SystemAccount );
            IssueAccountKeyClaims ( claimsPrincipal, staff.SystemAccount );
            IssueSystemPermissionClaimsForStaff ( claimsPrincipal, staff );
            IssueStaffKeyClaims ( claimsPrincipal, staff );
        }
コード例 #30
0
        private void IssueSystemPermissionClaimsForStaff(
            IPrincipal claimsPrincipal,
            IEnumerable<SystemPermission> grantedPermissions,
            Staff staff )
        {
            var identity = ( IClaimsIdentity )claimsPrincipal.Identity;
            var exsitingPermissions = FindExistingSystemPermissionWellKnownNames ( identity );

            var realm = _federationAuthenticationModule.Realm;

            foreach ( var grantedPermission in grantedPermissions )
            {
                if ( !exsitingPermissions.Any ( x => x == grantedPermission.WellKnownName ) )
                {
                    var claim = new Claim (
                        ClaimTypes.PermissionClaimType,
                        grantedPermission.WellKnownName,
                        realm );

                    identity.Claims.Add ( claim );

                    Logger.Debug ( "Staff ({0}) is issued the following claim ({1}).", staff.Key, claim.ToString () );
                }
                else
                {
                    Logger.Debug ( "Claim for permission ({0}) has already existed.", grantedPermission.WellKnownName );
                }
            }
        }