public void GetDataFromCacheTest() { var list = TableCacheHelper.GetDataFromCache <Workflow>(typeof(WorkflowDao)); if (list.Count == 0) { return; } WorkflowDao dao = new WorkflowDao(); string key = typeof(Workflow).FullName; var item = cache.GetItem(key); CacheEntity <Workflow> cacheentity = item.Value as CacheEntity <Workflow>; Assert.IsNotNull(item); Assert.AreEqual(list, cacheentity.List); DateTime dt = DateTime.Now; dao.Update(new WorkflowUpdateForm { Entity = new Workflow { LastUpdateTime = dt }, WorkflowQueryForm = new WorkflowQueryForm { ID = list[0].ID } }); list = TableCacheHelper.GetDataFromCache <Workflow>(typeof(WorkflowDao)); item = cache.GetItem(key); cacheentity = item.Value as CacheEntity <Workflow>; Assert.AreEqual(dt.ToString("yyyyMMddHHmmss"), cacheentity.LastUpdateTime.Value.ToString("yyyyMMddHHmmss")); }
public void TestWorkflowUpdate() { WorkflowQueryForm form = new WorkflowQueryForm { ID = "11", }; var list = dao.Query(form); WorkflowUpdateForm updateform = new WorkflowUpdateForm { Entity = new Workflow { Status = 1 }, WorkflowQueryForm = new WorkflowQueryForm { ID = list[0].ID, }, }; var statement = dao.Mapper.GetMappedStatement("UpdateWorkflow"); if (!dao.Mapper.IsSessionStarted) { dao.Mapper.OpenConnection(); } RequestScope scope = statement.Statement.Sql.GetRequestScope(statement, updateform, dao.Mapper.LocalSession); string result = scope.PreparedStatement.PreparedSql; dao.Update(updateform); list = dao.Query(form); Assert.AreEqual(1, list[0].Status); }
/// <summary> /// 作废(停止)流程 /// </summary> /// <param name="taskid"></param> /// <param name="processor"></param> public void Stop(string processor) { if (this.CurrentActivity != null) { ISqlMapper mapper = MapperHelper.GetMapper(); WorkflowDao wfdao = new WorkflowDao(mapper); TaskDao taskdao = new TaskDao(mapper); this.value.Status = (int)WorkflowProcessStatus.Stoped; this.value.LastUpdator = processor; wfdao.Update(new WorkflowUpdateForm { Entity = new Workflow { LastUpdator = this.value.LastUpdator, Status = this.value.Status, }, WorkflowQueryForm = new WorkflowQueryForm { ID = this.value.ID, } }); taskdao.Update(new TaskUpdateForm { Entity = new Task { Status = (int)TaskProcessStatus.Stoped }, TaskQueryForm = new TaskQueryForm { ActivityID = this.CurrentActivity.Value.ID } }); } }
/// <summary> /// 继续流程 /// </summary> /// <param name="lastupdator"></param> public void ContinueWorkflow(string lastupdator) { ISqlMapper mapper = MapperHelper.GetMapper(); WorkflowDao workflowdao = new WorkflowDao(mapper); this.value.LastUpdator = lastupdator; this.value.Status = (int)WorkflowProcessStatus.Processing; workflowdao.Update(new WorkflowUpdateForm { Entity = new Workflow { Status = this.value.Status, LastUpdator = this.value.LastUpdator, }, WorkflowQueryForm = new WorkflowQueryForm { ID = this.value.ID } }); }
/// <summary> /// 结束流程 /// </summary> /// <param name="lastupdator"></param> public void FinishWorkflow(string lastupdator) { ISqlMapper mapper = MapperHelper.GetMapper(); WorkflowDao workflowdao = new WorkflowDao(mapper); this.value.LastUpdator = lastupdator; this.value.Status = (int)WorkflowProcessStatus.Processed; workflowdao.Update(new WorkflowUpdateForm { Entity = new Workflow { Status = this.value.Status, LastUpdator = this.value.LastUpdator, }, WorkflowQueryForm = new WorkflowQueryForm { ID = this.value.ID } }); }
public void GetDataFromCacheTest() { var list = TableCacheHelper.GetDataFromCache<Workflow>(typeof(WorkflowDao)); if (list.Count == 0) { return; } WorkflowDao dao = new WorkflowDao(); string key = typeof(Workflow).FullName; var item = cache.GetItem(key); CacheEntity<Workflow> cacheentity = item.Value as CacheEntity<Workflow>; Assert.IsNotNull(item); Assert.AreEqual(list, cacheentity.List); DateTime dt = DateTime.Now; dao.Update(new WorkflowUpdateForm { Entity = new Workflow { LastUpdateTime = dt }, WorkflowQueryForm = new WorkflowQueryForm { ID = list[0].ID } }); list = TableCacheHelper.GetDataFromCache<Workflow>(typeof(WorkflowDao)); item = cache.GetItem(key); cacheentity = item.Value as CacheEntity<Workflow>; Assert.AreEqual(dt.ToString("yyyyMMddHHmmss"), cacheentity.LastUpdateTime.Value.ToString("yyyyMMddHHmmss")); }