Пример #1
0
        public Doctor(ref PrivateHospital hospital)
        {
            Random rnd = new Random();

            Id               = doctorCount;
            Experience       = rnd.Next(1, 10);
            PayRatio         = rnd.NextDouble();
            SurgeryAvailable = rnd.Next(1, 5);
            this.hospital    = hospital;

            doctorCount++;

            thread = new Thread(duty);
            thread.Start();
        }
Пример #2
0
        static void Main(string[] args)
        {
            PrivateHospital h1 = new PrivateHospital();

            while (true)
            {
                if (h1.doctorCount() < 10)
                {
                    Doctor d1 = new Doctor(ref h1);
                    h1.registerDoctor(ref d1);
                }

                Patient p1 = new Patient(ref h1);
                h1.registerPatient(ref p1);

                Thread.Sleep(2000);
            }
        }
Пример #3
0
        public Patient(ref PrivateHospital hospital)
        {
            Func <double, double, double, double> doubleFromRange = (min, max, rand) => min + (rand * (max - min));
            Random rnd = new Random();

            this.hospital = hospital;
            Id            = patientCount;
            Budged        = doubleFromRange(50, 1000, rnd.NextDouble());
            Injury        = new Request()
            {
                PatientID  = Id,
                Result     = Result.Pending,
                Complexity = rnd.Next(1, 10),
                Source     = "Patient"
            };

            goToHospital();

            thread = new Thread(await);

            patientCount++;

            thread.Start();
        }