/// <summary> /// Get Email notification list /// </summary> /// <param name="notifyEmailAddressList"></param> /// <returns></returns> private List <INotifyObject> GetNotificationList(NotifyPagerAddressList notifyPagerAddressList, AlarmObject alarmObject) { List <INotifyObject> notifyList = new List <INotifyObject>(); NotificationStyle notificationStyle = new NotificationStyle(); foreach (NotifyPagerAddress notifyPagerAddress in notifyPagerAddressList) { /*Check for Notification Pager Address and exit the sending process, if NotificationPagerAddress object is NULL*/ if (notifyPagerAddress != null) { /*Get Notification Object*/ //if (notifyPagerAddress.DeliveryMethod == 1) // DeliveryMethod 0 = Modem 1 = SNPP //{ /*Get SNPP notify settings*/ if (GetNotifySNPPObject(alarmObject, notifyPagerAddress) != null) { notifyList.Add(GetNotifySNPPObject(alarmObject, notifyPagerAddress)); } //} } else { /*Record notification if Email Address parameters are not supplied properly*/ notificationStyle.RecordNotification(ErrorMessages.PagerComposer_SNPPParmsNotSupplied, alarmObject.NotificationID, 0, NotifyStatus.FAIL, NotifyTypes.PAGER); } } return(notifyList); }
public INotifyObject[] Compose(AlarmObject alarmObject) { NotifyPagerAddressList notifyPagerAddressList = null; List <INotifyObject> notifyObjectList = null; if (alarmObject.IsMissCommNotification) { _logContent = "Missed Communication"; } else { _logContent = "SensorID: " + alarmObject.UTID.ToStr() + " SensorAlarmID: " + alarmObject.SensorAlarmID.ToStr(); } /*Write Log: * Started Pager Notification * Reached Pager Notification Composer*/ LogBook.Write("*** Started Composing Pager Notification for " + _logContent + "***"); try { /*Get Pager Address List*/ notifyPagerAddressList = GetPagerAddressList(alarmObject); LogBook.Debug("NotifyPagerAddressList count: " + notifyPagerAddressList.Count.ToStr()); /*Get notification List*/ notifyObjectList = GetNotificationList(notifyPagerAddressList, alarmObject); LogBook.Debug("NotifyObjectList count: " + notifyObjectList.Count.ToStr()); } catch (Exception ex) { /*Write exception log*/ if (_logContent.Trim() != string.Empty) { LogBook.Write(_logContent); } LogBook.Write(ex, "CooperAtkins.NotificationClient.NotificationComposer.PagerNotificationComposer"); } if (notifyObjectList.Count > 0) { /*Write Log * Sending Pager notification data to Notification Engine*/ LogBook.Write(_logContent + " Sending notification data to Pager Notification Engine."); } for (int index = notifyObjectList.Count - 1; index >= 0; index--) { INotifyObject notifyObject = notifyObjectList[index]; /*if the pager type is digital then add it to the queue, removing from the current list (queue will be processed separately)*/ if (notifyObject.NotifierSettings["DeliveryMethod"].ToInt() != 1) { DigitalPagerHelper.DigitalPagerQueue.Add(notifyObject); notifyObjectList.Remove(notifyObject); new NotificationStyle().RecordNotification("Page queued: " + notifyObject.NotifierSettings["ToAddress"].ToStr() + ", Message:" + notifyObject.NotifierSettings["PagerMessage"].ToStr(), notifyObject.NotifierSettings["NotificationID"].ToInt(), 0, NotifyStatus.STATUS, NotifyTypes.PAGER); } } return(notifyObjectList.ToArray()); }
/// <summary> /// Get Pager Notification Address List /// </summary> /// <param name="alarmObject"></param> /// <returns></returns> private NotifyPagerAddressList GetPagerAddressList(Interface.Alarm.AlarmObject alarmObject) { NotifyPagerAddressList notifyPagerAddressList = null; try { /*Fetch Email Address list based on Notification Profile ID*/ notifyPagerAddressList = new NotifyPagerAddressList(); Criteria criteria = new Criteria(); criteria.ID = GetPagerNotificationID(alarmObject.NotifyProfileID);//Replace with notifyPagerAddressList.Load(criteria); } catch (Exception ex) { /*Debug Object values for reference*/ LogBook.Debug(notifyPagerAddressList, this); /*Write exception log*/ LogBook.Write(_logContent + " Error has occurred while fetching pager address list from 'GenNotifyPagers' table", ex, "CooperAtkins.NotificationClient.NotificationComposer.PagerNotificationComposer"); } finally { notifyPagerAddressList.Dispose(); } return(notifyPagerAddressList); }