コード例 #1
0
ファイル: PatientGenerator.cs プロジェクト: rachid1805/str
        public PatientGenerator()
        {
            _hospitals   = MedWatchDAL.FindHospitals().ToList();
            _diseases    = MedWatchDAL.FindDiseases().ToList();
            _freeDoctors = new Dictionary <int, IList <int> >();
            _busyDoctors = new Dictionary <int, IList <int> >();
            _patientsTakenInChargeByDoctor = new List <IPatientTakenInChargeByDoctor>();
            _patientIds = new List <int>();
            _stopWatch  = new Stopwatch();

            // Assign doctors to each hospital
            foreach (var hospital in _hospitals)
            {
                var numberOfDoctors = hospital.AssignedDoctors;
                var doctorsList     = new List <int>(numberOfDoctors);
                for (var i = 0; i < numberOfDoctors; ++i)
                {
                    doctorsList.Add(GeneratorHelper.RandomNumericalValue(int.MaxValue));
                }
                _freeDoctors.Add(hospital.Id, doctorsList);
                _busyDoctors.Add(hospital.Id, new List <int>());
            }

            // Creates the patient arrival sorted dictionary
            _patientsArrival = new SortedDictionary <DiseasePriority, IList <IPatientArrival> >();
            for (var diseasePriority = DiseasePriority.VeryHigh; diseasePriority < DiseasePriority.Invalid; ++diseasePriority)
            {
                _patientsArrival.Add(diseasePriority, new List <IPatientArrival>());
            }
        }
コード例 #2
0
        private void Dashboard_Load(object sender, EventArgs e)
        {
            try
            {
                btnPauseResume.Enabled = false;
                this.Text = AppName;

                var hospitals = MedWatchDAL.FindHospitals();

                var hospitalStatsDataTable = CreateDataTableForHospitalStats(hospitals);
                dataGridView.DataSource = hospitalStatsDataTable;

                InitPerformanceCounters(hospitals);

                // initialization de l'acteur pour le tableau de bord
                _dashboardActor = Program.MediWatchActors.ActorOf(Props.Create(() => new DashboardActor(hospitalStatsDataTable, btnPauseResume)), ActorPaths.DashboardActorName);

                // initialization du commander
                _commanderActor = Program.MediWatchActors.ActorOf(Props.Create(() => new MediWatchCommanderActor(hospitals, _dashboardActor)), ActorPaths.MediWatchCommanderActorName);

                btnPauseResume.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show($"While loading up dashboard: {ex.ToString()}", AppName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }