public static bool ProcessMessages(EventMessageCollection eventMessages)
        {
            EventMessage message;

            for (int messageNo = 0; messageNo <= eventMessages.Count - 1; messageNo++)
            {
                message = eventMessages[messageNo];
                try
                {
                    object oMessageProcessor = Framework.Reflection.CreateObject(message.ProcessorType, message.ProcessorType);
                    if (!((EventMessageProcessorBase)oMessageProcessor).ProcessMessage(message))
                    {
                        throw new Exception();
                    }
                    DataProvider.Instance().SetEventMessageComplete(message.EventMessageID);
                }
                catch
                {
                    Services.Log.EventLog.EventLogController objEventLog     = new Services.Log.EventLog.EventLogController();
                    Services.Log.EventLog.LogInfo            objEventLogInfo = new Services.Log.EventLog.LogInfo();
                    objEventLogInfo.AddProperty("EventQueue.ProcessMessage", "Message Processing Failed");
                    objEventLogInfo.AddProperty("ProcessorType", message.ProcessorType);
                    objEventLogInfo.AddProperty("Body", message.Body);
                    objEventLogInfo.AddProperty("Sender", message.Sender);
                    foreach (string key in message.Attributes.Keys)
                    {
                        objEventLogInfo.AddProperty(key, message.Attributes[key]);
                    }
                    if (!String.IsNullOrEmpty(message.ExceptionMessage))
                    {
                        objEventLogInfo.AddProperty("ExceptionMessage", message.ExceptionMessage);
                    }
                    objEventLogInfo.LogTypeKey = CommonLibrary.Services.Log.EventLog.EventLogController.EventLogType.HOST_ALERT.ToString();
                    objEventLog.AddLog(objEventLogInfo);
                    if (message.ExpirationDate < DateTime.Now)
                    {
                        DataProvider.Instance().SetEventMessageComplete(message.EventMessageID);
                    }
                }
            }
            return(true);
        }
 private static EventMessageCollection FillMessageCollection(IDataReader dr)
 {
     EventMessageCollection arr = new EventMessageCollection();
     try
     {
         EventMessage obj;
         while (dr.Read())
         {
             obj = FillMessage(dr, false);
             arr.Add(obj);
         }
     }
     catch (Exception exc)
     {
         Exceptions.Exceptions.LogException(exc);
     }
     finally
     {
         CBO.CloseDataReader(dr, true);
     }
     return arr;
 }
        private static EventMessageCollection FillMessageCollection(IDataReader dr)
        {
            EventMessageCollection arr = new EventMessageCollection();

            try
            {
                EventMessage obj;
                while (dr.Read())
                {
                    obj = FillMessage(dr, false);
                    arr.Add(obj);
                }
            }
            catch (Exception exc)
            {
                Exceptions.Exceptions.LogException(exc);
            }
            finally
            {
                CBO.CloseDataReader(dr, true);
            }
            return(arr);
        }
 public static bool ProcessMessages(EventMessageCollection eventMessages)
 {
     EventMessage message;
     for (int messageNo = 0; messageNo <= eventMessages.Count - 1; messageNo++)
     {
         message = eventMessages[messageNo];
         try
         {
             object oMessageProcessor = Framework.Reflection.CreateObject(message.ProcessorType, message.ProcessorType);
             if (!((EventMessageProcessorBase)oMessageProcessor).ProcessMessage(message))
             {
                 throw new Exception();
             }
             DataProvider.Instance().SetEventMessageComplete(message.EventMessageID);
         }
         catch
         {
             Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
             Services.Log.EventLog.LogInfo objEventLogInfo = new Services.Log.EventLog.LogInfo();
             objEventLogInfo.AddProperty("EventQueue.ProcessMessage", "Message Processing Failed");
             objEventLogInfo.AddProperty("ProcessorType", message.ProcessorType);
             objEventLogInfo.AddProperty("Body", message.Body);
             objEventLogInfo.AddProperty("Sender", message.Sender);
             foreach (string key in message.Attributes.Keys)
             {
                 objEventLogInfo.AddProperty(key, message.Attributes[key]);
             }
             if (!String.IsNullOrEmpty(message.ExceptionMessage))
             {
                 objEventLogInfo.AddProperty("ExceptionMessage", message.ExceptionMessage);
             }
             objEventLogInfo.LogTypeKey = CommonLibrary.Services.Log.EventLog.EventLogController.EventLogType.HOST_ALERT.ToString();
             objEventLog.AddLog(objEventLogInfo);
             if (message.ExpirationDate < DateTime.Now)
             {
                 DataProvider.Instance().SetEventMessageComplete(message.EventMessageID);
             }
         }
     }
     return true;
 }