Exemplo n.º 1
0
        public void NotifyAction(string istanceIdentifier, Notification.Domain.NotificationChannel channel, Notification.Domain.NotificationMode mode, NotificationAction action, int idSenderUser = 0, String ipAddress = "", String proxyIpAddress = "")
        {
            IstanceConfig istance = Config.GetIstanceConfiguration(istanceIdentifier);

            if (istance != null)
            {
                List <dtoModuleNotificationMessage> items = null;
                using (ISession session = lm.Comol.Core.Data.SessionDispatcher.NewSession(istance.ConnectionString))
                {
                    if (session != null)
                    {
                        using (InternalNotificationService service = new InternalNotificationService(istance, session))
                        {
                            try
                            {
                                items = service.NotifyActionToModule(channel, mode, action, idSenderUser, ipAddress, proxyIpAddress, istance.Settings);
                                if (items != null)
                                {
                                    service.ManageNotifications(items, action.ModuleCode, idSenderUser, ipAddress, proxyIpAddress);
                                }
                            }
                            catch (NotificationException nEx)
                            {
                                ErrorHandler.addActionToPoisonQueue(action, nEx);
                            }
                            catch (Exception ex)
                            {
                                ErrorHandler.addActionToPoisonQueue(action, ExceptionType.GenericError, ex);
                            }
                        }
                    }
                    else
                    {
                        ErrorHandler.addActionToPoisonQueue(action, ExceptionType.UnableToGetNhibernateSession);
                    }
                }
            }
            else
            {
                Exceptions.ErrorHandler.addActionToPoisonQueue(action, ExceptionType.ConfigMising);
            }
        }
Exemplo n.º 2
0
        public List <dtoModuleNotificationMessage> NotifyActionToModule(Notification.Domain.NotificationChannel channel, Notification.Domain.NotificationMode mode, NotificationAction action, Int32 idSenderUser, String ipAddress, String proxyIpAddress, Notification.Domain.WebSiteSettings webSiteSettings)
        {
            List <dtoModuleNotificationMessage> results = null;

            lm.Comol.Core.Notification.Domain.iNotifiableService service = null;
            lm.Comol.Core.Data.DataContext dc = new lm.Comol.Core.Data.DataContext(Session);
            switch (action.ModuleCode)
            {
            case lm.Comol.Core.BaseModules.Tickets.ModuleTicket.UniqueCode:
                service = (lm.Comol.Core.Notification.Domain.iNotifiableService) new lm.Comol.Core.BaseModules.Tickets.TicketService(dc);
                break;

            case lm.Comol.Modules.Standard.WebConferencing.Domain.ModuleWebConferencing.UniqueCode:
                if (IstanceConfig.WebConference != null)
                {
                    switch (IstanceConfig.WebConference.CurrentType)
                    {
                    case WebConferenceType.eWorks:
                        service = new lm.Comol.Modules.Standard.WebConferencing.Domain.eWorks.eWService(IstanceConfig.WebConference.GetEWorksParameters(), dc);
                        break;

                    case WebConferenceType.OpenMeeting:
                        service = new lm.Comol.Modules.Standard.WebConferencing.Domain.OpenMeetings.oMService(IstanceConfig.WebConference.GetOpenMeetingParameters(), dc);
                        break;
                    }
                }
                break;

            case lm.Comol.Modules.CallForPapers.Domain.ModuleCallForPaper.UniqueCode:
                //service = new lm.Comol.Modules.CallForPapers.Business.ServiceCallOfPapers(dc);
                break;

            case lm.Comol.Modules.CallForPapers.Domain.ModuleRequestForMembership.UniqueCode:
                //service = new lm.Comol.Modules.CallForPapers.Business.ServiceRequestForMembership(dc);
                break;

            case lm.Comol.Modules.Standard.ProjectManagement.Domain.ModuleProjectManagement.UniqueCode:
                //service = new lm.Comol.Modules.Standard.ProjectManagement.Business.ServiceProjectManagement(dc);
                break;

            case lm.Comol.Core.BaseModules.CommunityDiary.Domain.ModuleCommunityDiary.UniqueID:
                //service = new lm.Comol.Core.BaseModules.CommunityDiary.Business.ServiceCommunityDiary(dc);
                break;

            case lm.Comol.Modules.EduPath.Domain.ModuleEduPath.UniqueCode:
                ///service = new lm.Comol.Modules.EduPath.BusinessLogic.Service(dc);
                break;
            }
            if (service != null)
            {
                results = service.GetNotificationMessages(action, channel, mode, idSenderUser, webSiteSettings);
            }
            return(results);
        }