本文整理汇总了C#中WorkItem.LeanKitDescription方法的典型用法代码示例。如果您正苦于以下问题:C# WorkItem.LeanKitDescription方法的具体用法?C# WorkItem.LeanKitDescription怎么用?C# WorkItem.LeanKitDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorkItem
的用法示例。
在下文中一共展示了WorkItem.LeanKitDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WorkItemUpdated
private void WorkItemUpdated(WorkItem workItem, Card card, BoardMapping project)
{
Log.Info("WorkItem [{0}] updated, comparing to corresponding card...", workItem.Id);
var boardId = project.Identity.LeanKit;
// sync and save those items that are different (of title, description, priority)
var saveCard = false;
if (workItem.Title != card.Title)
{
card.Title = workItem.Title;
saveCard = true;
}
var description = workItem.LeanKitDescription(GetTfsVersion());
if (description != card.Description)
{
card.Description = description;
saveCard = true;
}
var priority = workItem.LeanKitPriority();
if(priority!= card.Priority)
{
card.Priority = priority;
saveCard = true;
}
if(workItem.Fields!=null &&
workItem.Fields.Contains("Tags") &&
workItem.Fields["Tags"] != null &&
workItem.Fields["Tags"].Value.ToString() != card.Tags)
{
var tfsTags = workItem.Fields["Tags"].Value.ToString();
// since we cannot set the tags in TFS we cannot blindly overwrite the LK tags
// with what is in TFS. Instead we can only add TFS tags to LK
if (!string.IsNullOrEmpty(tfsTags))
{
var tfsTagsArr = tfsTags.Contains(',') ? tfsTags.Split(',') : tfsTags.Split(';');
foreach (var tag in tfsTagsArr)
{
if (card.Tags != null && card.Tags.ToLowerInvariant().Contains(tag.ToLowerInvariant())) continue;
if (string.IsNullOrEmpty(card.Tags))
card.Tags = tag;
else
card.Tags += "," + tag;
saveCard = true;
}
}
}
if (workItem.Fields != null && (workItem.Fields.Contains("Original Estimate") || workItem.Fields.Contains("Story Points")))
{
if (workItem.Fields.Contains("Original Estimate") && workItem.Fields["Original Estimate"] != null && workItem.Fields["Original Estimate"].Value != null)
{
double cardSize;
var isNumber = Double.TryParse(workItem.Fields["Original Estimate"].Value.ToString(), out cardSize);
if (isNumber)
{
var size = (int) cardSize;
if (card.Size != size)
{
card.Size = size;
saveCard = true;
}
}
}
else if (workItem.Fields.Contains("Story Points") && workItem.Fields["Story Points"] != null && workItem.Fields["Story Points"].Value != null)
{
double cardSize;
var isNumber = Double.TryParse(workItem.Fields["Story Points"].Value.ToString(), out cardSize);
if (isNumber)
{
var size = (int)cardSize;
if (card.Size != size)
{
card.Size = size;
saveCard = true;
}
}
}
}
if ((card.Tags == null || !card.Tags.Contains(ServiceName)) && project.TagCardsWithTargetSystemName)
{
if (string.IsNullOrEmpty(card.Tags))
card.Tags = ServiceName;
else
card.Tags += "," + ServiceName;
saveCard = true;
}
if(saveCard)
{
Log.Info("Updating card [{0}]", card.Id);
LeanKit.UpdateCard(boardId, card);
}
// check the state of the work item
// if we have the state mapped to a lane then check to see if the card is in that lane
//.........这里部分代码省略.........
示例2: CreateCardFromWorkItem
private void CreateCardFromWorkItem(BoardMapping project, WorkItem workItem)
{
if (workItem == null) return;
var boardId = project.Identity.LeanKit;
var mappedCardType = workItem.LeanKitCardType(project);
var laneId = project.LanesFromState(workItem.State).First();
var card = new Card
{
Active = true,
Title = workItem.Title,
Description = workItem.LeanKitDescription(GetTfsVersion()),
Priority = workItem.LeanKitPriority(),
TypeId = mappedCardType.Id,
TypeName = mappedCardType.Name,
LaneId = laneId,
ExternalCardID = workItem.Id.ToString(CultureInfo.InvariantCulture),
ExternalSystemName = ServiceName
};
if (workItem.Fields.Contains("Tags") && workItem.Fields["Tags"] != null && workItem.Fields["Tags"].Value != null)
{
card.Tags = workItem.Fields["Tags"].Value.ToString().Replace(";", ",");
}
if (project.TagCardsWithTargetSystemName && (card.Tags == null || !card.Tags.Contains(ServiceName)))
{
if (string.IsNullOrEmpty(card.Tags))
card.Tags = ServiceName;
else
card.Tags += "," + ServiceName;
}
if (_projectHyperlinkService != null)
{
card.ExternalSystemUrl = _projectHyperlinkService.GetWorkItemEditorUrl(workItem.Id).ToString();
}
if (workItem.Fields != null && workItem.Fields.Contains("Assigned To"))
{
if (workItem.Fields["Assigned To"] != null && workItem.Fields["Assigned To"].Value != null)
{
var assignedUserId = CalculateAssignedUserId(boardId, workItem.Fields["Assigned To"].Value.ToString());
if (assignedUserId != null)
card.AssignedUserIds = new[] {assignedUserId.Value};
}
}
if (workItem.Fields != null && workItem.Fields.Contains("Due Date"))
{
if (workItem.Fields["Due Date"] != null && workItem.Fields["Due Date"].Value != null)
{
DateTime tfsDueDate;
var isDate = DateTime.TryParse(workItem.Fields["Due Date"].Value.ToString(), out tfsDueDate);
if (isDate)
{
if (CurrentUser != null)
{
var dateFormat = CurrentUser.DateFormat ?? "MM/dd/yyyy";
card.DueDate = tfsDueDate.ToString(dateFormat);
}
}
}
}
if (workItem.Fields != null && (workItem.Fields.Contains("Original Estimate") || workItem.Fields.Contains("Story Points")))
{
if (workItem.Fields.Contains("Original Estimate") && workItem.Fields["Original Estimate"] != null && workItem.Fields["Original Estimate"].Value != null)
{
double cardSize;
var isNumber = Double.TryParse(workItem.Fields["Original Estimate"].Value.ToString(), out cardSize);
if (isNumber)
card.Size = (int)cardSize;
}
else if (workItem.Fields.Contains("Story Points") && workItem.Fields["Story Points"] != null && workItem.Fields["Story Points"].Value != null)
{
double cardSize;
var isNumber = Double.TryParse(workItem.Fields["Story Points"].Value.ToString(), out cardSize);
if (isNumber)
card.Size = (int) cardSize;
}
}
Log.Info("Creating a card of type [{0}] for work item [{1}] on Board [{2}] on Lane [{3}]", mappedCardType.Name, workItem.Id, boardId, laneId);
CardAddResult cardAddResult = null;
var tries = 0;
var success = false;
while (tries < 10 && !success)
{
if (tries > 0)
{
Log.Warn(String.Format("Attempting to create card for work item [{0}] attempt number [{1}]", workItem.Id,
tries));
// wait 5 seconds before trying again
Thread.Sleep(new TimeSpan(0, 0, 5));
}
//.........这里部分代码省略.........