public void EmailTester()
        {
            var alerterObj = new EmailAlertService();
            var email      = new VitalAlertEmailFormat("Ambani", "100", "ICU01", 01, "WARNING");
            var response   = alerterObj.SendEmailVitalAlert(email);

            Assert.Equal(HttpStatusCode.OK, response);
        }
        public void EmailAlertControllerTest()
        {
            var alterter         = new EmailAlertService();
            var aleterController = new AlertServiceController(alterter);
            var email            = new VitalAlertEmailFormat("Test", "100", "ICU01", 01, "EMERGENCY");
            var response         = aleterController.SendEmailAlert(email);

            Assert.Equal(HttpStatusCode.OK, response);
        }
 protected async Task CrtOrUptEmailAlert()
 {
     if (NotificationId > 0)
     {
         await EmailAlertService.UpdateAsync(EmailAlertCrtVM);
     }
     else
     {
         await EmailAlertService.CreateAsync(EmailAlertCrtVM);
     }
     navigationManager.NavigateTo("/emailalerts");
 }
        protected async override Task OnInitializedAsync()
        {
            if (!string.IsNullOrEmpty(Id))
            {
                var id = int.Parse(Id);
                if (id > 0)
                {
                    EmailAlertCrtVM = await EmailAlertService.FetchByIdAsync(id);

                    NotificationId = EmailAlertCrtVM.Id;
                }
            }
        }
        protected async Task DeleteEmailAlert(int id)
        {
            bool?result = await DialogService.Confirm("Are you sure?", "DELETE  EMAIL ALERT", new ConfirmOptions()
            {
                OkButtonText = "Yes", CancelButtonText = "No", ShowClose = false
            });

            if (result.Value == true)
            {
                var deletedNotification = await EmailAlertService.DeleteAsync(id);

                if (deletedNotification > 0)
                {
                }
                else
                {
                }
            }
        }
 public void AlertFor(ServerStatus serverStatus)
 {
     if (Properties.Settings.Default.EnableAlerts)
     {
         // Spawning new thread for MessageBox in order not to block parsing thread.
         Thread t = new Thread(() => MessageBox.Show(string.Format("Server {0} is now available.", serverStatus.Name),
                                                     "Server available",
                                                     MessageBoxButtons.OK,
                                                     MessageBoxIcon.Information));
         t.Start();
     }
     else if (Properties.Settings.Default.EnableEmailAlerts)
     {
         IEmailAlertService emailAlertService = new EmailAlertService();
         emailAlertService.SendEmailAlert(serverStatus, Properties.Settings.Default.Email);
     }
     else
     {
         Log.Info("An alert for " + serverStatus.Name + " was triggered, but no alert was enabled.");
     }
 }
 protected async override Task OnInitializedAsync()
 {
     EmailAlertVMs = await EmailAlertService.FetchAllAsync();
 }