public Alarm getAlarm(string name)
        {
            Alarm serviceAlarm = new Alarm();
            if (System.Threading.Monitor.TryEnter(obj3, 10000))
            {
                try
                {
                    serviceAlarm.Name = AlarmControl.getAlarm(name).name;
                    serviceAlarm.Type = AlarmControl.getAlarm(name).type;
                    serviceAlarm.Time = Convert.ToString(AlarmControl.getAlarm(name).time);
                    serviceAlarm.Location = AlarmControl.getAlarm(name).location;
                    serviceAlarm.Status = AlarmControl.getAlarm(name).status;

                }
                catch (NullReferenceException)
                {

                }
                finally
                {
                    System.Threading.Monitor.Exit(obj3);
                }
            }
            return serviceAlarm;
        }
Ejemplo n.º 2
0
        protected void attendBtn_Click(object sender, EventArgs e)
        {
            Timer1.Enabled = false;

            if (SecretLabel.Text.Equals("") != true)
            {
                alarmId = Convert.ToInt32(SecretLabel.Text);
                alarm = alarmService.getAlarmById(alarmId);

                //3. update alarm status to attending
                alarmService.updateAlarm(alarm.Name, alarm.Type, alarm.Location, "attending");

                //4. become an alarmAttendant
                string userName = Convert.ToString(Page.User.Identity.Name);
                extendedService.createAlarmAttendance(alarm.Name, userName);

                //5. make an alarmCount
                extendedService.createAlarmCount(alarm.Name);

                //6. remove the alarm exchange from RabbitMQ
                AttendAlarm.DeleteAlarmQueue();

                //7. and logout...
                Response.Redirect("~/Login.aspx");

                //TestLabel.Text = Convert.ToString(alarmId);
            }
        }
Ejemplo n.º 3
0
 protected void Timer1_Tick(object sender, EventArgs e)
 {
     //1. get the alarm id from RabbitMQ
     int passedId = 0;
     passedId = attend.GetMQAlarmID();
     if(passedId!= 0)
     {
         alarmId = passedId;
         alarm = alarmService.getAlarmById(alarmId);
         //2. make a nice body to show the attendant the alarm situation
         PublishedAlarm.Text = alarm.Name + alarm.Location;
         SecretLabel.Text = Convert.ToString(alarmId);
     }
 }
        public List<Alarm> getAlarms()
        {
            List<Alarm> alarms = new List<Alarm>();

            if (System.Threading.Monitor.TryEnter(obj4, 10000))
            {
                try
                {

                    List<HealthCareModel.Object_Models.Alarm> returnList = AlarmControl.getAlarms();

                    if (returnList.Count != 0)
                    {
                        foreach (HealthCareModel.Object_Models.Alarm alarmHost in returnList)
                        {
                            Alarm serviceAlarm = new Alarm();

                            serviceAlarm.Name = alarmHost.name;
                            serviceAlarm.Time = Convert.ToString(alarmHost.time);
                            serviceAlarm.Type = alarmHost.type;
                            serviceAlarm.Location = alarmHost.location;
                            serviceAlarm.Status = alarmHost.status;

                            alarms.Add(serviceAlarm);
                        }
                    }
                }
                catch (NullReferenceException)
                {
                }
                finally
                {
                    System.Threading.Monitor.Exit(obj4);
                }
            }

            return alarms;
        }