/// <summary>
        /// Get Sms notification list
        /// </summary>
        /// <param name="notifySmsAddressList"></param>
        /// <returns></returns>
        private List <INotifyObject> GetNotificationList(NotifyMobileList notifyMobileList, AlarmObject alarmObject, GenStoreInfo genStoreInfo)
        {
            List <INotifyObject> notifyList        = new List <INotifyObject>();
            NotificationStyle    notificationStyle = new NotificationStyle();

            foreach (NotifyMobiles notifyMobiles in notifyMobileList)
            {
                /*Check for Notification Sms Address and exit the sending process, if NotificationSmsAddress object is NULL*/
                if (notifyMobiles != null)
                {
                    /*Get Notification Object*/
                    INotifyObject notifyObject = GetNotifyObject(alarmObject, genStoreInfo, notifyMobiles);

                    if (notifyObject.NotifierSettings["ToPhoneNumber"].ToStr() == string.Empty || notifyObject.NotifierSettings["COMSettings"].ToStr() == string.Empty)
                    {
                        LogBook.Write("Missing mobile number or COM Settings");
                        /*Record notification if Sms parameters are not supplied properly*/
                        notificationStyle.RecordNotification(ErrorMessages.SMSComposer_InvalidSettings, notifyObject.NotifierSettings["NotificationID"].ToInt(), 0, NotifyStatus.FAIL, NotifyTypes.SMS);
                    }
                    else
                    {
                        //Add notification object to array list
                        notifyList.Add(notifyObject);
                    }
                }
                else
                {
                    /*Record notification if Sms parameters are not supplied properly*/
                    notificationStyle.RecordNotification(ErrorMessages.SMSComposer_InvalidSettings, alarmObject.NotificationID, 0, NotifyStatus.FAIL, NotifyTypes.SMS);
                }
            }
            return(notifyList);
        }
        /// <summary>
        /// Get Notification E-Mail Address list based on Notification Profile ID
        /// </summary>
        /// <param name="alarmObject"></param>
        /// <returns></returns>
        private NotifyMobileList GetNotifyMoibilesList(int notifyProfileID)
        {
            NotifyMobileList notifyMobileList = null;

            try
            {
                LogBook.Write("Fetching Mobile notify ID list");
                /*Create NotifySmsAddressList object*/
                notifyMobileList = new NotifyMobileList();
                /*Create Criteria object*/
                Criteria criteria = new Criteria();
                /*Get the Sms notificationId and assign to criteria.ID*/
                criteria.ID = GetMobileNotificationID(notifyProfileID);
                /*Gets list of notification sms addresses*/
                notifyMobileList.Load(criteria);

                LogBook.Write("Notify Mobile ID list count: " + notifyMobileList.Count);
            }
            catch (Exception ex)
            {
                /*Debug Object values for reference*/
                LogBook.Debug(notifyMobileList, this);

                /*Write exception log*/
                LogBook.Write("Error has occurred while fetching mobile numbers list from 'GenNotifySms' table", ex, "CooperAtkins.NotificationClient.NotificationComposer.SMSNotificationComposer");
            }
            finally
            {
                notifyMobileList.Dispose();
            }
            return(notifyMobileList);
        }
        public INotifyObject[] Compose(AlarmObject alarmObject)
        {
            GenStoreInfo         genStoreInfo      = null;
            NotifyMobileList     notifyMobileList  = null;
            List <INotifyObject> notifyList        = new List <INotifyObject>();
            NotificationStyle    notificationStyle = new NotificationStyle();

            LogBook.Write("Executing Compose method");


            /*Get GenStore Information*/
            genStoreInfo = GenStoreInfo.GetInstance();

            try
            {
                //If there's no record in the database, Execute method will return null
                if (genStoreInfo != null)
                {
                    /*Record notification if SMTP settings are not supplied properly*/
                    //if (genStoreInfo.SmtpServer.ToStr() != string.Empty && genStoreInfo.SmtpSendMethod != 0)
                    //if ((genStoreInfo.ToPhoneNumber == string.Empty && genStoreInfo.SmtpAuthDomain == string.Empty) && genStoreInfo.SmtpSendMethod == 0)
                    //{
                    //    /*SMTP server not defined*/
                    //    LogBook.Write("Error: No SMTP Server has been defined");

                    //    /*Record notification if SMTP parameters are not supplied properly*/
                    //    notificationStyle.RecordNotification(ErrorMessages.SmsComposer_SMTPParmsNotSupplied, _alarmObject.NotificationID, NotifyStatus.FAIL, NotifyTypes.SMS);

                    //}
                    //else
                    //{
                    LogBook.Write("Fetching notify Mobiles List");
                    /*Get all the sms addresses that are configured for notification*/
                    notifyMobileList = GetNotifyMoibilesList(alarmObject.NotifyProfileID);
                    LogBook.Write("Notify Mobile List Count: " + notifyMobileList.Count.ToString());
                    if (notifyMobileList.Count != 0)
                    {
                        LogBook.Write("Constructing notify list objects");
                        /*Construct a notification object for each sms number and add to the notification list*/
                        notifyList = GetNotificationList(notifyMobileList, alarmObject, genStoreInfo);


                        for (int index = notifyList.Count - 1; index >= 0; index--)
                        {
                            INotifyObject notifyObject = notifyList[index];
                            SmsHelper.SmsQueue.Add(notifyObject);
                            notifyList.Remove(notifyObject);
                            new NotificationStyle().RecordNotification("Sms queued: " + notifyObject.NotifierSettings["ToPhoneNumber"].ToStr(), notifyObject.NotifierSettings["NotificationID"].ToInt(), 0, NotifyStatus.STATUS, NotifyTypes.SMS);
                        }


                        LogBook.Write("Notify list objects count: " + notifyList.Count);
                    }
                    else
                    {
                        /*Log when we don't have sms address to notify*/
                        LogBook.Write("Error: Missing entry in NotifySms/Groups");
                    }
                    //}
                }
                else
                {
                    /*Record notification if genStore parameters are not supplied properly.*/
                    notificationStyle.RecordNotification(ErrorMessages.SMSComposer_InvalidSettings, alarmObject.NotificationID, 0, NotifyStatus.FAIL, NotifyTypes.SMS);

                    /*Log if genStore information is empty*/
                    LogBook.Write("Error:  Missing GenStores table record");
                }
            }
            catch (Exception ex)
            {
                /*Write exception log*/
                LogBook.Write(ex, "CooperAtkins.NotificationClient.NotificationComposer.SmsNotificationComposer");
            }

            /*Send notification list to notification engine*/
            return(notifyList.ToArray());
        }