public void Export(int[] projectId, int[] categoryId, int[] statusId, int?sprintId, int[] assignedTo, string completedDate, string modifiedDate, string createdDate, int?isArchived, string text, string sortBy, string sortOrder) { var criteria = new TaskCriteria() { ProjectId = projectId, SprintId = sprintId, CategoryId = categoryId, StatusId = statusId, AssignedTo = assignedTo, CompletedDate = new DateRangeCriteria(completedDate ?? string.Empty), ModifiedDate = new DateRangeCriteria(modifiedDate ?? string.Empty), CreatedDate = new DateRangeCriteria(createdDate ?? string.Empty), IsArchived = DataHelper.ToBoolean(isArchived, false), Text = text }; var tasks = TaskService.TaskFetchInfoList(criteria) .AsQueryable(); tasks = tasks.OrderBy(string.Format("{0} {1}", sortBy ?? "TaskId", sortOrder ?? "ASC")); var sw = new StringWriter(); sw.WriteLine( "TaskId,ProjectName,SprintName,CategoryName,StatusName,Description,AssignedToName,AssignedDate,StartDate,CompletedDate,EstimatedCompletedDate,Duration,EstimatedDuration,Labels,IsArchived,Notes,ModifiedByName,ModifiedDate,CreatedByName,CreatedByDate"); foreach (var task in tasks) { var sb = new StringBuilder(); sb.AppendFormat("{0},", task.TaskId); sb.AppendFormat("\"{0}\",", task.ProjectName); sb.AppendFormat("\"{0}\",", task.SprintName); sb.AppendFormat("{0},", task.CategoryName); sb.AppendFormat("{0},", task.StatusName); sb.AppendFormat("\"{0}\",", task.Description.Replace("\"", "'")); sb.AppendFormat("{0},", task.AssignedToName); sb.AppendFormat("{0},", task.AssignedDate); sb.AppendFormat("{0},", task.StartDate); sb.AppendFormat("{0},", task.CompletedDate); sb.AppendFormat("{0},", task.EstimatedCompletedDate); sb.AppendFormat("{0},", task.Duration); sb.AppendFormat("{0},", task.EstimatedDuration); sb.AppendFormat("\"{0}\",", task.Labels); sb.AppendFormat("{0},", task.IsArchived); sb.AppendFormat("\"{0}\",", task.Notes); sb.AppendFormat("{0},", task.ModifiedByName); sb.AppendFormat("{0},", task.ModifiedDate); sb.AppendFormat("{0},", task.CreatedByName); sb.AppendFormat("{0}", task.CreatedDate); sw.WriteLine(sb.ToString()); } this.Response.AddHeader("Content-Disposition", "attachment; filename=Stories.csv"); this.Response.ContentType = "application/ms-excel"; this.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); this.Response.Write(sw); this.Response.End(); }
public CustomerTaskResult GetCustomerReminders(Guid custId, TaskCriteria criteria) { if (criteria == null) criteria = new TaskCriteria { Page = 1, PageSize = 10 }; var taskQuery = _clientFactory.GetTaskQueryServiceClient(); var results = taskQuery.QueryTaskListByCustomerId(new CustomerIdParameters { CustomerId = custId, Page = criteria.Page, PageSize = 500, //REVIEW: Pulling them all down until quartet can be updated with additional filters or elastic search is adopted SortOptions = new SortOption[] { new SortOption { Direction = SortDirection.Descending, Name = "CreatedDateUtc" } } }); if (criteria.IsComplete.HasValue) { results = results.Where(t => t.IsComplete == criteria.IsComplete.Value).ToArray(); } //REVIEW: Pulling them all down until quartet can be updated with additional filters or elastic search is adopted var count = results.Length; results = results.Take(criteria.PageSize).ToArray(); var mappedResults = new List<CustomerTaskContent>(); foreach (var result in results) mappedResults.Add(_taskMapping.Map(result)); return new CustomerTaskResult { Tasks = mappedResults.ToArray(), Count = count }; }
public static TaskInfoList TaskFetchInfoList(TaskCriteria criteria) { return(TaskInfoList.FetchTaskInfoList(criteria)); }
public ActionResult Index(int[] projectId, int[] categoryId, int[] statusId, int?sprintId, int[] assignedTo, string completedDate, string modifiedDate, string createdDate, int?isArchived, string label, string text, string sortBy, string sortOrder) { var model = new TaskIndexModel(); model.Tab = "Task"; model.Projects = DataHelper.GetProjectList(); model.ProjectId = projectId ?? new int[0]; model.ProjectName = DataHelper.ToString(model.Projects, model.ProjectId, "any project"); model.ProjectDisplayName = DataHelper.Clip(model.ProjectName, 40); model.Categories = DataHelper.GetCategoryList(); model.CategoryId = categoryId ?? new int[0]; model.CategoryName = DataHelper.ToString(model.Categories, model.CategoryId, "any category"); model.CategoryDisplayName = DataHelper.Clip(model.CategoryName, 20); model.Statuses = DataHelper.GetStatusList(); model.StatusId = statusId ?? new int[0]; model.StatusName = DataHelper.ToString(model.Statuses, model.StatusId, "any status"); model.StatusDisplayName = DataHelper.Clip(model.StatusName, 20); model.AssignedToUsers = DataHelper.GetUserList(); model.AssignedTo = assignedTo ?? new int[0]; model.AssignedToName = DataHelper.ToString(model.AssignedToUsers, model.AssignedTo, "any user"); model.AssignedToDisplayName = DataHelper.Clip(model.AssignedToName, 20); model.Label = label; model.IsArchived = isArchived ?? 0; model.Filters = MyService.FilterFetchInfoList("Task"); model.SortBy = sortBy ?? "TaskId"; model.SortOrder = sortOrder ?? "ASC"; model.SortableColumns.Add("EstimatedCompletedDate", "Due"); model.SortableColumns.Add("ProjectName", "Project"); model.SortableColumns.Add("AssignedToName", "User"); model.SortableColumns.Add("StatusName", "Status"); model.SortableColumns.Add("TaskId", "No."); model.LabelByCountListModel = new LabelByCountListModel { Action = "Task", Label = label, Labels = DataHelper.GetTaskLabelByCountList() }; var criteria = new TaskCriteria() { ProjectId = projectId, SprintId = sprintId, CategoryId = categoryId, StatusId = statusId, AssignedTo = assignedTo, CompletedDate = new DateRangeCriteria(completedDate ?? string.Empty), ModifiedDate = new DateRangeCriteria(modifiedDate ?? string.Empty), CreatedDate = new DateRangeCriteria(createdDate ?? string.Empty), IsArchived = DataHelper.ToBoolean(isArchived), TaskLabels = string.IsNullOrEmpty(label) ? null : new[] { label }, Text = text }; var tasks = TaskService.TaskFetchInfoList(criteria) .AsQueryable(); tasks = tasks.OrderBy(string.Format("{0} {1}", model.SortBy, model.SortOrder)); model.Tasks = tasks; var hours = HourService.HourFetchInfoList(tasks.Cast <ITask>().ToArray()); model.Hours = hours; return(RespondTo(format => { format[RequestExtension.Html] = () => this.View(model); format[RequestExtension.Xml] = () => new XmlResult { Data = model.Tasks.ToList(), TableName = "Task" }; format[RequestExtension.Json] = () => new JsonResult { Data = model.Tasks, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; })); }