public async Task <AlertTypeDto> PutAlertType(int id, AlertTypeDto model) { var url = CRMApiUri + "/AlertType/" + id; var result = await PutRequestToApi(url, model); return(result); }
public async Task <BaseEntity> SaveAndReturnEntityAsync(AlertTypeDto entityDto) { var entity = _mapper.Map <AlertType>(entityDto); var result = await _repository.SaveAndReturnEntityAsync(entity); return(result); }
public async Task <AlertTypeDto> PostAlertType(AlertTypeDto model) { var url = CRMApiUri + "/AlertType"; var result = await PostRequestToApi(url, model); return(result); }
public async Task <IActionResult> Post([FromBody] AlertTypeDto alertType) { if (alertType.Id != 0) { return(StatusCode(StatusCodes.Status400BadRequest, "Identity insert is not permitted.")); } return(await SaveAndReturnEntityAsync(async() => await _AlertTypeService.SaveAndReturnEntityAsync(alertType))); }
public async Task <IActionResult> Put(int id, [FromBody] AlertTypeDto alertType) { if (id == 0 || alertType.Id == 0) { return(StatusCode(StatusCodes.Status400BadRequest, "Id needs to be greater than 0.")); } return(await SaveAndReturnEntityAsync(async() => await _AlertTypeService.SaveAndReturnEntityAsync(alertType))); }
public AlertIntervals(AlertSettingsDto service, AlertTypeDto alertType) { var item = service.AlertRules.FirstOrDefault(x => x.AlertType == alertType); if (item != null) { var notificationTime = item.ThresholdTime; CriticalNotification = TimeSpan.FromSeconds(notificationTime); } }
public AlertThreshold(AlertSettingsDto service, AlertTypeDto alertType) { var item = service.AlertRules.FirstOrDefault(x => x.AlertType == alertType); if (item != null) { var critical = item.Percentage; CriticalLoad = critical; } }
public Notifier(TimeSpan interval, IEventService eventService, ISmtpClient client, IFile file, ILogger logger, AlertTypeDto type) { Interval = interval; EventService = eventService; SmtpClient = client; File = file; Logger = logger; Sendy = new EmailSender(file, logger, client); AlertType = type; }
public AlertIntervals(AlertSettingsDto service, AlertTypeDto alertType) { var item = service.AlertRules.FirstOrDefault(x => x.AlertType == alertType); if (item != null) { var notificationTime = item.ThresholdTime; CriticalNotification = TimeSpan.FromSeconds(notificationTime); } }
public Notifier(TimeSpan interval, IEventService eventService, ISmtpClient client, IFile file, ILogger logger, AlertTypeDto type) { Interval = interval; EventService = eventService; SmtpClient = client; File = file; Logger = logger; Sendy = new EmailSender(file, logger, client); AlertType = type; }
public AlertThreshold(AlertSettingsDto service, AlertTypeDto alertType) { var item = service.AlertRules.FirstOrDefault(x => x.AlertType == alertType); if (item != null) { var critical = item.Percentage; CriticalLoad = critical; } }
private string ConvertEvent(AlertTypeDto type) { switch (type) { case AlertTypeDto.Cpu: return(EventName.CpuEvent); case AlertTypeDto.Network: return(EventName.NetworkEvent); case AlertTypeDto.Hdd: return(EventName.HddSpaceEvent); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public IActionResult Save(AlertTypeDto model) { UpdateAuditInformation(model); if (!ModelState.IsValid) { GetStateSettings(ViewState.Write); return(PartialView("Edit", model)); } model = model.Id > 0 ? _lookupFacadeApiClient.PutAlertType(model.Id, model).Result : _lookupFacadeApiClient.PostAlertType(model).Result; if (!string.IsNullOrWhiteSpace(model.ErrorMessage)) { return(PartialView("Edit", model)); } return(Json(new { message = model.SuccessMessage })); }
public async Task <int> SaveAsync(AlertTypeDto entityDto) { var result = await SaveAndReturnEntityAsync(entityDto); return(result.Id); }
private string ConvertEvent(AlertTypeDto type) { switch (type) { case AlertTypeDto.Cpu: return EventName.CpuEvent; case AlertTypeDto.Network: return EventName.NetworkEvent; case AlertTypeDto.Hdd: return EventName.HddSpaceEvent; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public ConfigurationReader(ISettingsService<AlertSettingsDto> settings, AlertTypeDto alertType) { Settings = settings; AlertType = alertType; }
public async Task <AlertTypeDto> PutAlertType(int id, AlertTypeDto model) { return(await _alertTypeApiClient.PutAlertType(id, model)); }
public async Task <AlertTypeDto> PostAlertType(AlertTypeDto model) { return(await _alertTypeApiClient.PostAlertType(model)); }
public ConfigurationReader(ISettingsService <AlertSettingsDto> settings, AlertTypeDto alertType) { Settings = settings; AlertType = alertType; }