public OnIspolcomUoW(ProjectStateContext context)
     : base(context.CurrentProject,
            context.Repository,
            context.UserNotification,
            context.AdminNotification,
            context.InvestorNotification,
            context.UserName,
            context.Roles)
 {
     Context = context;
 }
 public InvolvedOrganizationsUoW(ProjectStateContext context)
     : base(context.CurrentProject,
            context.Repository,
            context.UserNotification,
            context.AdminNotification,
            context.InvestorNotification,
            context.UserName,
            context.Roles)
 {
     Context = context;
 }
Exemplo n.º 3
0
        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));
        }