Beispiel #1
0
        } // end of FindControlUnitForSpecialFacitlityService

        #endregion

        #region FindControlForOutpatientAdmission

        /// <summary>
        /// Finds a control unit that handles a specific outpatient admission type
        /// </summary>
        /// <param name="admission">The admission type that is searched for</param>
        /// <returns>Either a control unit that handles the admission or null if no such control unit exists</returns>
        public ControlUnit FindControlForOutpatientAdmission(OutpatientAdmissionTypes admission)
        {
            if (!HandledOutpatientAdmissionTypes.Contains(admission))
            {
                return(null);
            }

            if (!HandledOutpatientAdmissionTypes.Contains(admission))
            {
                if (ParentControlUnit != null)
                {
                    return(((ControlUnitHealthCare)ParentControlUnit).FindControlForOutpatientAdmission(admission));
                }
                else
                {
                    return(null);
                }
            } // end if

            if (this.ControlUnitType == Enums.ControlUnitType.Outpatient &&
                this.HandledOutpatientAdmissionTypes.Contains(admission))
            {
                return(this);
            }
            else
            {
                foreach (ControlUnitHealthCare childControl in ChildHealthCareControlUnits.Where(p => p.HandledOutpatientAdmissionTypes.Contains(admission)))
                {
                    ControlUnit foundControl = childControl.FindControlForOutpatientAdmission(admission);
                    if (foundControl != null)
                    {
                        return(foundControl);
                    }
                } // end foreach
            }     // end if

            return(null);
        } // end of FindControlForOutpatientAdmission
Beispiel #2
0
        } // end of RemoveEntity

        #endregion

        //--------------------------------------------------------------------------------------------------
        // Find ControlUnits
        //--------------------------------------------------------------------------------------------------

        #region FindControlUnitForSpecialFacitlityService

        /// <summary>
        /// Looks for a control unit in the tree that handles a specific special facility service (e.g. diagnostics)
        /// request
        /// </summary>
        /// <param name="request">The special facility service request</param>
        /// <returns>Either a control unit that handles the request or null if no such control unit exists</returns>
        public ControlUnit FindControlUnitForSpecialFacitlityService(RequestSpecialFacilitiyService request)
        {
            if (request is RequestSpecialFacilitiyService)
            {
                if (!HandledSpecialFacilityAdmissionTypes.Contains(((RequestSpecialFacilitiyService)request).SpecialFacilityAdmissionTypes))
                {
                    if (ParentControlUnit != null)
                    {
                        return(((ControlUnitHealthCare)ParentControlUnit).FindControlUnitForSpecialFacitlityService((RequestSpecialFacilitiyService)request));
                    }
                    else
                    {
                        return(null);
                    }
                } // end if

                if (this.ControlUnitType == Enums.ControlUnitType.SpecialFacilityModel &&
                    this.HandledSpecialFacilityAdmissionTypes.Contains(((RequestSpecialFacilitiyService)request).SpecialFacilityAdmissionTypes))
                {
                    return(this);
                }
                else
                {
                    foreach (ControlUnitHealthCare child in ChildHealthCareControlUnits.Where(p => p.HandledSpecialFacilityAdmissionTypes.Contains(((RequestSpecialFacilitiyService)request).SpecialFacilityAdmissionTypes)))
                    {
                        ControlUnit foundControl = child.FindControlUnitForSpecialFacitlityService(request);
                        if (foundControl != null)
                        {
                            return(foundControl);
                        }
                    } // end foreach
                }     // end if
            }         // end if

            return(null);
        } // end of FindControlUnitForSpecialFacitlityService