public void TestManageRejectWorkFlow() { var appEntity = new AppInfoModel { ActivityState = "Submit", AppId = "004", AppName = "TestApp", WorkflowName = "TestStateWorkFlow", UserId = "004", CurrentState = "Common" }; var result = WfServiceInstance.NewWorkFlow(appEntity); Assert.AreEqual(result, "Manage"); var manageEntity = new AppInfoModel { ActivityState = "Reject", AppId = "004", AppName = "TestApp", WorkflowName = "TestStateWorkFlow", UserId = "005", CurrentState = "Manage" }; var manageResult = WfServiceInstance.Execute(manageEntity); Assert.AreEqual(manageResult, "Refuse"); }
public void TestNewWorkflow() { var appEntity = new AppInfoModel { ActivityState = "Submit", AppName = "TestApp", AppId = "001", WorkflowName = "TestStateWorkFlow", UserId = "001", CurrentState = "Common" }; var result = WfServiceInstance.NewWorkFlow(appEntity); Assert.AreEqual(result, "Manage"); }
public string Execute(AppInfoModel entity) { var activityEntity = WorkFlowActivityDAL.Current.QueryByAppId(entity.AppId); var currentWorkFlowState = WfeInstance.Execute(entity.WorkflowName, entity.CurrentState, entity.ActivityState); activityEntity.ForeWorkflowState = activityEntity.CurrentWorkflowState; activityEntity.CurrentWorkflowState = currentWorkFlowState; activityEntity.OperatorUserId = entity.UserId; activityEntity.OperatorUserList += entity.UserId + WFConstants.SplitCharacterTag; activityEntity.LastUpdateDateTime = DateTime.Now; activityEntity.ApplicationState = GetApplicationStateByWorkFlowActivityEntity(activityEntity).ToString(); activityEntity.OperatorActivity = entity.ActivityState; activityEntity.WorkflowName = entity.WorkflowName; if(!string.IsNullOrEmpty(entity.AppName)) activityEntity.AppName = entity.AppName; DataOperationBLL.Current.Modify(activityEntity); CheckApplicationState(activityEntity); return currentWorkFlowState; }
public string NewWorkFlow(AppInfoModel entity) { var activityEntity = new WorkFlowActivityModel { ForeWorkflowState = entity.CurrentState, OperatorActivity = entity.ActivityState, LastUpdateDateTime = DateTime.Now, AppId = entity.AppId, CreateDateTime = DateTime.Now, CreateUserId = entity.UserId, OperatorUserId = entity.UserId, WorkflowName = entity.WorkflowName, AppName = entity.AppName, OperatorUserList = entity.UserId + WFConstants.SplitCharacterTag, }; WfeInstance.InitWorkflowState(entity.WorkflowName); var currentWorkFlowState = WfeInstance.Execute(entity.WorkflowName, string.Empty, entity.ActivityState); activityEntity.CurrentWorkflowState = currentWorkFlowState; activityEntity.ApplicationState = currentWorkFlowState; DataOperationBLL.Current.Insert(activityEntity); return currentWorkFlowState; }
public void TestWorkflowAppState() { var appEntity = new AppInfoModel { ActivityState = "Submit", AppId = "009", AppName = "TestApp", WorkflowName = "TestStateWorkFlow", UserId = "009", CurrentState = "Common" }; var firstState = WfServiceInstance.GetApplicationStateByAppId(appEntity.AppId); Assert.AreEqual(firstState,ApplicationState.Draft); var result = WfServiceInstance.NewWorkFlow(appEntity); Assert.AreEqual(result, "Manage"); var secondState = WfServiceInstance.GetApplicationStateByAppId(appEntity.AppId); Assert.AreEqual(secondState, ApplicationState.InProgress); var commonEntity = new AppInfoModel { ActivityState = "Approve", AppId = "009", AppName = "TestApp", WorkflowName = "TestStateWorkFlow", UserId = "009", CurrentState = "Manage" }; var approveResult = WfServiceInstance.Execute(commonEntity); Assert.AreEqual(approveResult, "Done"); var thirdState = WfServiceInstance.GetApplicationStateByAppId(appEntity.AppId); Assert.AreEqual(thirdState, ApplicationState.Complete); }
public void TestResubmitWorkflow() { var appEntity = new AppInfoModel { ActivityState = "Submit", AppId = "008", AppName = "TestApp", WorkflowName = "TestStateWorkFlow", UserId = "008", CurrentState = "Common" }; var result = WfServiceInstance.NewWorkFlow(appEntity); Assert.AreEqual(result, "Manage"); var commonEntity = new AppInfoModel { ActivityState = "Revoke", AppId = "008", AppName = "TestApp", WorkflowName = "TestStateWorkFlow", UserId = "008", CurrentState = "Common" }; var revokeResult = WfServiceInstance.Execute(commonEntity); Assert.AreEqual(revokeResult, "Common"); var resubmitEntity = new AppInfoModel { ActivityState = "Resubmit", AppId = "008", AppName = "TestApp", WorkflowName = "TestStateWorkFlow", UserId = "008", CurrentState = "Common" }; var lastResult = WfServiceInstance.Execute(resubmitEntity); Assert.AreEqual(lastResult, "Manage"); }
public string NewWorkFlow(AppInfoModel entity) { return WorkFlowEngineInstance.NewWorkFlow(entity); }
public string Execute(AppInfoModel entity) { return WorkFlowEngineInstance.Execute(entity); }