public void Initialize(DB_ServiceType serviceType, IPEMR_Element element,
                        IPEMRDiagnosisServicesRequest diagnosisServicesRequest)
 {
     ServiceType           = serviceType;
     Selected_PEMR_Element = element;
     ParentContainer       = diagnosisServicesRequest;
 }
        public static QueueManager CreateNewQueueManager(Invoice invoice, InvoiceDetail invoiceDetail)
        {
            Service_cu service;

            if (invoiceDetail.Service_CU_ID != null)
            {
                service = GetService(Convert.ToInt32(invoiceDetail.Service_CU_ID));
            }
            else
            {
                return(null);
            }

            List <StationPointStage_cu> serviceType_StationPointStagesList     = null;
            List <StationPointStage_cu> ServiceCategory_StationPointStagesList = null;
            List <StationPointStage_cu> service_StationPointStagesList         = null;

            ServiceCategory_cu serviceCategory = GetServiceCategory(Convert.ToInt32(service.ServiceCategory_CU_ID));
            ServiceCategory_StationPoint_cu serviceCategoryStation = null;

            if (serviceCategory != null)
            {
                serviceCategoryStation = GetServiceCategoryStationPoint(serviceCategory.ID);
            }
            if (serviceCategoryStation != null)
            {
                ServiceCategory_StationPointStagesList = GetStationPointStagesList(serviceCategoryStation.StationPoint_CU_ID, true);
            }

            DB_ServiceType serviceType = (DB_ServiceType)service.ServiceType_P_ID;
            ServiceType_StationPoint_cu serviceTypeStation =
                ServiceType_StationPoint_cu.ItemsList.Find(
                    item => Convert.ToInt32(item.ServiceType_P_ID).Equals((int)serviceType));

            if (serviceTypeStation != null)
            {
                serviceType_StationPointStagesList = GetStationPointStagesList(serviceTypeStation.StationPoint_CU_ID, true);
            }

            Service_StationPoint_cu serviceStation = GetServiceStationPoint(service.ID);

            if (serviceStation != null)
            {
                service_StationPointStagesList = GetStationPointStagesList(serviceStation.StationPoint_CU_ID, true);
            }

            if (serviceStation != null)
            {
                return(CreateNewQueueManager(invoice, invoiceDetail, serviceStation, service_StationPointStagesList));
            }
            if (serviceCategoryStation != null)
            {
                return(CreateNewQueueManager(invoice, invoiceDetail, serviceCategoryStation, ServiceCategory_StationPointStagesList));
            }
            if (serviceTypeStation != null)
            {
                return(CreateNewQueueManager(invoice, invoiceDetail, serviceTypeStation, serviceType_StationPointStagesList));
            }

            return(null);
        }