public void GetMostClosedStep()
        {
            EventStorePatientStepSchedulingService eventStepService = SetupEventStepService();
            StepClosureStatisticDTO stepStatistic = eventStepService.ClosedSchedulingStepStatistic();

            Assert.Equal(EventStep.Specialty, stepStatistic.MostClosedStep);
        }
        public void GetClosedStepStatistic()
        {
            EventStorePatientStepSchedulingService eventStepService = SetupEventStepService();
            StepClosureStatisticDTO stepStatistic = eventStepService.ClosedSchedulingStepStatistic();

            Assert.Equal(3, stepStatistic.TotalNumberOfClosures);
        }
        public void GetNumberOfClosuresOnDoctorStep()
        {
            EventStorePatientStepSchedulingService eventStepService = SetupEventStepService();
            StepClosureStatisticDTO stepStatistic = eventStepService.ClosedSchedulingStepStatistic();

            Assert.Equal(1, stepStatistic.NumberOfClosuresOnDoctorStep);
        }
コード例 #4
0
        public StepClosureStatisticDTO ClosedSchedulingStepStatistic()
        {
            StepClosureStatisticDTO closedSchedulingStepStatistic = new StepClosureStatisticDTO();

            try
            {
                IEnumerable <PatientStepSchedulingEvent> closedScheduling = _patientSchedulingEventRepository.GetAll
                                                                                (e => e.ClickEvent == ClickEvent.Close);

                closedSchedulingStepStatistic.NumberOfClosuresOnDateStep        = closedScheduling.Where(e => e.EventStep == EventStep.Date).Count();
                closedSchedulingStepStatistic.NumberOfClosuresOnSpecialtyStep   = closedScheduling.Where(e => e.EventStep == EventStep.Specialty).Count();
                closedSchedulingStepStatistic.NumberOfClosuresOnDoctorStep      = closedScheduling.Where(e => e.EventStep == EventStep.Doctor).Count();
                closedSchedulingStepStatistic.NumberOfClosuresOnAppointmentStep = closedScheduling.Where(e => e.EventStep == EventStep.Appointment).Count();
                closedSchedulingStepStatistic.TotalNumberOfClosures             = closedScheduling.Count();

                EventStep mostClosedStep = EventStep.Date;
                int       maxNumber      = closedSchedulingStepStatistic.NumberOfClosuresOnDateStep;

                if (closedSchedulingStepStatistic.NumberOfClosuresOnSpecialtyStep > maxNumber)
                {
                    mostClosedStep = EventStep.Specialty;
                    maxNumber      = closedSchedulingStepStatistic.NumberOfClosuresOnSpecialtyStep;
                }
                if (closedSchedulingStepStatistic.NumberOfClosuresOnDoctorStep > maxNumber)
                {
                    mostClosedStep = EventStep.Doctor;
                    maxNumber      = closedSchedulingStepStatistic.NumberOfClosuresOnDoctorStep;
                }
                if (closedSchedulingStepStatistic.NumberOfClosuresOnAppointmentStep > maxNumber)
                {
                    mostClosedStep = EventStep.Appointment;
                    maxNumber      = closedSchedulingStepStatistic.NumberOfClosuresOnAppointmentStep;
                }

                closedSchedulingStepStatistic.MostClosedStep = mostClosedStep;
            }
            catch (Exception)
            {
                return(new StepClosureStatisticDTO());
            }

            return(closedSchedulingStepStatistic);
        }