Beispiel #1
0
        private void LoadTaskCreateAndModifyTime(UTrackTask task)
        {
            string url = string.Format("https://ustr-vm-0315.na.uis.unisys.com:8443/uTrack/TaskAdmin?tid={0}", task.ID);

            HtmlAgilityPack.HtmlNode htmlNode = FeatureData(url);

            var allRow = htmlNode.Descendants().Where(t => t.Attributes.Contains("class") && t.Attributes["class"].Value == "row").ToList();

            if (allRow.Any())
            {
                var createLabelText   = SpiderUtil.TrimHtmlTag(allRow[10].InnerText);
                var modifiedLabelText = SpiderUtil.TrimHtmlTag(allRow[11].InnerText);
                var createdLable      = createLabelText.Substring(createLabelText.Length - 10, 10);
                var modifiedLabel     = modifiedLabelText.Substring(modifiedLabelText.Length - 10, 10);

                task.CreatedOwner  = createLabelText.Substring(0, createLabelText.Length - 10).Replace("Created:", string.Empty).Trim();
                task.ModifiedOwner = modifiedLabelText.Substring(0, modifiedLabelText.Length - 10).Replace("Modified:", string.Empty).Trim();
                if (string.IsNullOrEmpty(task.ModifiedOwner))
                {
                    task.ModifiedOwner = task.CreatedOwner;
                }
                task.Created  = DateTime.Parse(createdLable);
                task.Modified = DateTime.Parse(modifiedLabel);
            }
        }
Beispiel #2
0
        private void LoadStoryTaskInfomation(Story story)
        {
            string url = string.Format("https://ustr-vm-0315.na.uis.unisys.com:8443/uTrack/TaskList?fid={0}", story.ID);

            HtmlAgilityPack.HtmlNode htmlNode = FeatureData(url);

            var taskList = htmlNode.Descendants().Where(t => t.Name == "tr").ToList();

            bool alreadySkippedHeader = false;

            foreach (var taskItem in taskList)
            {
                if (!alreadySkippedHeader)
                {
                    alreadySkippedHeader = true;
                    continue;
                }

                var taskItemColumn = taskItem.ChildNodes.Where(t => t.Name == "td").ToList();
                var Id             = SpiderUtil.TrimHtmlTag(taskItemColumn[0].ChildNodes.Where(t => t.Name == "a").ToList().First().InnerText);
                if (string.IsNullOrEmpty(Id))
                {
                    Id = SpiderUtil.TrimHtmlTag(taskItemColumn[0].ChildNodes.First().InnerText);
                }
                var     name     = SpiderUtil.TrimHtmlTag(taskItemColumn[1].ChildNodes.First().InnerText);
                var     type     = SpiderUtil.TrimHtmlTag(taskItemColumn[2].Attributes["title"].Value);
                var     priority = int.Parse(SpiderUtil.TrimHtmlTag(taskItemColumn[3].InnerText));
                var     owner    = SpiderUtil.TrimHtmlTag(taskItemColumn[4].ChildNodes.Last().InnerText);
                var     status   = SpiderUtil.TrimHtmlTag(taskItemColumn[5].Attributes["title"].Value);
                decimal estimate = decimal.Parse(SpiderUtil.TrimHtmlTag(taskItemColumn[6].InnerText));
                decimal workDone = decimal.Parse(SpiderUtil.TrimHtmlTag(taskItemColumn[7].InnerText));
                decimal workTodo = decimal.Parse(SpiderUtil.TrimHtmlTag(taskItemColumn[8].InnerText));

                UTrackTask task = new UTrackTask();
                task.ID          = Id;
                task.Description = name;
                task.Type        = ConvertToTaskType(type);
                task.Priority    = priority;
                task.Owner       = owner;
                task.Status      = (Unisys.Trend.DataModel.TaskStatus)Enum.Parse(typeof(Unisys.Trend.DataModel.TaskStatus), status.Replace(" ", ""));
                task.Estimate    = estimate;
                task.WorkDone    = workDone;
                task.WorkToDo    = workTodo;

                if (story.Status == StoryStatus.Done || story.Status == StoryStatus.Pending || story.Status == StoryStatus.InProcess)
                {
                    LoadTaskCreateAndModifyTime(task);
                }

                story.Tasks.Add(task);
            }
        }
        private bool AnalyzeTaskDiff(UTrackTask task, UTrackTask lastTask, ref string detail)
        {
            if (task.Description != lastTask.Description)
            {
                detail += $"{twoSpaces}Changed Description from '{lastTask.Description}' to '{task.Description}'{Breakline}";
            }
            if (task.Estimate != lastTask.Estimate)
            {
                detail += $"{twoSpaces}Changed Estimate from '{lastTask.Estimate}' to '{task.Estimate}'{Breakline}";
            }
            if (task.WorkDone != lastTask.WorkDone)
            {
                detail += $"{twoSpaces}Changed WorkDone from '{lastTask.WorkDone}' to '{task.WorkDone}'{Breakline}";
            }
            if (task.WorkToDo != lastTask.WorkToDo)
            {
                detail += $"{twoSpaces}Changed WorkToDo from '{lastTask.WorkToDo}' to '{task.WorkToDo}'{Breakline}";
            }
            if (task.Type != lastTask.Type)
            {
                detail += $"{twoSpaces}Changed Type from '{lastTask.Type.ToString()}' to '{task.Type.ToString()}'{Breakline}";
            }
            if (task.Owner != lastTask.Owner)
            {
                detail += $"{twoSpaces}Changed Owner from '{lastTask.Owner}' to '{task.Owner}'{Breakline}";
            }

            if (task.Status != lastTask.Status)
            {
                detail += $"{twoSpaces}Changed Status from '{lastTask.Status.ToString()}' to '{task.Status.ToString()}'{Breakline}";
            }

            if (string.IsNullOrEmpty(detail))
            {
                return(false);
            }
            return(true);
        }