public MSI_MessageNotification AddMessageNotification(MSI_MessageNotification notification) { string thisMethod = string.Format("{0}.{1}", thisClass, System.Reflection.MethodBase.GetCurrentMethod().Name); string logMessage = string.Format("{0}|Method incoming parameters RecipientUserId={1}", thisMethod, notification.RecipientUserId); LogHelper.Info(logMessage); MSI_MessageNotificationRepository repository = new MSI_MessageNotificationRepository(); try { repository.Add(notification); } catch (Exception ex) { ErrorLogHelper.Error(logMessage, ex); } return notification; }
public void SaveMessageNotification(NotificationMessage message, List<string> recipientsUserIds) { string thisMethod = string.Format("{0}.{1}", thisClass, System.Reflection.MethodBase.GetCurrentMethod().Name); string logMessage = string.Format("{0}|Method incoming parameters Notification Subject={1}", thisMethod, message.Subject); LogHelper.Info(logMessage); MSI_MessageNotification notification = null; try { foreach (string recipentUserId in recipientsUserIds) { notification = new MSI_MessageNotification(); notification.Id = Guid.NewGuid(); notification.RecipientUserId = Guid.Parse(recipentUserId); notification.Subject = message.Subject; notification.Body = message.BodyText; notification.SentOn = DateTime.Now; notification.IsActive = true; Query.AddMessageNotification(notification); notification = null; } } catch (Exception ex) { ErrorLogHelper.Error(logMessage, ex); } }