public IEnumerable<string> GetFilterTaskResult(DraftFilterTaskDto draftFilterTask) { using (var context = RepositoryContext.Create()) { var repository = context.GetRepository<DraftFilterTaskRepository>(); var filtertask = repository.Get(draftFilterTask.Id); return filtertask.Result.ConditionResult.SelectedStocks.ToArray(); } }
public void ExecFilterTaskImmediatly(DraftFilterTaskDto draftFilterTaskDto) { using (var context = RepositoryContext.Create()) { var repository = context.GetRepository<DraftFilterTaskRepository>(); var filtertask = repository.Get(draftFilterTaskDto.Id); _engine.ExecFilterTaskImmediatly(filtertask); } }
public void UpdateDraftFilterTask(DraftFilterTaskDto draftFilterTask) { using (var context = RepositoryContext.Create()) { var filtertask = draftFilterTask.ProjectedAs<DraftFilterTask>(); var repository = context.GetRepository<DraftFilterTaskRepository>(); repository.UpdateFilterTask(filtertask); context.UnitOfWork.Commit(); } }
public void AddDraftFilterTask(DraftFilterTaskDto draftFilterTask, int userId) { using (var context = RepositoryContext.Create()) { var filtertask = ConvertNew(draftFilterTask, userId); var repository = context.GetRepository<DraftFilterTaskRepository>(); repository.Add(filtertask); context.UnitOfWork.Commit(); } }
public void AddDraftFilterTaskTest() { var taskdto = new DraftFilterTaskDto { Name = "DraftTask", Condition = new FilterConditionDto { Name = "DraftTaskConditon", ExpressionString = "成交量>100", Indicators = new List<IndicatorDto> { new IndicatorDto { Name = "成交量" } } } }; var service = new FilterTaskAppService(); service.AddDraftFilterTask(taskdto, 0); using (var context = RepositoryContext.Create()) { var repository = context.GetRepository<DraftFilterTaskRepository>(); var task = repository.GetAll().FirstOrDefault(); Assert.IsNotNull(task); } }
private DraftFilterTask ConvertNew(DraftFilterTaskDto draftFilterTask, int userId) { var idgenerator = ContainerHelper.Instance.Resolve<IIdentityGenerator>(); var filtertask = draftFilterTask.ProjectedAs<DraftFilterTask>(); var conditionid = idgenerator.NewGuid().ToString(); var expression = new FilterExpression(conditionid, filtertask.Condition.Expression.ExpressionString, null); expression.UpdateFrom(filtertask.Condition.Expression); return new DraftFilterTask(idgenerator.NewGuid().ToString()) { Name = filtertask.Name, Condition = new FilterCondition(conditionid, userId, expression) { Name = filtertask.Condition.Name, Description = filtertask.Condition.Description, CutoffTime = filtertask.Condition.CutoffTime } }; }
public void GetAllDraftFilterTasksTest() { var taskdto = new DraftFilterTaskDto { Name = "DraftTask", Condition = new FilterConditionDto { Name = "DraftTaskConditon", ExpressionString = "成交量>100", Indicators = new List<IndicatorDto> { new IndicatorDto { Name = "成交量" } } } }; var service = new FilterTaskAppService(); service.AddDraftFilterTask(taskdto, 0); var tasks = service.GetAllDraftFilterTasks(0).ToList(); Assert.IsNotNull(tasks); Assert.AreEqual(1, tasks.Count); }