private static void UpgradeModule(EventMessage message)
        {
            try
            {
                int desktopModuleId = Convert.ToInt32(message.Attributes["DesktopModuleId"]);
                var desktopModule = DesktopModuleController.GetDesktopModule(desktopModuleId, Null.NullInteger);

                string BusinessControllerClass = message.Attributes["BusinessControllerClass"];
                object controller = Reflection.CreateObject(BusinessControllerClass, "");
                if (controller is IUpgradeable)
                {
					//get the list of applicable versions
                    string[] UpgradeVersions = message.Attributes["UpgradeVersionsList"].Split(',');
                    foreach (string Version in UpgradeVersions)
                    {
						//call the IUpgradeable interface for the module/version
                        string Results = ((IUpgradeable) controller).UpgradeModule(Version);
                        //log the upgrade results
                        var log = new LogInfo {LogTypeKey = EventLogController.EventLogType.MODULE_UPDATED.ToString()};
                        log.AddProperty("Module Upgraded", BusinessControllerClass);
                        log.AddProperty("Version", Version);
                        if (!string.IsNullOrEmpty(Results))
                        {
                            log.AddProperty("Results", Results);
                        }
                        LogController.Instance.AddLog(log);
                    }
                }
                UpdateSupportedFeatures(controller, Convert.ToInt32(message.Attributes["DesktopModuleId"]));
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
            }
        }
        public override bool ProcessMessage( EventMessage message )
        {
            try
            {
                switch( message.Attributes["ProcessCommand"].ToString().ToUpper() )
                {
                    case "UPDATESUPPORTEDFEATURES":

                        UpdateSupportedFeatures( message );
                        break;
                    case "UPGRADEMODULE":

                        UpgradeModule( message );
                        break;
                    default:

                        break;
                }
            }
            catch( Exception ex )
            {
                message.ExceptionMessage = ex.Message;
                return false;
            }
            return true;
        }
        private EventMessage DeserializeMessage( string filePath, string subscriberId )
        {
            EventMessage message = new EventMessage();
            StreamReader oStreamReader = File.OpenText( filePath );
            string messageString = oStreamReader.ReadToEnd();
            if( messageString.IndexOf( "EventMessage" ) < 0 )
            {
                PortalSecurity oPortalSecurity = new PortalSecurity();
                messageString = oPortalSecurity.Decrypt( EventQueueConfiguration.GetConfig().EventQueueSubscribers[subscriberId].PrivateKey, messageString );
            }
            message.Deserialize( messageString );
            oStreamReader.Close();

            //remove the persisted message from the queue if it has expired
            if( message.ExpirationDate < DateTime.Now )
            {
                File.Delete( filePath );
            }

            return message;
        }
        private static EventMessage FillMessage(IDataReader dr, bool CheckForOpenDataReader)
        {
            EventMessage message;

            //read datareader
            bool canContinue = true;
            if (CheckForOpenDataReader)
            {
                canContinue = false;
                if (dr.Read())
                {
                    canContinue = true;
                }
            }
            if (canContinue)
            {
                message = new EventMessage();
                message.EventMessageID = Convert.ToInt32(Null.SetNull(dr["EventMessageID"], message.EventMessageID));
                message.Priority = (MessagePriority) Enum.Parse(typeof (MessagePriority), Convert.ToString(Null.SetNull(dr["Priority"], message.Priority)));
                message.ProcessorType = Convert.ToString(Null.SetNull(dr["ProcessorType"], message.ProcessorType));
                message.ProcessorCommand = Convert.ToString(Null.SetNull(dr["ProcessorCommand"], message.ProcessorCommand));
                message.Body = Convert.ToString(Null.SetNull(dr["Body"], message.Body));
                message.Sender = Convert.ToString(Null.SetNull(dr["Sender"], message.Sender));
                message.Subscribers = Convert.ToString(Null.SetNull(dr["Subscriber"], message.Subscribers));
                message.AuthorizedRoles = Convert.ToString(Null.SetNull(dr["AuthorizedRoles"], message.AuthorizedRoles));
                message.ExceptionMessage = Convert.ToString(Null.SetNull(dr["ExceptionMessage"], message.ExceptionMessage));
                message.SentDate = Convert.ToDateTime(Null.SetNull(dr["SentDate"], message.SentDate));
                message.ExpirationDate = Convert.ToDateTime(Null.SetNull(dr["ExpirationDate"], message.ExpirationDate));

                //Deserialize Attributes
                string xmlAttributes = Null.NullString;
                xmlAttributes = Convert.ToString(Null.SetNull(dr["Attributes"], xmlAttributes));
                message.DeserializeAttributes(xmlAttributes);
            }
            else
            {
                message = null;
            }
            return message;
        }
 private static void ImportModule(EventMessage message)
 {
     try
     {
         string BusinessControllerClass = message.Attributes["BusinessControllerClass"];
         object controller = Reflection.CreateObject(BusinessControllerClass, "");
         if (controller is IPortable)
         {
             int ModuleId = Convert.ToInt32(message.Attributes["ModuleId"]);
             string Content = HttpUtility.HtmlDecode(message.Attributes["Content"]);
             string Version = message.Attributes["Version"];
             int UserID = Convert.ToInt32(message.Attributes["UserId"]);
             //call the IPortable interface for the module/version
             ((IPortable) controller).ImportModule(ModuleId, Content, Version, UserID);
             //Synchronize Module Cache
             ModuleController.SynchronizeModule(ModuleId);
         }
     }
     catch (Exception exc)
     {
         Exceptions.LogException(exc);
     }
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Commit method finalises the Install and commits any pending changes.
        /// </summary>
        /// <remarks>In the case of Modules this is not neccessary</remarks>
        /// <history>
        /// 	[cnurse]	01/15/2008  created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void Commit()
        {
			//Add CodeSubDirectory
            if (!string.IsNullOrEmpty(_desktopModule.CodeSubDirectory))
            {
                Config.AddCodeSubDirectory(_desktopModule.CodeSubDirectory);
            }
            if (_desktopModule.SupportedFeatures == Null.NullInteger)
            {
                //Set an Event Message so the features are loaded by reflection on restart
                var oAppStartMessage = new EventMessage
                                        {
                                            Priority = MessagePriority.High,
                                            ExpirationDate = DateTime.Now.AddYears(-1),
                                            SentDate = DateTime.Now,
                                            Body = "",
                                            ProcessorType = "DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke",
                                            ProcessorCommand = "UpdateSupportedFeatures"
                                        };

                //Add custom Attributes for this message
                oAppStartMessage.Attributes.Add("BusinessControllerClass", _desktopModule.BusinessControllerClass);
                oAppStartMessage.Attributes.Add("desktopModuleID", _desktopModule.DesktopModuleID.ToString());

                //send it to occur on next App_Start Event
                EventQueueController.SendMessage(oAppStartMessage, "Application_Start_FirstRequest");
            }
			
			//Add Event Message
            if (_eventMessage != null)
            {
                if (!String.IsNullOrEmpty(_eventMessage.Attributes["UpgradeVersionsList"]))
                {
                    _eventMessage.Attributes.Set("desktopModuleID", _desktopModule.DesktopModuleID.ToString());
                    EventQueueController.SendMessage(_eventMessage, "Application_Start");
                }
            }
            
			//Add DesktopModule to all portals
			if (!_desktopModule.IsPremium)
            {
                DesktopModuleController.AddDesktopModuleToPortals(_desktopModule.DesktopModuleID);
            }
        }
        private void ReadEventMessageNode(XPathNavigator manifestNav)
        {
            XPathNavigator eventMessageNav = manifestNav.SelectSingleNode("eventMessage");
            if (eventMessageNav != null)
            {
                _eventMessage = new EventMessage();
                _eventMessage.Priority = MessagePriority.High;
                _eventMessage.ExpirationDate = DateTime.Now.AddYears(-1);
                _eventMessage.SentDate = DateTime.Now;
                _eventMessage.Body = "";
                _eventMessage.ProcessorType = Util.ReadElement(eventMessageNav, "processorType", Log, Util.EVENTMESSAGE_TypeMissing);
                _eventMessage.ProcessorCommand = Util.ReadElement(eventMessageNav, "processorCommand", Log, Util.EVENTMESSAGE_CommandMissing);
                foreach (XPathNavigator attributeNav in eventMessageNav.Select("attributes/*"))
                {
                    var attribName = attributeNav.Name;
                    var attribValue = attributeNav.Value;
                    if (attribName == "upgradeVersionsList")
                    {
                        if (!String.IsNullOrEmpty(attribValue))
                        {
                            string[] upgradeVersions = attribValue.Split(',');
                            attribValue = ""; foreach (string version in upgradeVersions)
                            {
                                Version upgradeVersion = null;
                                try
                                {
                                    upgradeVersion = new Version(version);
                                }
                                catch (FormatException)
                                {
                                    Log.AddWarning(string.Format(Util.MODULE_InvalidVersion, version));
                                }

                                if (upgradeVersion != null && upgradeVersion > Package.InstalledVersion && Globals.Status == Globals.UpgradeStatus.Upgrade) //To allow when upgrading to an upper version
                                {
                                    attribValue += version + ",";
                                }
                                else if (upgradeVersion != null && (Globals.Status == Globals.UpgradeStatus.Install || Globals.Status == Globals.UpgradeStatus.None)) //To allow when fresh installing or installresources
                                {
                                    attribValue += version + ",";                                    
                                }
                            }
                            attribValue = attribValue.TrimEnd(',');
                        }
                    }
                   _eventMessage.Attributes.Add(attribName, attribValue);
                }
            }
        }
        private void UpdateModuleInterfaces(string BusinessControllerClass)
        {
            //this cannot be done directly at this time because
            //the module may not be loaded into the app domain yet
            //So send an EventMessage that will process the update
            //after the App recycles
            var oAppStartMessage = new EventMessage
                                       {
                                           Sender = ModuleContext.PortalSettings.UserInfo.Username,
                                           Priority = MessagePriority.High,
                                           ExpirationDate = DateTime.Now.AddYears(-1),
                                           SentDate = DateTime.Now,
                                           Body = "",
                                           ProcessorType = "DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke",
                                           ProcessorCommand = "UpdateSupportedFeatures"
                                       };

            //Add custom Attributes for this message
            oAppStartMessage.Attributes.Add("BusinessControllerClass", BusinessControllerClass);
            oAppStartMessage.Attributes.Add("DesktopModuleId", DesktopModule.DesktopModuleID.ToString());

            //send it to occur on next App_Start Event
            EventQueueController.SendMessage(oAppStartMessage, "Application_Start");

            //force an app restart
            Config.Touch();
        }
 private void UpdateModuleInterfaces(string BusinessControllerClass)
 {
     //Check to see if Interfaces (SupportedFeatures) Need to be Updated
     if (BusinessControllerClass != "")
     {
         //this cannot be done directly at this time because 
         //the module may not be loaded into the app domain yet
         //So send an EventMessage that will process the update 
         //after the App recycles
         EventMessage oAppStartMessage = new EventMessage();
         oAppStartMessage.ProcessorType = "DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke";
         oAppStartMessage.Attributes.Add("ProcessCommand", "UpdateSupportedFeatures");
         oAppStartMessage.Attributes.Add("BusinessControllerClass", BusinessControllerClass);
         oAppStartMessage.Attributes.Add("DesktopModuleId", DesktopModuleId.ToString());
         oAppStartMessage.Priority = MessagePriority.High;
         oAppStartMessage.SentDate = DateTime.Now;
         oAppStartMessage.Body = "";
         //make it expire as soon as it's processed
         oAppStartMessage.ExpirationDate = DateTime.Now.AddYears(-1);
         //send it
         EventQueueController oEventQueueController = new EventQueueController();
         oEventQueueController.SendMessage(oAppStartMessage, "Application_Start");
         //force an app restart
         Config.Touch();
     }
 }
        public override bool ProcessMessage(EventMessage message)
        {
            try
            {
                switch (message.ProcessorCommand)
                {
                    case "UpdateSupportedFeatures":
                        UpdateSupportedFeatures(message);
                        break;
                    case "UpgradeModule":
                        UpgradeModule(message);
                        break;
                    case "ImportModule":
                        ImportModule(message);
                        break;
                    default:
						//other events can be added here
                        break;
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                message.ExceptionMessage = ex.Message;
                return false;
            }
            return true;
        }
        static void CreateEventQueueMessage(ModuleInfo module, string content, string version, int userId)
        {
            var oAppStartMessage = new EventMessage
                                       {
                                           Priority = MessagePriority.High,
                                           ExpirationDate = DateTime.Now.AddYears(Convert.ToInt32(- 1)),
                                           SentDate = DateTime.Now,
                                           Body = "",
                                           ProcessorType =
                                               "DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke",
                                           ProcessorCommand = "ImportModule"
                                       };

            //Add custom Attributes for this message
            oAppStartMessage.Attributes.Add("BusinessControllerClass", module.DesktopModule.BusinessControllerClass);
            oAppStartMessage.Attributes.Add("ModuleId", module.ModuleID.ToString(CultureInfo.InvariantCulture));
            oAppStartMessage.Attributes.Add("Content", content);
            oAppStartMessage.Attributes.Add("Version", version);
            oAppStartMessage.Attributes.Add("UserID", userId.ToString(CultureInfo.InvariantCulture));

            //send it to occur on next App_Start Event
            EventQueueController.SendMessage(oAppStartMessage, "Application_Start");
        }
 private void UpdateSupportedFeatures( EventMessage message )
 {
     object oObject = Reflection.CreateObject( message.Attributes["BusinessControllerClass"].ToString(), "" );
     UpdateSupportedFeatures( oObject, Convert.ToInt32( message.Attributes["DesktopModuleId"] ) );
 }
 public void UpdateModuleInterfaces(ref DesktopModuleInfo desktopModuleInfo, string sender, bool forceAppRestart)
 {
     CheckInterfacesImplementation(ref desktopModuleInfo);
     var oAppStartMessage = new EventMessage
     {
         Sender = sender,
         Priority = MessagePriority.High,
         ExpirationDate = DateTime.Now.AddYears(-1),
         SentDate = DateTime.Now,
         Body = "",
         ProcessorType = "DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke",
         ProcessorCommand = "UpdateSupportedFeatures"
     };
     oAppStartMessage.Attributes.Add("BusinessControllerClass", desktopModuleInfo.BusinessControllerClass);
     oAppStartMessage.Attributes.Add("DesktopModuleId", desktopModuleInfo.DesktopModuleID.ToString());
     EventQueueController.SendMessage(oAppStartMessage, "Application_Start");
     if ((forceAppRestart))
     {
         Config.Touch();
     }
     
 }
        protected override string UpgradeModule(DesktopModuleInfo ModuleInfo)
        {
            if (!String.IsNullOrEmpty(ModuleInfo.BusinessControllerClass))
            {
                string UpgradeVersionsList = "";

                if (UpgradeVersions.Count > 0)
                {
                    foreach (string Version in UpgradeVersions)
                    {
                        UpgradeVersionsList = UpgradeVersionsList + Version + ",";
                        DeleteFiles(ModuleInfo.FolderName, Version);
                    }
                    if (UpgradeVersionsList.EndsWith(","))
                    {
                        UpgradeVersionsList = UpgradeVersionsList.Remove(UpgradeVersionsList.Length - 1, 1);
                    }
                }
                else
                {
                    UpgradeVersionsList = ModuleInfo.Version;
                }

                //this cannot be done directly at this time because
                //the module may not be loaded into the app domain yet
                //So send an EventMessage that will process the update
                //after the App recycles
                EventMessage oAppStartMessage = new EventMessage();
                oAppStartMessage.ProcessorType = "DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke";
                oAppStartMessage.Attributes.Add("ProcessCommand", "UpgradeModule");
                oAppStartMessage.Attributes.Add("BusinessControllerClass", ModuleInfo.BusinessControllerClass);
                oAppStartMessage.Attributes.Add("DesktopModuleId", ModuleInfo.DesktopModuleID.ToString());
                oAppStartMessage.Attributes.Add("UpgradeVersionsList", UpgradeVersionsList);
                oAppStartMessage.Priority = MessagePriority.High;
                oAppStartMessage.SentDate = DateTime.Now;
                //make it expire as soon as it's processed
                oAppStartMessage.ExpirationDate = DateTime.Now.AddYears(-1);
                //send it
                EventQueueController oEventQueueController = new EventQueueController();
                oEventQueueController.SendMessage(oAppStartMessage, "Application_Start");                
            }
            //TODO: Need to implement a feedback loop to display the results of the upgrade.

            return "";
        }
        public bool SendMessage( EventMessage message, string eventName, bool encryptMessage )
        {
            //set the sent date if it wasn't set by the sender
            if( message.SentDate == DateTime.MinValue )
            {
                message.SentDate = DateTime.Now;
            }

            string[] subscribers = new string[0];
            if( EventQueueConfiguration.GetConfig().PublishedEvents[eventName] != null )
            {
                subscribers = EventQueueConfiguration.GetConfig().PublishedEvents[eventName].Subscribers.Split( ";".ToCharArray() );
            }
            else
            {
                subscribers[0] = "";
            }
            //send a message for each subscriber of the specified event
            for( int indx = 0; indx <= subscribers.Length - 1; indx++ )
            {
                StreamWriter oStream = File.CreateText( m_messagePath + MessageName( eventName, subscribers[indx], message.ID ) );
                string messageString = message.Serialize();
                if( encryptMessage )
                {
                    PortalSecurity oPortalSecurity = new PortalSecurity();
                    messageString = oPortalSecurity.Encrypt( EventQueueConfiguration.GetConfig().EventQueueSubscribers[subscribers[indx]].PrivateKey, messageString );
                }
                oStream.WriteLine( messageString );
                oStream.Close();
            }

            return true;
        }
 public bool SendMessage( EventMessage message, string eventName )
 {
     return SendMessage( message, eventName, false );
 }
示例#17
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The ReadManifest method reads the manifest file for the Module compoent.
        /// </summary>
        /// <history>
        /// 	[cnurse]	01/15/2008  created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void ReadManifest(XPathNavigator manifestNav)
        {
            //Load the Desktop Module from the manifest
            _desktopModule = CBO.DeserializeObject<DesktopModuleInfo>(new StringReader(manifestNav.InnerXml));

            _desktopModule.FriendlyName = Package.FriendlyName;
            _desktopModule.Description = Package.Description;
            _desktopModule.Version = Globals.FormatVersion(Package.Version);
            _desktopModule.CompatibleVersions = Null.NullString;
            _desktopModule.Dependencies = Null.NullString;
            _desktopModule.Permissions = Null.NullString;
            if (string.IsNullOrEmpty(_desktopModule.BusinessControllerClass))
            {
                _desktopModule.SupportedFeatures = 0;
            }
            XPathNavigator eventMessageNav = manifestNav.SelectSingleNode("eventMessage");
            if (eventMessageNav != null)
            {
                _eventMessage = new EventMessage
                                    {
                                        Priority = MessagePriority.High,
                                        ExpirationDate = DateTime.Now.AddYears(-1),
                                        SentDate = DateTime.Now,
                                        Body = "",
                                        ProcessorType = Util.ReadElement(eventMessageNav, "processorType", Log, Util.EVENTMESSAGE_TypeMissing),
                                        ProcessorCommand = Util.ReadElement(eventMessageNav, "processorCommand", Log, Util.EVENTMESSAGE_CommandMissing)
                                    };
                foreach (XPathNavigator attributeNav in eventMessageNav.Select("attributes/*"))
                {
                    var attribName = attributeNav.Name;
                    var attribValue = attributeNav.Value;
                    if (attribName == "upgradeVersionsList")
                    {
                        if (!String.IsNullOrEmpty(attribValue))
                        {
                            string[] upgradeVersions = attribValue.Split(',');
                            attribValue = ""; 
                            foreach (string version in upgradeVersions)
                            {
                                Version upgradeVersion = null;
                                try
                                {
                                    upgradeVersion = new Version(version);
                                }
                                catch (FormatException)
                                {
                                    Log.AddWarning(string.Format(Util.MODULE_InvalidVersion, version));
                                }

                                if (upgradeVersion != null && (Globals.Status == Globals.UpgradeStatus.Install)) //To allow when fresh installing or installresources
                                {
                                    attribValue += version + ",";                                    
                                }
                                else if (upgradeVersion != null && upgradeVersion > Package.InstalledVersion)
                                {
                                    attribValue += version + ",";
                                }
                            }
                            attribValue = attribValue.TrimEnd(',');
                        }
                    }
                   _eventMessage.Attributes.Add(attribName, attribValue);
                }
            }
			
            //Load permissions (to add)
            foreach (XPathNavigator moduleDefinitionNav in manifestNav.Select("desktopModule/moduleDefinitions/moduleDefinition"))
            {
                string friendlyName = Util.ReadElement(moduleDefinitionNav, "friendlyName");
                foreach (XPathNavigator permissionNav in moduleDefinitionNav.Select("permissions/permission"))
                {
                    var permission = new PermissionInfo();
                    permission.PermissionCode = Util.ReadAttribute(permissionNav, "code");
                    permission.PermissionKey = Util.ReadAttribute(permissionNav, "key");
                    permission.PermissionName = Util.ReadAttribute(permissionNav, "name");
                    ModuleDefinitionInfo moduleDefinition = _desktopModule.ModuleDefinitions[friendlyName];
                    if (moduleDefinition != null)
                    {
                        moduleDefinition.Permissions.Add(permission.PermissionKey, permission);
                    }
                }
            }
            if (Log.Valid)
            {
                Log.AddInfo(Util.MODULE_ReadSuccess);
            }
        }
 private static void UpdateSupportedFeatures(EventMessage message)
 {
     string BusinessControllerClass = message.Attributes["BusinessControllerClass"];
     object controller = Reflection.CreateObject(BusinessControllerClass, "");
     UpdateSupportedFeatures(controller, Convert.ToInt32(message.Attributes["DesktopModuleId"]));
 }
示例#19
0
 public bool SendMessage(EventMessage message, string eventName, bool encryptMessage)
 {
     return(SendMessage(message, eventName));
 }
 private void UpgradeModule( EventMessage message )
 {
     string BusinessController = message.Attributes["BusinessControllerClass"].ToString();
     object oObject = Reflection.CreateObject( BusinessController, BusinessController );
     EventLogController objEventLog = new EventLogController();
     LogInfo objEventLogInfo;
     if( oObject is IUpgradeable )
     {
         // get the list of applicable versions
         string[] UpgradeVersions = message.Attributes["UpgradeVersionsList"].ToString().Split( ",".ToCharArray() );
         foreach( string Version in UpgradeVersions )
         {
             //call the IUpgradeable interface for the module/version
             string upgradeResults = ( (IUpgradeable)oObject ).UpgradeModule( Version );
             //log the upgrade results
             objEventLogInfo = new LogInfo();
             objEventLogInfo.AddProperty( "Module Upgraded", BusinessController );
             objEventLogInfo.AddProperty( "Version", Version );
             objEventLogInfo.AddProperty( "Results", upgradeResults );
             objEventLogInfo.LogTypeKey = EventLogController.EventLogType.MODULE_UPDATED.ToString();
             objEventLog.AddLog( objEventLogInfo );
         }
     }
     UpdateSupportedFeatures( oObject, Convert.ToInt32( message.Attributes["DesktopModuleId"] ) );
 }
 public void Add(EventMessage message)
 {
     this.InnerList.Add(message);
 }
        public static void CreateImportModuleMessage(ModuleInfo objModule, string content, string version, int userID)
        {
            var appStartMessage = new EventMessage
                                       {
                                           Priority = MessagePriority.High,
                                           ExpirationDate = DateTime.Now.AddYears(-1),
                                           SentDate = DateTime.Now,
                                           Body = "",
                                           ProcessorType = "DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke",
                                           ProcessorCommand = "ImportModule"
                                       };

            //Add custom Attributes for this message
            appStartMessage.Attributes.Add("BusinessControllerClass", objModule.DesktopModule.BusinessControllerClass);
            appStartMessage.Attributes.Add("ModuleId", objModule.ModuleID.ToString());
            appStartMessage.Attributes.Add("Content", content);
            appStartMessage.Attributes.Add("Version", version);
            appStartMessage.Attributes.Add("UserID", userID.ToString());

            //send it to occur on next App_Start Event
            EventQueueController.SendMessage(appStartMessage, "Application_Start_FirstRequest");
        }
		/// <summary>
		/// Sends the message.
		/// </summary>
		/// <param name="message">The message.</param>
		/// <param name="eventName">Name of the event.</param>
		/// <returns></returns>
        public static bool SendMessage(EventMessage message, string eventName)
        {
			//set the sent date if it wasn't set by the sender
            if (message.SentDate != null)
            {
                message.SentDate = DateTime.Now;
            }
			
            //Get the subscribers to this event
            string[] subscribers = GetSubscribers(eventName);

            //send a message for each subscriber of the specified event
            int intMessageID = Null.NullInteger;
            bool success = true;
            try
            {
                for (int indx = 0; indx <= subscribers.Length - 1; indx++)
                {
                    intMessageID = DataProvider.Instance().AddEventMessage(eventName,
                                                                           (int) message.Priority,
                                                                           message.ProcessorType,
                                                                           message.ProcessorCommand,
                                                                           message.Body,
                                                                           message.Sender,
                                                                           subscribers[indx],
                                                                           message.AuthorizedRoles,
                                                                           message.ExceptionMessage,
                                                                           message.SentDate,
                                                                           message.ExpirationDate,
                                                                           message.SerializeAttributes());
                }
            }
            catch (Exception ex)
            {
                Exceptions.Exceptions.LogException(ex);
                success = Null.NullBoolean;
            }
            return success;
        }
 public bool SendMessage(EventMessage message, string eventName, bool encryptMessage)
 {
     return SendMessage(message, eventName);
 }
示例#25
0
 public void Add(EventMessage message)
 {
     InnerList.Add(message);
 }