public async Task LoadWorkLog(int id) { DisableCodeHubMode(); var found = await WorkLogsService.GetWorkLogForEdit(id); if (found.TaskId > 0 && found.ProviderType == StaticWorkProviderTypes.DevOps || found.ProviderType == StaticWorkProviderTypes.Zammad) { SelectedTask = WorkItems.FirstOrDefault(s => s.Id == found.TaskId); } else if (found.Id > 0 && found.ProviderType == StaticWorkProviderTypes.CodeHub) { await EnableCodeHubMode(); if (found.Epic != null) { await OrganizationChanged(found.Epic.Project.OrganizationId); ProjectChanged(found.Epic.ProjectId); } } Entity = found; WorkedDateHelper = DateTimeHelpers.GetFormattedTime(Entity.Hours); StateHasChanged(); }
public bool BackToTask(int taskId) { return(LockExecute <bool>(() => { var items = Dao.Get().Delete <WorkflowItem>().Where(o => o.ItemId > taskId).Execute();// WorkItems.Where(o => o.ItemId > taskId).ToList(); if (items == 0) { return false; } var currentItem = WorkItems.FirstOrDefault(o => o.ItemId == taskId); currentItem.OpinionContent = string.Empty; currentItem.FinishTime = null; currentItem.Status = WorkItemStatus.Sent; return UpdateWorkItem(currentItem) == 1; })); }
private string GetWorkLogFeature(WorkLog workLog) { if (WorkItems == null || WorkItems.Count == 0) { return("Loading..."); } if (workLog.ProviderType == StaticWorkProviderTypes.CodeHub) { return(""); } else if (workLog.ProviderType == StaticWorkProviderTypes.DevOps) { var codeHubWorkItem = WorkItems.FirstOrDefault(s => s.Id == workLog.TaskId && workLog.OrganizationId == s.OrganizationId); return(codeHubWorkItem?.Parent?.Title ?? "Task Deleted"); } else if (workLog.ProviderType == StaticWorkProviderTypes.Zammad) { return("Support"); } return("Unknown Provider"); }
public WorkItem ReadWorkItem(string id) { return(WorkItems.FirstOrDefault((a) => a.Id.Equals(id))); //return workItemDAO.Read(id); }
public void SelectWorkItemById(Guid id) { CurrentWorkItem = WorkItems.FirstOrDefault(w => w.Id == id); }
private void GetData(bool skipCache, bool skipTFS) { if (IsWorking) { return; } IsWorking = true; int?lastId = null; if (!skipCache) { lock (SqliteConnection) { SqliteConnection.Open(); Debug.WriteLine("Getting HistoryItems from Cache"); var historyItems = DBLoader.GetHistoryItems(); if (historyItems.Any()) { HistoryItems.AddRangeWithoutNotification(historyItems); /*foreach (var item in historyItems) * { * item.GotWorkItems += ItemOnGotWorkItems; * }*/ } Debug.WriteLine($"Got {historyItems.Count()} HistoryItems from Cache"); if (historyItems.Any()) { lastId = historyItems.Max(x => x.ChangeSetId); } Debug.WriteLine("Getting WorkItems from Cache"); var workItems = DBLoader.GetWorkItems(Settings); if (workItems.Any()) { WorkItems.AddRangeWithoutNotification(workItems); } Debug.WriteLine($"Got {workItems.Count()} WorkItems from Cache"); SqliteConnection.Close(); // Resolve CachedWorkItems in HistoryItems foreach (var item in HistoryItems) { var resolvedWorkItems = new List <WorkItem>(); foreach (int id in item.CachedWorkItemIds) { var resolvedWorkItem = WorkItems.FirstOrDefault(x => x.Id == id); if (resolvedWorkItem != null) { resolvedWorkItems.Add(resolvedWorkItem); } } item.CachedWorkItems = resolvedWorkItems.ToArray(); item.CachedWorkItemIds = resolvedWorkItems.Select(x => x.Id).ToArray(); } HistoryItems.NotifyReset(); WorkItems.NotifyReset(); } } if (!skipTFS) { GetDataFromTfs(lastId, lastId.HasValue ? Int32.MaxValue : InitialItemSize); } IsWorking = false; }