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 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)));*/ }
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; }
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 }) { }
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); }