Ejemplo n.º 1
0
        public JsonResult GetTasks(TasksSearchQuery data)
        {
            TasksService tasksService = new TasksService(Shared.API_KEY);
            List <Task>  allTasks     = new List <Task>();

            Task[]     tasks = null;
            BusyTask[] startedAndCompleted = null,
            started   = null,
            completed = null;

            foreach (var item in data.Workspaces)
            {
                tasks = tasksService.GetTasks(new TasksQuery()
                {
                    AssigneeId = Shared.Me.Id, WorkspaceId = item, ReturnCompleteTaskRecords = true
                });
                if (tasks != null && tasks.Length > 0)
                {
                    allTasks.AddRange(tasks);
                }
            }

            GetTasks(DateTime.Parse(data.Start), DateTime.Parse(data.End), allTasks, out startedAndCompleted, out started, out completed);

            TasksSearchResults results = new TasksSearchResults()
            {
                StartedDuringRange             = started,
                CompletedDuringRange           = completed,
                StartedAndCompletedDuringRange = startedAndCompleted
            };

            return(Json(results));
        }
Ejemplo n.º 2
0
 private IEnumerable <Task> FilterDeliveryNumber(TasksSearchQuery tasksSearchQuery, IEnumerable <Task> tasks)
 {
     if (!string.IsNullOrEmpty(tasksSearchQuery.DeliveryNumber))
     {
         tasks = tasks.Where(item => (item.DeliveryNumber.Equals(tasksSearchQuery.DeliveryNumber)));
     }
     return(tasks);
 }
Ejemplo n.º 3
0
 private IEnumerable <Task> FilterTime(TasksSearchQuery tasksSearchQuery, IEnumerable <Task> tasks)
 {
     if (tasksSearchQuery.LastModified.HasValue)
     {
         tasks = tasks.Where(item => (item.LastModified >= tasksSearchQuery.LastModified.Value));
     }
     return(tasks);
 }
Ejemplo n.º 4
0
 private IEnumerable <Task> FilterRowStatus(TasksSearchQuery tasksSearchQuery, IEnumerable <Task> tasks)
 {
     if (tasksSearchQuery.RowStatus.HasValue)
     {
         tasks = tasks.Where(item => (item.RowStatus == tasksSearchQuery.RowStatus.Value));
     }
     return(tasks);
 }
Ejemplo n.º 5
0
 private IEnumerable <Task> FilterCompanyId(TasksSearchQuery tasksSearchQuery, IEnumerable <Task> tasks)
 {
     if (tasksSearchQuery.CompanyId.HasValue)
     {
         tasks = tasks.Where(item => (item.Company.Id == tasksSearchQuery.CompanyId.Value));
     }
     return(tasks);
 }
Ejemplo n.º 6
0
        // GET api/Task?deliveryNumber={deliveryNumber}
        public Task GetByDeliveryNumber(string deliveryNumber)
        {
            var tasksSearchQuery = new TasksSearchQuery();

            tasksSearchQuery.DeliveryNumber = deliveryNumber;
            var result = m_taskManager.GetEntities(tasksSearchQuery);

            return(result.FirstOrDefault());
        }
Ejemplo n.º 7
0
        // GET api/Task?companyId={companyId}&lastModified={lastModified}
        public IEnumerable <Task> GetByCompanyId(int companyId, DateTime?lastModified)
        {
            var tasksSearchQuery = new TasksSearchQuery();

            tasksSearchQuery.CompanyId    = companyId;
            tasksSearchQuery.LastModified = lastModified;
            tasksSearchQuery.RowStatus    = 0;
            var result = m_taskManager.GetEntities(tasksSearchQuery);

            return(result);
        }
Ejemplo n.º 8
0
        public async Task <TasksSearchQueryResult> Handle(TasksSearchQuery query)
        {
            var esstask = (await taskRepository.QueryTask(new TaskQuery
            {
                ById = query.TaskId
            })).Items;
            var esstasks = mapper.Map <IEnumerable <IncidentTask> >(esstask);

            return(new TasksSearchQueryResult {
                Items = esstasks
            });
        }
Ejemplo n.º 9
0
        private bool QueryTask(MongoDbTask mongoDbTask, TasksSearchQuery taskSearchQuery)
        {
            var result = false;

            if (mongoDbTask.LastModified >= taskSearchQuery.LastModified)
            {
                result = true;
            }
            if (result && mongoDbTask.RowStatus == 1)
            {
                result = false;
            }

            return(result);
        }