protected void panicButton_Click(object sender, EventArgs e)
        {
            string userName    = Page.User.Identity.Name;
            int    publisherId = Convert.ToInt32(userName);

            //1. get the publisher data to use for the alarm he declares
            HealthCareWCFServices.AlarmPublisher alarmPublisher = publisherService.getAlarmPublisher(publisherId);
            //2. create the alarm
            alarmService.createAlarm(alarmPublisher.PacientName + " started an alarm " + DateTime.Now.ToLongTimeString(), "Pacient situation: " + alarmPublisher.Condition, "at " + alarmPublisher.Location, "started");
            //3. retrieve the fresh alarm id
            int alarmId = alarmService.getMaxId();

            //4. add an entry in the PublishedAlarms table
            extendedService.createPublishedAlarm(alarmId, publisherId);
            //5. RabbitMQ part to send the alarmId to the Alarm Receiver program
            PanicButton.SendAlarmIdMQ(alarmId);
        }
Exemple #2
0
        protected void PublisherLogin_Authenticate(object sender, AuthenticateEventArgs e)
        {
            string username    = PublisherLogin.UserName.ToString();
            string password    = PublisherLogin.Password.ToString();
            int    publisherId = Convert.ToInt32(username);

            HealthCareWCFServices.AlarmPublisher targetPublisher = publisherService.getAlarmPublisher(publisherId);

            if (targetPublisher.Password == null)
            {
                PublisherLogin.FailureText = "That username is not registereded.";
            }
            else
            {
                if (targetPublisher.Password.Equals(password) != true)
                {
                    PublisherLogin.FailureText = "Password is not correct.";
                }
                else
                {
                    FormsAuthentication.RedirectFromLoginPage(PublisherLogin.UserName, PublisherLogin.RememberMeSet);
                }
            }
        }