public OnIspolcomUoW(Project currentProject,
                      IRepository repository,
                      IUserNotification userNotification,
                      IAdminNotification adminNotification,
                      IInvestorNotification investorNotification,
                      string userName,
                      IEnumerable <string> roles)
     : this(new ProjectStateContext
 {
     UserNotification = userNotification,
     AdminNotification = adminNotification,
     InvestorNotification = investorNotification,
     CurrentProject = currentProject,
     Repository = repository,
     Roles = roles,
     UserName = userName
 })
 {
     if (CurrentProject != null)
     {
         if (currentProject.Responses == null)
         {
             currentProject.Responses = new List <InvestorResponse>();
         }
     }
 }
        private void OnBindingFinished(ProjectInformation projectInformation, bool isFinishedSuccessfully)
        {
            this.IsBindingInProgress = false;
            this.host.VisualStateManager.ClearBoundProject();

            if (isFinishedSuccessfully)
            {
                this.host.VisualStateManager.SetBoundProject(projectInformation);

                var conflictsController = this.host.GetService <IRuleSetConflictsController>();
                conflictsController.AssertLocalServiceIsNotNull();

                if (conflictsController.CheckForConflicts())
                {
                    // In some cases we will end up navigating to the solution explorer, this will make sure that
                    // we're back in team explorer to view the conflicts
                    this.ServiceProvider.GetMefService <ITeamExplorerController>()?.ShowSonarQubePage();
                }
                else
                {
                    VsShellUtils.ActivateSolutionExplorer(this.ServiceProvider);
                }
            }
            else
            {
                IUserNotification notifications = this.host.ActiveSection?.UserNotifications;
                if (notifications != null)
                {
                    // Create a command with a fixed argument with the help of ContextualCommandViewModel that creates proxy command for the contextual (fixed) instance and the passed in ICommand that expects it
                    ICommand rebindCommand = new ContextualCommandViewModel(projectInformation, new RelayCommand <ProjectInformation>(this.OnBind, this.OnBindStatus)).Command;
                    notifications.ShowNotificationError(Strings.FailedToToBindSolution, NotificationIds.FailedToBindId, rebindCommand);
                }
            }
        }
Example #3
0
        public Task CollectAsync(IUserNotification notification, string channel, ProcessStatus status)
        {
            Guard.NotNull(notification, nameof(notification));
            Guard.NotNullOrEmpty(channel, nameof(channel));

            var counterMap = CounterMap.ForChannel(channel, status);
            var counterKey = CounterKey.ForNotification(notification);

            return(StoreCountersAsync(counterKey, counterMap));
        }
Example #4
0
        public Task CollectAsync(IUserNotification notification, string channel, ProcessStatus status,
                                 CancellationToken ct = default)
        {
            Guard.NotNull(notification);
            Guard.NotNullOrEmpty(channel);

            var counterMap = CounterMap.ForChannel(channel, status);
            var counterKey = CounterKey.ForNotification(notification);

            return(StoreCountersAsync(counterKey, counterMap, ct));
        }
Example #5
0
        public Task CollectAndUpdateAsync(IUserNotification notification, string channel, ProcessStatus status, string?detail)
        {
            Guard.NotNull(notification, nameof(notification));
            Guard.NotNullOrEmpty(channel, nameof(channel));

            var counterMap = CounterMap.ForChannel(channel, status);
            var counterKey = CounterKey.ForNotification(notification);

            return(Task.WhenAll(
                       StoreCountersAsync(counterKey, counterMap),
                       StoreInternalAsync(notification.Id, channel, status, detail)));
        }
Example #6
0
        public Task CollectAndUpdateAsync(IUserNotification notification, string channel, string configuration, ProcessStatus status, string?detail = null,
                                          CancellationToken ct = default)
        {
            Guard.NotNull(notification);
            Guard.NotNullOrEmpty(channel);

            var counterMap = CounterMap.ForChannel(channel, status);
            var counterKey = CounterKey.ForNotification(notification);

            return(Task.WhenAll(
                       StoreCountersAsync(counterKey, counterMap, ct),
                       StoreInternalAsync(notification.Id, channel, configuration, status, detail)));
        }
Example #7
0
        public static CounterKey ForNotification(IUserNotification notification)
        {
            Guard.NotNull(notification, nameof(notification));

            var result = default(CounterKey);

            result.notificationId = notification.Id;
            result.eventId        = notification.EventId;
            result.appId          = notification.AppId;
            result.topic          = notification.Topic;
            result.userId         = notification.UserId;

            return(result);
        }
Example #8
0
        private ProjectStateManager(Project currentProject, string currentUser, IList <string> roles)
        {
            _currentUser        = currentUser;
            _roles              = roles;
            _investorNotificate = new InvestorNotification();
            _adminNotificate    = new AdminNotification();
            _userNotificationl  = new UserNotification();
            _repository         = RepositoryContext.Current;
            _currentProject     = _repository.GetOne <Project>(p => p._id == currentProject._id);
            _unitsOfWork        = new UnitsOfWorkContainer(_currentProject,
                                                           _repository,
                                                           _userNotificationl,
                                                           _adminNotificate,
                                                           _investorNotificate,
                                                           _currentUser, _roles);
            if (_currentProject == null)
            {
                _currentProject = currentProject;
            }
            if (string.IsNullOrEmpty(_currentProject._id))
            {
                _currentProject._id = ObjectId.GenerateNewId().ToString();
            }

            if (_currentProject.WorkflowState == null)
            {
                _currentProject.WorkflowState = new Workflow
                {
                    CurrentState = ProjectWorkflow.State.Open
                };
            }
            _workflow = new ProjectWorkflowWrapper(new ProjectWorkflow(_currentProject.WorkflowState.CurrentState), _unitsOfWork);

            /*var context = new ProjectStateContext
             * {
             *      UserName = currentUser,
             *      CurrentProject = currentProject,
             *      Roles = roles,
             *      InvestorNotification = _investorNotificate,
             *      UserNotification = _userNotificationl,
             *      AdminNotification = _adminNotificate,
             *      Repository = _repository
             * };
             * var builder = new AttributeStateMachineBuilder();
             * _workflow = new ProjectWorkflowWrapper(
             *      new ProjectWorkflow(
             *              builder.BuilStateMachine<ProjectWorkflow.State,ProjectWorkflow.Trigger>("test", context,_currentProject.WorkflowState.CurrentState)));*/
        }
Example #9
0
 protected BaseProjectUoW(Project currentProject,
                          IRepository repository,
                          IUserNotification userNotification,
                          IAdminNotification adminNotification,
                          IInvestorNotification investorNotification,
                          string userName,
                          IEnumerable <string> roles)
 {
     CurrentProject       = currentProject;
     Repository           = repository;
     UserNotification     = userNotification;
     AdminNotification    = adminNotification;
     InvestorNotification = investorNotification;
     UserName             = userName;
     Roles = roles;
 }
Example #10
0
        private unsafe IntPtr WndProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
        {
            switch (uMsg)
            {
            case NativeConstants.WM_CREATE:
                Guid clsid = new Guid(NativeConstants.CLSID_UserNotification);
                Guid iid   = IUserNotification.IID;
                IUserNotification notification;

                int status = NativeMethods.CoCreateInstance(&clsid, null, (uint)CLSCTX.CLSCTX_LOCAL_SERVER, &iid, (void **)&notification);

                if (status == 0)
                {
                    this.notification = notification;

                    fixed(char *title = "TestApp")
                    fixed(char *text = "Hello from COM")
                    {
                        notification.SetBalloonInfo(title, text, 0);
                    }

                    notification.Show(null, 0);
                }

                break;

            case NativeConstants.WM_PAINT:
                PAINTSTRUCT paintArguments;
                IntPtr      hdc = NativeMethods.BeginPaint(hWnd, &paintArguments);
                NativeMethods.EndPaint(hWnd, &paintArguments);
                break;

            case NativeConstants.WM_DESTROY:

                (this.notification as IDisposable).Dispose();

                NativeMethods.PostQuitMessage(0);
                break;

            default:
                return(NativeMethods.DefWindowProc(hWnd, uMsg, wParam, lParam));
            }

            return(IntPtr.Zero);
        }
        private static void Main(string[] args)
        {
            var _currentUser = "";

            _roles = new List <string> {
                "Admin"
            };
            _investorNotificate = new InvestorNotification();
            _adminNotificate    = new AdminNotification();
            _userNotificationl  = new UserNotification();
            _currentProject     = new GreenField();
            var _unitsOfWork = new UnitsOfWorkContainer(_currentProject,
                                                        new MongoRepository("mongodb://178.124.129.147/", "Projects"),
                                                        _userNotificationl,
                                                        _adminNotificate,
                                                        _investorNotificate,
                                                        _currentUser, _roles);

            if (_currentProject.WorkflowState == null)
            {
                _currentProject.WorkflowState = new Workflow
                {
                    CurrentState = ProjectWorkflow.State.Open
                };
            }
            //_workflow = new ProjectWorkflowWrapper(new ProjectWorkflow(_currentProject.WorkflowState.CurrentState), _unitsOfWork);
            //_workflow.IsMoveablde(ProjectWorkflow.Trigger.FillInformation);
            var builder = new AttributeStateMachineBuilder();
            var context = new ProjectStateContext();

            context.AdminNotification    = _adminNotificate;
            context.CurrentProject       = _currentProject;
            context.InvestorNotification = _investorNotificate;
            context.Repository           = _repository;
            context.Roles            = _roles;
            context.UserName         = _currentUser;
            context.UserNotification = _userNotificationl;
            var statemachine = builder
                               .BuilStateMachine <ProjectWorkflow.State, ProjectWorkflow.Trigger>(
                "test",
                context,
                _currentProject.WorkflowState.CurrentState);

            Console.Write(statemachine.CanFire(ProjectWorkflow.Trigger.FillInformation));
        }
 public WaitInvolvedUoW(Project currentProject,
                        IRepository repository,
                        IUserNotification userNotification,
                        IAdminNotification adminNotification,
                        IInvestorNotification investorNotification,
                        string userName,
                        IEnumerable <string> roles)
     : this(new ProjectStateContext
 {
     UserNotification = userNotification,
     AdminNotification = adminNotification,
     InvestorNotification = investorNotification,
     CurrentProject = currentProject,
     Repository = repository,
     Roles = roles,
     UserName = userName
 })
 {
 }
Example #13
0
        private void OnBindingFinished(BindCommandArgs bindingArgs, bool isFinishedSuccessfully)
        {
            this.IsBindingInProgress = false;
            this.host.VisualStateManager.ClearBoundProject();

            if (isFinishedSuccessfully)
            {
                this.host.VisualStateManager.SetBoundProject(bindingArgs.Connection.ServerUri, bindingArgs.Connection.Organization?.Key, bindingArgs.ProjectKey);

                // The conflicts controller is only applicable in legacy connected mode
                // However, it is safe to call it regardless - in new connected mode it will
                // not return any conflicts.
                var conflictsController = this.host.GetService <IRuleSetConflictsController>();
                conflictsController.AssertLocalServiceIsNotNull();

                if (conflictsController.CheckForConflicts())
                {
                    // In some cases we will end up navigating to the solution explorer, this will make sure that
                    // we're back in team explorer to view the conflicts
                    this.host.GetMefService <ITeamExplorerController>()?.ShowSonarQubePage();
                }
                else
                {
                    VsShellUtils.ActivateSolutionExplorer(this.host);
                }
            }
            else
            {
                IUserNotification notifications = this.host.ActiveSection?.UserNotifications;
                if (notifications != null)
                {
                    // Create a command with a fixed argument with the help of ContextualCommandViewModel that creates proxy command for the contextual (fixed) instance and the passed in ICommand that expects it
                    var rebindCommandVM = new ContextualCommandViewModel(
                        bindingArgs,
                        new RelayCommand <BindCommandArgs>(this.OnBind, this.OnBindStatus));
                    notifications.ShowNotificationError(Strings.FailedToToBindSolution, NotificationIds.FailedToBindId, rebindCommandVM.Command);
                }
            }
        }
Example #14
0
 public UserNotification(Guid id, IUserNotification notification)
     : this(id, notification.UserId, notification.NodeType, notification.NodeId, notification.EventPayload, notification.EventTypeName, notification.AssemblyQualifiedEventTypeName, notification.ParentNodeId)
 {
 }
 /// <summary>
 ///     Construtor.
 /// </summary>
 /// <param name="messageBus">IMediator</param>
 /// <param name="userNotification">Notificação de mensagens para o usuário.</param>
 public UserNotificationHandler(IMediator messageBus, IUserNotification userNotification)
 {
     _messageBus       = messageBus;
     _userNotification = userNotification;
 }
Example #16
0
 public BLLUserNotificationTypes(IUserNotification userNotification, IUnitOfWork unitOfWork)
 {
     _userNotification = userNotification;
     _unitOfWork       = unitOfWork;
 }
 public UserService(IUserRepository userRepository)
 {
     _userRepository   = userRepository;
     _userNotification = userNotification;
 }
Example #18
0
 public UserNotificationRepoImpl(IUserNotification userNotification)
 {
     this._userNotification = userNotification;
 }
Example #19
0
 public void Notify(IUserNotification note)
 {
     // 내부 데이터를 전달
     note.Id(id);
     note.Name(name);
 }
Example #20
0
 public void Notify(IUserNotification note)
 {
     // 内部データを通知
     note.Id(id);
     note.Name(name);
 }
        public UnitsOfWorkContainer(Project currentProject,
                                    IRepository repository,
                                    IUserNotification userNotification,
                                    IAdminNotification adminNotification,
                                    IInvestorNotification investorNotification,
                                    string userName,
                                    IEnumerable <string> roles)
        {
            _currentProject       = currentProject;
            _repository           = repository;
            _userNotification     = userNotification;
            _adminNotification    = adminNotification;
            _investorNotification = investorNotification;
            _userName             = userName;
            _roles = roles;

            OpenUoW = new OpenUoW(_currentProject,
                                  _repository,
                                  _userNotification,
                                  _adminNotification,
                                  _investorNotification,
                                  _userName,
                                  _roles);
            OnMapUoW = new OnMapUoW(_currentProject,
                                    _repository,
                                    _userNotification,
                                    _adminNotification,
                                    _investorNotification,
                                    _userName,
                                    _roles);
            InvestorApproveUoW = new InvestorApproveUoW(_currentProject,
                                                        _repository,
                                                        _userNotification,
                                                        _adminNotification,
                                                        _investorNotification,
                                                        _userName,
                                                        _roles);

            WaitIspolcomUoW = new WaitIspolcomUoW(_currentProject,
                                                  _repository,
                                                  _userNotification,
                                                  _adminNotification,
                                                  _investorNotification,
                                                  _userName,
                                                  _roles);
            WaitInvolvedUoW = new WaitInvolvedUoW(_currentProject,
                                                  _repository,
                                                  _userNotification,
                                                  _adminNotification,
                                                  _investorNotification,
                                                  _userName,
                                                  _roles);
            WaitComissionUoW = new WaitComissionUoW(_currentProject,
                                                    _repository,
                                                    _userNotification,
                                                    _adminNotification,
                                                    _investorNotification,
                                                    _userName,
                                                    _roles);
            RealizationUoW = new RealizationUoW(_currentProject,
                                                _repository,
                                                _userNotification,
                                                _adminNotification,
                                                _investorNotification,
                                                _userName,
                                                _roles);
            PlanCreatingUoW = new PlanCreatingUoW(_currentProject,
                                                  _repository,
                                                  _userNotification,
                                                  _adminNotification,
                                                  _investorNotification,
                                                  _userName,
                                                  _roles);
            OnIspolcomUoW = new OnIspolcomUoW(_currentProject,
                                              _repository,
                                              _userNotification,
                                              _adminNotification,
                                              _investorNotification,
                                              _userName,
                                              _roles);
            OnComissionUoW = new OnComissionUoW(_currentProject,
                                                _repository,
                                                _userNotification,
                                                _adminNotification,
                                                _investorNotification,
                                                _userName,
                                                _roles);
            MinEconomyUoW = new MinEconomyUoW(_currentProject,
                                              _repository,
                                              _userNotification,
                                              _adminNotification,
                                              _investorNotification,
                                              _userName,
                                              _roles);
            IspolcomFixesUoW = new IspolcomFixesUoW(_currentProject,
                                                    _repository,
                                                    _userNotification,
                                                    _adminNotification,
                                                    _investorNotification,
                                                    _userName,
                                                    _roles);
            InvolvedorganizationsUoW = new InvolvedOrganizationsUoW(_currentProject,
                                                                    _repository,
                                                                    _userNotification,
                                                                    _adminNotification,
                                                                    _investorNotification,
                                                                    _userName,
                                                                    _roles);
            DocumentSendingUoW = new DocumentSendingUoW(_currentProject,
                                                        _repository,
                                                        _userNotification,
                                                        _adminNotification,
                                                        _investorNotification,
                                                        _userName,
                                                        _roles);
            ComissionFixesUoW = new ComissionFixesUoW(_currentProject,
                                                      _repository,
                                                      _userNotification,
                                                      _adminNotification,
                                                      _investorNotification,
                                                      _userName,
                                                      _roles);
            DoneUoW = new DoneUoW(_currentProject,
                                  _repository,
                                  _userNotification,
                                  _adminNotification,
                                  _investorNotification,
                                  _userName,
                                  _roles);

            var dict = new Dictionary <Type, IState>();

            dict.Add(OnMapUoW.GetType(), OnMapUoW);
            AttributeStateMachineBuilder.InitializeStates(dict);
        }
Example #22
0
 public void Notify(IUserNotification notification)
 {
     // 内部データを通知
     notification.Id(Id);
     notification.Name(Name);
 }