public void GetDumyUserIFANotifications(tdsEventNotification o_tdsEventNotification, string EventIFASubscriberNotificationAddress)
 {
     try
     {
         for (int i = 0; i < 10; i++)
         {
             var x = o_tdsEventNotification.UserIFANotifications.NewUserIFANotificationsRow();
             x.EventIFANotificationBody              = "Test" + i;
             x.EventIFANotificationID                = i;
             x.EventIFANotificationTitle             = "Test" + i;
             x.EventIFASubscriberID                  = i;
             x.EventIFASubscriberNotificationAddress = "Notify_User#1248";
             x.EventMessageID            = i;
             x.EventMessageStatus        = i;
             x.ExpiryDate                = DateTime.Now;
             x.FirstParentEventmessageID = i;
             x.ParentEventMessageID      = i;
             x._EventMessagesStatusID    = i;
             x.EventIFANotificationID    = i;
             o_tdsEventNotification.UserIFANotifications.AddUserIFANotificationsRow(x);
         }
     }
     catch
     {
         throw;
     }
     finally
     {
     }
 }
        public void GetNotifications(string notificationKey)
        {
            tdsEventNotification    oTdsEventNotification   = new tdsEventNotification();
            dmSendEventNotification dmSendEventNotification = new dmSendEventNotification();

            //dmSendEventNotification.GetUserIFANotifications(oTdsEventNotification, notificationKey);
            dmSendEventNotification.GetDumyUserIFANotifications(oTdsEventNotification, notificationKey);

            Dictionary <int, List <tdsEventNotification.UserIFANotificationsRow> > notificationMessages = new Dictionary <int, List <tdsEventNotification.UserIFANotificationsRow> >();

            foreach (var userIfaNotificationsRow in oTdsEventNotification.UserIFANotifications)
            {
                if (notificationMessages.ContainsKey(userIfaNotificationsRow.FirstParentEventmessageID))
                {
                    notificationMessages[userIfaNotificationsRow.FirstParentEventmessageID].Add(userIfaNotificationsRow);
                }
                else
                {
                    List <tdsEventNotification.UserIFANotificationsRow> parentList = new List <tdsEventNotification.UserIFANotificationsRow>();
                    parentList.Add(userIfaNotificationsRow);
                    notificationMessages.Add(userIfaNotificationsRow.FirstParentEventmessageID, parentList);
                }
            }

            var notificationsArray =
                notificationMessages.Select(
                    userMessage => userMessage.Value.OrderByDescending(c => c.EventIFANotificationID).FirstOrDefault())
                .ToArray();

            List <NotificationMessage> notificationMessageList = new List <NotificationMessage>();

            foreach (var notification in notificationsArray)
            {
                Dictionary <string, string> bodyDictionary = notification.Table.Columns
                                                             .Cast <DataColumn>()
                                                             .ToDictionary(c => c.ColumnName, c => notification[c].ToString());

                notificationMessageList.Add(new NotificationMessage()
                {
                    BodyDictionary = bodyDictionary, MessageAction = MessageAction.Insert, NotificationKey = notificationKey
                });
            }

            new Task(() => { PublishNotifications(notificationMessageList.ToArray()); }).Start();
        }
        public void GetUserIFANotifications(tdsEventNotification o_tdsEventNotification, string EventIFASubscriberNotificationAddress)
        {
            try
            {
                using (daGetUserIFANotifications.SelectCommand.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["EventsDB"].ConnectionString))
                {
                    daGetUserIFANotifications.SelectCommand.Parameters["@EventIFASubscriberNotificationAddress"].Value = EventIFASubscriberNotificationAddress;

                    daGetUserIFANotifications.Fill(o_tdsEventNotification.UserIFANotifications);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
            }
        }