Пример #1
0
        public static void PatientVitals()
        {
            //the For loop runs for the entirity of the program hence the large range
            for (int i = 0; i < 999999999; i++)
            {
                //Runs the alarm data method which checks if a bed should be alarming out or not
                RunningData.AlarmData();
                //method to show the Alarm picture if a bed is alarming

                //If a patient died/vital hits 0 a permanent messagebox will appear
                if (RunningData.fatalAlarm == true)
                {
                    while (true)
                    {
                        DialogResult newResult = MessageBox.Show("Patient: " + RunningData.beds[Constants.alarmingBed].currentPatient.Firstname + " " +
                                                                 RunningData.beds[Constants.alarmingBed].currentPatient.LastName + "\nBed: " + (Constants.alarmingBed + 1) + "\nPatient is DEAD!"
                                                                 , caption: "Fatal", MessageBoxButtons.OK);
                    }
                }
                // if a patient vital exceeds the limits a message box will appear/alarm sound
                if (RunningData.alarm == true)
                {
                    //Pulls a timestamp for the alarm
                    string time = Constants.TimeStamp(DateTime.Now);
                    //Pulls the EmployeeID for the employee currently logged in
                    int employeeID = Convert.ToInt32(Constants.currentEmployee);
                    //Pulls which Module is alarming out
                    int ModuleID = Convert.ToInt32(Constants.alarmingModule);
                    //Pulls which bed is alarming out increases by 1 as bed 0 does not exist
                    int BedID = Convert.ToInt32(Constants.alarmingBed + 1);


                    //Creates a Messagebox showing which patient/bed is alarming out and give the user the option to mute the alarm

                    DialogResult result = MessageBox.Show("Patient: " + RunningData.beds[Constants.alarmingBed].currentPatient.Firstname + " " +
                                                          RunningData.beds[Constants.alarmingBed].currentPatient.LastName + "\nBed: " + (Constants.alarmingBed + 1) + "\nMute Alarm?"
                                                          , caption: "Alarm", MessageBoxButtons.OK);

                    //activates on a user clicking Ok within messagebox
                    if (result == DialogResult.OK)
                    {
                        //Creates a timestamp for the time alarm is muted
                        string mutedTime = Constants.TimeStamp(DateTime.Now);

                        //Create initial alarm record
                        DatabaseConnection.Sample.alarmRecord(employeeID, ModuleID, BedID, time, mutedTime);
                    }
                    //sets the alarms back to false so they can be reactivated upon next alarm
                    RunningData.alarm = false;
                }
                Thread.Sleep(2000);
            }
        }
Пример #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Creates a new running Data which initialises beds and assigns patients/modules
            RunningData run = new RunningData();
            //creation of a thread to run the Method which controls alarms
            Thread loginthr = new Thread(new ThreadStart(Login.PatientVitals));

            //Starts the thread
            loginthr.Start();
            Application.Run(new Login());
        }