public bool InsertAlertDetails(AlertDetails alertObj) { try { return(VSWebDAL.ConfiguratorDAL.AlertsDAL.Ins.InsertAlertDetails(alertObj)); } catch (Exception ex) { throw ex; } }
public Object DeleteHoursData(AlertDetails AlertObj) { try { return(VSWebDAL.ConfiguratorDAL.AlertsDAL.Ins.DeleteAlertDetails(AlertObj)); } catch (Exception) { throw; } }
public void getAlertsForASpecifiedUserTest() { Mock <IDatabaseQueryService> mockDBService = new Mock <IDatabaseQueryService>(MockBehavior.Strict); mockDBService.Setup(x => x.GetAllAlerts(1)).Returns(dbAlerts); AlertService alertService = new AlertService(mockDBService.Object, new CameraService(mockDBService.Object, new GraphStatisticService(mockDBService.Object), new LocationService(mockDBService.Object)), new NotificationService(mockDBService.Object)); AlertDetails alertDetails = new AlertDetails(dbAlerts[0]); Assert.That(alertService.GetAllAlertsForUser(1)[0].AlertId, Is.EqualTo(1)); }
public void createAlertTest() { Mock <IDatabaseQueryService> mockDBService = new Mock <IDatabaseQueryService>(MockBehavior.Strict); mockDBService.Setup(x => x.PersistNewAlert(It.Is <DatabaseAlert>(p => p.CameraId == 1))).Returns(true); AlertService alertService = new AlertService(mockDBService.Object, new CameraService(mockDBService.Object, new GraphStatisticService(mockDBService.Object), new LocationService(mockDBService.Object)), new NotificationService(mockDBService.Object)); AlertDetails alertDetails = new AlertDetails(dbAlerts[1]); Assert.That(alertService.SaveAlert(alertDetails), Is.True); mockDBService.Verify(m => m.PersistExistingAlert(It.IsAny <DatabaseAlert>()), Times.Never); }
public bool SaveAlert(AlertDetails alertDetails) { DatabaseAlert dbAlert = new DatabaseAlert(alertDetails); dbAlert.EscapeStringFields(); if (alertDetails.AlertId != 0) { return(_dbQueryService.PersistExistingAlert(dbAlert)); } else { return(_dbQueryService.PersistNewAlert(dbAlert)); } }
public IActionResult SaveAlert(AlertDetails alertDetails) { int?currentUsedId = HttpContext.Session.GetInt32("currentUserId"); if (currentUsedId != null) { alertDetails.UserId = currentUsedId.Value; AlertService.SaveAlert(alertDetails); } else { return(RedirectToAction("SignIn", "Home")); } return(RedirectToAction("Index", "Alert")); }
public DatabaseAlert(AlertDetails cameraDetails) { AlertId = cameraDetails.AlertId; AlertName = cameraDetails.AlertName; CameraId = cameraDetails.CameraId; UserId = cameraDetails.UserId; ContactMethod = Enum.GetName(typeof(ContactMethod), cameraDetails.ContactMethod); TriggerOperator = Enum.GetName(typeof(TriggerOperator), cameraDetails.TriggerOperator); TriggerNumber = cameraDetails.TriggerNumber; AlwaysActive = cameraDetails.AlwaysActive; StartTime = cameraDetails.StartTime.ToString("HH:mm"); EndTime = cameraDetails.EndTime.ToString("HH:mm"); if (cameraDetails.DisabledUntil != null) { DisabledUntil = cameraDetails.DisabledUntil; } if (cameraDetails.SnoozedUntil != null) { SnoozedUntil = cameraDetails.SnoozedUntil; } }
public CodebaseAlert AddDetail(string detailFormatted, params string[] parameters) { AlertDetails.Add(detailFormatted); return(this); }