public void Project_Execute_ReturnsEmpty()
        {
            var command       = new ProjectCommand(_console, LoggerMock.GetLogger <ProjectCommand>().Object);
            var resultMessage = command.Execute();

            Assert.Equal("", resultMessage);
        }
Пример #2
0
        public ProjectSetup(
            IExtendedProjectService projectService,
            IOrchardServices services,
            IRepository <SortCriterionRecord> sortRepository,
            IRepository <EmailTemplateRecord> emailTemplatesRepository,
            IRepository <WorkflowDefinitionRecord> workflowDefinitionRepository,
            IRepository <ActivityRecord> activityRepository,
            IRepository <TransitionRecord> transitionRepository,
            IContentManager contentManager,
            IRepository <FilterRecord> filterRepository,
            IRepository <LayoutRecord> layoutRepository,
            IRepository <FilterGroupRecord> filterGroupRepository,
            IRepository <ReportRecord> reportRepository,
            IBasicDataService basicDataService)
        {
            this.projectService = projectService;
            this.services       = services;

            this.projectCommand = new ProjectCommand(sortRepository, emailTemplatesRepository, workflowDefinitionRepository, activityRepository, transitionRepository, reportRepository, layoutRepository, contentManager, filterRepository, filterGroupRepository, basicDataService);
            this.portletCommand = new PortletCommand(services, reportRepository, layoutRepository);
        }
Пример #3
0
        /// <summary>
        /// Initalize values.
        /// </summary>
        public NavBarViewModel()
            : base("Nav")
        {
            _pm          = IoC.Get <PulseManager>();
            _events      = IoC.Get <IEventAggregator>();
            _adcpConn    = IoC.Get <AdcpConnection>();
            _IsRecording = false;
            this.NotifyOfPropertyChange(() => this.IsRecording);

            // Set the record image
            SetRecorderImage();

            // Warning timer
            _recorderTimer           = new System.Timers.Timer();
            _recorderTimer.Interval  = 2000;               // 2 seconds.
            _recorderTimer.Elapsed  += _recorderTimer_Elapsed;
            _recorderTimer.AutoReset = true;
            _recorderTimer.Start();

            // Command to go back a view
            BackCommand = ReactiveCommand.Create();
            BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back)));

            // Command to go to Home View
            HomeCommand = ReactiveCommand.Create();
            HomeCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView)));

            // Command to go to SmartPage View
            ConfigureCommand = ReactiveCommand.Create();
            ConfigureCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SmartPageView)));

            // Command to go to ViewData View
            ViewDataCommand = ReactiveCommand.Create();
            ViewDataCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ViewDataView)));

            //// Command to go to Playback data
            //PlaybackCommand = ReactiveCommand.Create();
            //PlaybackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SelectPlaybackView)));

            // Select a file to playback
            PlaybackCommand = ReactiveCommand.Create();
            PlaybackCommand.Subscribe(_ => PlaybackFile());

            // Command to go to ScreenData View
            ScreenDataCommand = ReactiveCommand.Create();
            ScreenDataCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ScreenDataView)));

            // Command to go to Project View
            ProjectCommand = ReactiveCommand.Create();
            ProjectCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ProjectView)));

            // Command to go to VesselMount Options View
            VmOptionsCommand = ReactiveCommand.Create();
            VmOptionsCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.VesselMountOptionsView)));

            // Command to go to Data Format View
            DataFormatCommand = ReactiveCommand.Create();
            DataFormatCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.DataFormatView)));

            // Command to go to VesselMount Options View
            AveragingCommand = ReactiveCommand.Create();
            AveragingCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AveragingView)));

            // Set the Clock time to Local System time on the ADCP
            StartTestingCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.IsTesting, x => !x.Value),
                                                                  _ => Task.Run(() => On_StartTesting()));

            // Create a command to stop testing
            StopTestingCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.IsTesting, x => x.Value),
                                                                 _ => Task.Run(() => On_StopTesting()));
        }
Пример #4
0
        public void SendProjectNotification(ProjectNotification notification, ProjectCommand command)
        {
            var users = new List <Data.ViewModels.Project.MemberModel>();

            using (var noSqlSession = noSqlSessionFactory())
            {
                var project =
                    noSqlSession.GetAll <Project>().Where(o => o.Id == command.ProjectId).Single();
                var todo     = projectService.GetToDo(project, command.MileStoneId, command.ToDoId);
                var fromUser = noSqlSession.GetAll <Data.MongoDB.User>().SingleOrDefault(u => u.Id == command.UserId);

                if (!string.IsNullOrEmpty(todo.ResponsibleUserId) && todo.ResponsibleUserId != "-1")
                {
                    using (var session = usersSessionFactory.CreateContext())
                    {
                        var dbUser = session.Users.Where(u => u.ObjectId == todo.ResponsibleUserId).Select(u => new { u.FirstName, u.LastName, u.ObjectId, u.UserEmails }).SingleOrDefault();
                        foreach (var email in dbUser.UserEmails.Where(e => e.IsEmailConfirmed && e.SendMail))
                        {
                            users.Add(new Data.ViewModels.Project.MemberModel()
                            {
                                FullName = dbUser.FirstName + " " + dbUser.LastName,
                                Email    = email.Email,
                                ObjectId = dbUser.ObjectId
                            });
                        }
                    }
                }
                else
                {
                    users.AddRange(projectService.GetMemberConfirmedEmails(project));
                }

                Data.EF.Users.Notification not = null;
                if (command.ActionType == ActionTypes.ToDoAdded)
                {
                    not = GetNotification((int)NotificationTypes.ProjectTodo);
                }

                if (command.ActionType == ActionTypes.ToDoCommentAdded)
                {
                    not = GetNotification((int)NotificationTypes.ProjectComment);
                    users.AddRange(projectService.GetCommentUserEmails(todo));
                }

                users = users.Where(u => !string.IsNullOrEmpty(u.Email)).Distinct().ToList();

                if (not == null)
                {
                    logger.Information(string.Format("{0} id={1} failed sending mail, notification not found",
                                                     command.GetType().Name, command.MessageId));
                    return;
                }

                if (users.Any())
                {
                    logger.Information(string.Format("Sending emails to {0} users", users.Count));
                }
                else
                {
                    logger.Information(string.Format("{0} id={1} successfully completed, no users to send mail to", command.GetType().Name, command.MessageId));
                    return;
                }

                notification.UserFullName = command.UserFullName;
                notification.UserLink     = command.UserLink;
                notification.ProjectLink  = command.Link;
                notification.ProjectName  = command.ProjectSubject;
                notification.TodoLink     = command.ToDoLink;
                notification.ToDoSubject  = command.ToDoSubject;
                notification.Text         = command.Text.NewLineToHtml();

                notification.MessageTemplate = not.Message;
                notification.Subject         = not.Subject;
                if (fromUser != null)
                {
                    notification.FromDisplayName = command.UserFullName;
                    notification.From            = fromUser.Email;
                }

                foreach (var user in users)
                {
                    notification.To            = user.Email;
                    notification.ToDisplayName = user.FullName;
                    notification.Execute();
                }
            }
        }