本文整理汇总了C#中WorkItem.LeanKitCardType方法的典型用法代码示例。如果您正苦于以下问题:C# WorkItem.LeanKitCardType方法的具体用法?C# WorkItem.LeanKitCardType怎么用?C# WorkItem.LeanKitCardType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorkItem
的用法示例。
在下文中一共展示了WorkItem.LeanKitCardType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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));
}
//.........这里部分代码省略.........