public void SendNotification(NotificationType notificationType, EmployeDto loggedEmploye, long targetEmployeId, UpdatePlanResponse response, string serverLink) { var targetEmploye = _employeService.GetWithArea(targetEmployeId); if (SendNotification(notificationType, loggedEmploye, targetEmploye, response)) { var param = new ApprovationMailParams(notificationType, serverLink, new[] { GetRecipients(targetEmploye) }, GetNotificationMessage(response), GetSender(loggedEmploye)); SendMail(param).ConfigureAwait(false); } }
private async Task Execute() { try { var leaves = _jobRepository.GetNotApprovedLeaves(); if (leaves.Any()) { var managers = _jobRepository.GetManagers(); var param = new ApprovationMailParams(NotificationType.Alert, GetServerLink(), GetRecipients(managers), GetNotificationMessage(leaves)); await SendMail(param); } } catch (Exception ex) { _log.LogError(1, ex, "An error occurred during execution of notifications job"); } }