示例#1
0
        /// <summary>
        /// Add new notification to the database
        /// </summary>
        /// <param name="notificationDTO">NotificationDTO object</param>
        /// <returns>Task<int></returns>
        public async Task<int> AddNewNotification(NotificationDTO notificationDTO)
        {
            using (loggingHelper.RMTraceManager.StartTrace("Business.AddNewNotification"))
            {
                string methodName = MethodHelper.GetActualAsyncMethodName();
                loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationBusinessServiceMethodEntryEventId, LoggerTraceConstants.Title);

                try
                {
                    NotificationDataDTO notificationDataDTO = new NotificationDataDTO
                    {
                        ID = notificationDTO.ID,
                        Notification_Heading = notificationDTO.Notification_Heading,
                        Notification_Message = notificationDTO.Notification_Message,
                        NotificationDueDate = notificationDTO.NotificationDueDate,
                        NotificationActionLink = notificationDTO.NotificationActionLink,
                        NotificationSource = notificationDTO.NotificationSource,
                        PostcodeDistrict = notificationDTO.PostcodeDistrict,
                        PostcodeSector = notificationDTO.PostcodeSector,
                        NotificationTypeGUID = notificationDTO.NotificationType_GUID,
                        NotificationPriorityGUID = notificationDTO.NotificationPriority_GUID
                    };

                    return await notificationDataService.AddNewNotification(notificationDataDTO);
                }
                finally
                {
                    loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationBusinessServiceMethodExitEventId, LoggerTraceConstants.Title);
                }
            }
        }