当前位置: 首页>>代码示例>>C#>>正文


C# Ticket.LeanKitPriority方法代码示例

本文整理汇总了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);
        }
开发者ID:clickless,项目名称:LeanKit.IntegrationService,代码行数:74,代码来源:UnfuddleSubsystem.cs

示例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);
			}
		}
开发者ID:clickless,项目名称:LeanKit.IntegrationService,代码行数:61,代码来源:UnfuddleSubsystem.cs


注:本文中的Ticket.LeanKitPriority方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。