本文整理汇总了C#中Ticket.LeanKitPriority方法的典型用法代码示例。如果您正苦于以下问题:C# Ticket.LeanKitPriority方法的具体用法?C# Ticket.LeanKitPriority怎么用?C# Ticket.LeanKitPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket.LeanKitPriority方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCardFromItem
private void CreateCardFromItem(BoardMapping project, Ticket ticket)
{
if (ticket == null) return;
var boardId = project.Identity.LeanKit;
var mappedCardType = ticket.LeanKitCardType(project);
var laneId = project.LanesFromState(ticket.Status).First();
var card = new Card
{
Active = true,
Title = ticket.Summary,
Description = ticket.Description.SanitizeCardDescription(),
Priority = ticket.LeanKitPriority(),
TypeId = mappedCardType.Id,
TypeName = mappedCardType.Name,
LaneId = laneId,
ExternalCardID = ticket.Id.ToString(),
ExternalSystemName = ServiceName,
ExternalSystemUrl = string.Format(_externalUrlTemplate, ticket.Id, project.Identity.Target)
};
var assignedUserId = CalculateAssignedUserId(boardId, ticket);
if (assignedUserId != null)
card.AssignedUserIds = new[] { assignedUserId.Value };
if (ticket.Due_On != null)
{
if (CurrentUser != null)
{
var dateFormat = CurrentUser.DateFormat ?? "MM/dd/yyyy";
card.DueDate = ticket.Due_On.Value.ToString(dateFormat);
}
}
if ((card.Tags == null || !card.Tags.Contains(ServiceName)) && project.TagCardsWithTargetSystemName)
{
if (string.IsNullOrEmpty(card.Tags))
card.Tags = ServiceName;
else
card.Tags += "," + ServiceName;
}
Log.Info("Creating a card of type [{0}] for ticket [{1}] on Board [{2}] on Lane [{3}]", mappedCardType.Name, ticket.Id, boardId, laneId);
CardAddResult cardAddResult = null;
int tries = 0;
bool success = false;
while (tries < 10 && !success)
{
if (tries > 0)
{
Log.Error(string.Format("Attempting to create card for ticket [{0}] attempt number [{1}]", ticket.Id, tries));
// wait 5 seconds before trying again
Thread.Sleep(new TimeSpan(0, 0, 5));
}
try
{
cardAddResult = LeanKit.AddCard(boardId, card, "New Card From Unfuddle Ticket");
success = true;
}
catch (Exception ex)
{
Log.Error(string.Format("An error occurred: {0} - {1} - {2}", ex.GetType(), ex.Message, ex.StackTrace));
}
tries++;
}
if (cardAddResult != null) card.Id = cardAddResult.CardId;
Log.Info("Created a card [{0}] of type [{1}] for ticket [{2}] on Board [{3}] on Lane [{4}]", card.Id, mappedCardType.Name, ticket.Id, boardId, laneId);
}
示例2: TicketUpdated
private void TicketUpdated(Ticket ticket, Card card, BoardMapping boardMapping)
{
Log.Info("Ticket [{0}] updated, comparing to corresponding card...", ticket.Id);
long boardId = boardMapping.Identity.LeanKit;
// sync and save those items that are different (of title, description, priority)
bool saveCard = false;
if (ticket.Summary != card.Title)
{
card.Title = ticket.Summary;
saveCard = true;
}
if (ticket.Description.SanitizeCardDescription() != card.Description)
{
card.Description = ticket.Description.SanitizeCardDescription();
saveCard = true;
}
var priority = ticket.LeanKitPriority();
if (priority != card.Priority)
{
card.Priority = priority;
saveCard = true;
}
if (ticket.Due_On != null)
{
if (CurrentUser != null)
{
var dateFormat = CurrentUser.DateFormat ?? "MM/dd/yyyy";
var dueDateString = ticket.Due_On.Value.ToString(dateFormat);
if (card.DueDate != dueDateString)
{
card.DueDate = dueDateString;
saveCard = true;
}
}
}
else if (!string.IsNullOrEmpty(card.DueDate))
{
card.DueDate = "";
saveCard = true;
}
if ((card.Tags == null || !card.Tags.Contains(ServiceName)) && boardMapping.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);
}
}