public void ChangeCardPos(Card card, double newPos) { setupBoards(); trello.Async.Cards.ChangePos(card, newPos); card.Pos = newPos; }
public void ChangeDescription(Card card, string description) { setupBoards(); trello.Async.Cards.ChangeDescription(card, description); card.Desc = description; }
public void ChangeName(Card card, string newName) { setupBoards(); trello.Async.Cards.ChangeName(card, newName); card.Name = newName; }
public void DoWork(Card[] cards, ITrello trello, IDisplay display) { foreach (var card in cards.Select(x => new ReleaseNotesCard(x))) { display.Write(string.Format("{0} - {1}", card.Labels, card.Name)); } }
public static ISheet AddCard(this ISheet builder, string label, Card card, Member user) { var userName = ""; if (user != null) { userName = user.FullName; } var row = builder.CreateRow(builder.LastRowNum + 1); row.CreateCell(0).SetCellValue(""); row.CreateCell(1).SetCellValue(label); row.CreateCell(2).SetCellValue(card.Name); row.GetCell(2).CellStyle.WrapText = true; row.GetCell(2).Hyperlink = new HSSFHyperlink(HyperlinkType.URL) { Address = card.Url }; row.CreateCell(3).SetCellValue(""); row.CreateCell(4).SetCellValue(userName); row.CreateCell(5).SetCellValue(""); return builder; }
private CardData CreateCardData(Card card) { return new CardData() { Card = card, Points = GetPointsForCard(card), Name = GetCardNameWithoutPoints(card), Actions = _trelloClient.GetActionsForCard(card) }; }
public void DoWork(Card[] cards, ITrello trello, IDisplay display) { display.Skip(); display.Write("Archiving cards..."); foreach (var card in cards) { trello.Cards.Archive(card); } }
public void DoWork(Card[] cards, ITrello trello, IDisplay display) { var cardsGroupedByLabel = cards .Select(x => new ReleaseNotesCard(x)) .GroupBy(x => x.Labels) .ToArray(); File.WriteAllText(_options.Output, Razor.Parse(File.ReadAllText(_options.Template), new { _options.SoftwareName, _options.SoftwareVersion, Groups = cardsGroupedByLabel })); }
public void DoWork(Card[] cards, ITrello trello, IDisplay display) { display.Skip(); display.Write("Updating release version on cards..."); foreach (var card in cards) { if (card.Desc.Contains(ReleaseTag(_options.SoftwareVersion))) return; card.Desc += ReleaseTag(_options.SoftwareVersion); trello.Cards.ChangeDescription(card, card.Desc); } }
private static string[] CreateStringArrayFromCard(Card card, IEnumerable<List> lists, IEnumerable<string> fieldsToInclude) { var list = new List<string>(); if(fieldsToInclude.Contains("Name")) list.Add(card.Name); if (fieldsToInclude.Contains("Description")) list.Add(card.Desc); if (fieldsToInclude.Contains("Due Date")) list.Add(card.Due.ToString()); if (fieldsToInclude.Contains("List")) list.Add(lists.FirstOrDefault() != null ? lists.FirstOrDefault().Name : null); return list.ToArray(); }
private static void SetPriority(DevCard devCard, Card card, int count) { switch (devCard.Priority.ToLowerInvariant()) { case "must": card.Pos = 1 * count; break; case "should": card.Pos = 2 * count; break; case "could": card.Pos = 3 * count; break; default: card.Pos = 4 * count; break; } }
private double GetPointsForCard(Card card) { var match = Regex.Match(card.Name, @"^\((.*)\)(.*)"); if (match.Success) { var pointsString = match.Groups[1].Value; double points; if (double.TryParse(pointsString, out points)) { return points; } } return 0; }
/// <summary> /// Separate <paramref name="cards"/> by card labels /// </summary> /// <param name="cards">Unsepareted cards</param> /// <returns>Separeted cards</returns> public static IEnumerable<Card> SepareteCardByLabels(IEnumerable<Card> cards) { var separeted = new List<Card>(); foreach (var card in cards) { // if more than one label, you should be separately if (card.Labels.Count > 1) { foreach (var label in card.Labels) { var newCard = new Card(); newCard.InjectFrom(card); newCard.Labels = new List<Card.Label> { label }; separeted.Add(newCard); } } else { separeted.Add(card); } } return separeted; }
private void NotifyOtherUserAboutFailures(Card card) { const string failureComment = "Hey, @{0}, take care, there's a failed mite command."; var allActions = _trello.Actions.ForCard(card, new[] {ActionType.CommentCard}).ToList(); var affectedUsers = (from CommentCardAction comment in allActions where HasFailureComment(comment) select comment.MemberCreator.Username).ToList().Distinct(); foreach (var affectedUser in affectedUsers.Where(x => x.ToLower() != _configuration.UserName)) { var commentForUser = string.Format(failureComment, affectedUser); var alreadyHasComment = allActions.Cast<CommentCardAction>().Any(comment => comment.Data.Text == commentForUser); if (!alreadyHasComment) _trello.Cards.AddComment(card, commentForUser); } }
public void MoveCardToDone(Card card) { setupBoards(); trello.Async.Cards.Move(card, doneList); }
private string GetCardNameWithoutPoints(Card card) { var match = Regex.Match(card.Name, @"^\((.*)\)(.*)"); if (match.Success) { return match.Groups[2].Value; } return card.Name; }
public void GivenATrelloServiceWhenGetCurrentCardsForMember() { _boardId = "boardId"; _memberId = "memberId"; var boardMember = new BoardMember {Id = _memberId}; var checklistItems = new List<Card.CheckItem> { new Card.CheckItem {Id = "itemId", Name = "itemName", Checked = true} }; var checklists = new List<Card.Checklist> { new Card.Checklist {Id = "id", Name = "name", CheckItems = checklistItems} }; _card = new Card { Id = "card1", Name = "One", IdShort = 1, IdBoard = _boardId, IdList = "list", Checklists = checklists }; _anotherCard = new Card { Id = "card2", Name = "Two", IdShort = 2, IdBoard = _boardId, IdList = "list", Checklists = checklists }; var cards = new List<Card> {_card, _anotherCard}; var lists = new List<List> { new List { Id = "1"}, new List { Id = "2"}, new List { Id = "3"} }; var mockBoards = new Mock<IBoards>(); mockBoards .Setup(b => b.WithId(It.IsAny<string>())) .Returns(new Board {Id = _boardId}); _mockCards = new Mock<ICards>(); _mockCards .Setup(c => c.ForMember(It.IsAny<IMemberId>(), It.IsAny<CardFilter>())) .Returns(cards); _mockLists = new Mock<ILists>(); _mockLists .Setup(l => l.ForBoard(It.IsAny<Board>(), It.IsAny<ListFilter>())) .Returns(lists); var mockTrelloService = new Mock<ITrello>(); mockTrelloService .SetupGet(s => s.Boards) .Returns(mockBoards.Object); mockTrelloService .SetupGet(s => s.Cards) .Returns(_mockCards.Object); mockTrelloService .SetupGet(s => s.Lists) .Returns(_mockLists.Object); var trelloBoardService = new TrelloBoardService(mockTrelloService.Object, _boardId); _result = trelloBoardService.GetCurrentCardsForMember(boardMember); }
public List GetList(Card card) { return _connection.Trello.Lists.ForCard(card); }
private static void SetTrelloLabel(DevCard ddd, Card bl) { foreach (var label in _lbls) { if (bl.Labels.Any(x => x.Name.ToLowerInvariant() == label.Name.ToLowerInvariant())) continue; if (ddd.ToString().ToLowerInvariant().Contains(label.Name.ToLowerInvariant())) { bl.Labels.Add(label); _trello.Cards.AddLabel(bl, label.Color.Value); } if (ddd.Priority.ToLowerInvariant().Contains(label.Name.ToLowerInvariant())) { bl.Labels.Add(label); _trello.Cards.AddLabel(bl, label.Color.Value); } } }
public static ISheet AddSubtasks(this ISheet builder, Card card) { foreach (var checklist in card.Checklists) { var row = builder.CreateRow(builder.LastRowNum + 1); row.CreateCell(0).SetCellValue(string.Empty); row.CreateCell(1).SetCellValue(string.Empty); row.CreateCell(2).SetCellValue(string.Empty); row.CreateCell(3).SetCellValue(checklist.Name); var font = builder.Workbook.CreateFont(); font.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.BOLD; row.GetCell(3).CellStyle = builder.Workbook.CreateCellStyle(); row.GetCell(3).CellStyle.SetFont(font); row.CreateCell(4).SetCellValue(string.Empty); row.CreateCell(5).SetCellValue(string.Empty); foreach (var items in checklist.CheckItems) { var subrow = builder.CreateRow(builder.LastRowNum + 1); var name = "□ " + items.Name; if (items.Checked) { name = "✓ " + items.Name; } subrow.CreateCell(0).SetCellValue(string.Empty); subrow.CreateCell(1).SetCellValue(string.Empty); subrow.CreateCell(2).SetCellValue(string.Empty); subrow.CreateCell(3).SetCellValue(name); subrow.CreateCell(4).SetCellValue(string.Empty); subrow.CreateCell(5).SetCellValue(string.Empty); } } return builder; }
/// <summary> /// Refresh card's member information /// </summary> /// <param name="c"></param> public void RefreshCard(Card c) { #region Load card if (c.IdMembers != null) { foreach (var id in c.IdMembers) { if (members.ContainsKey(id)) { c.Members.Add(members[id]); } else { Member m = this.Members.WithId(id); if (m != null) { members.Add(id, m); c.Members.Add(m); } else { members.Add(id, new Member()); } } } } #endregion }
public IEnumerable<Action> GetActions(Card card, ActionType[] actionTypes) { return _connection.Trello.Actions.ForCard(card, new[] { ActionType.CommentCard }); }
private static string[] CreateStringArrayFromCard(Card card, IEnumerable<List> lists, IEnumerable<string> fieldsToInclude) { var list = new List<string>(); Match match = Regex.Match(card.Name, @"(.*)?\[(([0-9]+)/)?([0-9]+)\](.*)?"); if (fieldsToInclude.Contains("Name")) { if (match.Success) { list.Add(match.Groups[1].Value.Trim() + match.Groups[5].Value); } else { list.Add(card.Name); } } if (fieldsToInclude.Contains("Description")) list.Add(card.Desc); if (fieldsToInclude.Contains("Due Date")) list.Add(card.Due.ToString()); if (fieldsToInclude.Contains("List")) list.Add(lists.FirstOrDefault() != null ? lists.FirstOrDefault().Name : null); int est = -1, log = -1, taskEst = -1, taskLog = -1; if (match.Success) { est = int.Parse(match.Groups[4].Value); } if (match.Success) { if (match.Groups[3].Value.Trim() != "") log = int.Parse(match.Groups[3].Value); } string relTasks = "", allTasks = ""; int i = 0; foreach (TrelloNet.Card.Checklist cl in card.Checklists) { Match clMatch = Regex.Match(cl.Name, @"\{(.*?)\}"); bool relevant = false; if (!clMatch.Success || clMatch.Groups[1].Value == (lists.FirstOrDefault() != null ? lists.FirstOrDefault().Name : null)) relevant = true; foreach (TrelloNet.Card.CheckItem ci in cl.CheckItems) { Match ciMatch = Regex.Match(ci.Name, @"(.*)?\[(([0-9]+)/)?([0-9]+)\](.*)?"); if (ciMatch.Success) { if (taskEst < 0) taskEst = 0; if (taskLog < 0) taskLog = 0; taskEst += int.Parse(ciMatch.Groups[4].Value); if (ci.Checked) taskLog += int.Parse(ciMatch.Groups[4].Value); else if (ciMatch.Groups[3].Value.Trim() != "") taskLog += int.Parse(ciMatch.Groups[3].Value); } string ciName = ciMatch.Groups[0].Value.Trim() + ciMatch.Groups[5].Value; if (relevant) relTasks += (i++ > 0 ? ",\r\n" : "") + ciName; allTasks += (i++ > 0 ? ",\r\n" : "") + ciName; } } if (fieldsToInclude.Contains("Estimates")) { if (taskEst >= 0) list.Add(taskEst.ToString()); else if (est >= 0) list.Add(est.ToString()); else list.Add(""); } if (fieldsToInclude.Contains("Time Log")) { if (taskLog >= 0) list.Add(taskLog.ToString()); else if (log >= 0) list.Add(log.ToString()); else list.Add(""); } if (fieldsToInclude.Contains("Labels")) { var labelStrings = from l in card.Labels select l.Name + "(" + l.Color.ToString() + ")"; string labelString = ""; foreach (string l in labelStrings) { labelString += (labelString.Length > 0?",\r\n":"") + l; } list.Add(labelString); } if (fieldsToInclude.Contains("Tasks (Relevant)")) { list.Add(relTasks); } if (fieldsToInclude.Contains("Tasks (All)")) { list.Add(allTasks); } return list.ToArray(); }
public IEnumerable<Member> GetMembers(Card card) { return _connection.Trello.Members.ForCard(card); }
private ListEntry MountWorksheetRow(Card card, Dictionary<string, DateTime> sprintPeriod) { var row = new ListEntry(); var title = _cardHelper.GetCardTitle(card); var priority = _cardHelper.GetCardPriority(card); var importance = _cardHelper.GetImportance(priority); var urgency = _cardHelper.GetUrgency(priority); var estimate = _cardHelper.GetCardEstimate(card); var labels = _cardHelper.GetCardLabels(card); var status = _cardHelper.GetStatus(card); var responsible = ExecutionHelper.ExecuteAndRetryOnFail(() => _cardHelper.GetResponsible(card)); var comments = ExecutionHelper.ExecuteAndRetryOnFail(() => _cardHelper.GetCardComments(card)); var workedAndPending = ExecutionHelper.ExecuteAndRetryOnFail(() => _cardHelper.GetWorkedAndPending(estimate, comments, sprintPeriod["endDate"])); var workedAndPendingInSprint = ExecutionHelper.ExecuteAndRetryOnFail(() => _cardHelper.GetWorkedAndPending(estimate, comments, sprintPeriod["startDate"], sprintPeriod["endDate"])); var worked = workedAndPending["worked"].ToString(CultureInfo.InvariantCulture).Replace(".", ","); var workedInSprint = workedAndPendingInSprint["worked"].ToString(CultureInfo.InvariantCulture).Replace(".", ","); var pending = workedAndPending["pending"].ToString(CultureInfo.InvariantCulture).Replace(".", ","); var reassessment = (workedAndPending["worked"] + workedAndPending["pending"]).ToString(CultureInfo.InvariantCulture).Replace(".", ","); row.Elements.Add(new ListEntry.Custom { LocalName = "status", Value = status }); row.Elements.Add(new ListEntry.Custom { LocalName = "titulo", Value = title }); row.Elements.Add(new ListEntry.Custom { LocalName = "responsaveis", Value = responsible }); row.Elements.Add(new ListEntry.Custom { LocalName = "importancia", Value = importance }); row.Elements.Add(new ListEntry.Custom { LocalName = "urgencia", Value = urgency }); row.Elements.Add(new ListEntry.Custom { LocalName = "estimativa", Value = estimate }); row.Elements.Add(new ListEntry.Custom { LocalName = "trabalhado", Value = worked }); row.Elements.Add(new ListEntry.Custom { LocalName = "trabalhadonosprint", Value = workedInSprint }); row.Elements.Add(new ListEntry.Custom { LocalName = "restante", Value = pending }); row.Elements.Add(new ListEntry.Custom { LocalName = "reestimativa", Value = reassessment }); row.Elements.Add(new ListEntry.Custom { LocalName = "rotulos", Value = labels }); row.Elements.Add(new ListEntry.Custom { LocalName = "link", Value = card.ShortUrl }); return row; }
public ReleaseNotesCard(Card card) { _card = card; _renderer = new Markdown(); }
public TaskItem(ObservableCollection<TaskItem> taskList, Card card, string taskName, TrelloService trelloService) { Card = card; TaskDoneCmd = new TaskDoneCommand(this, taskList); _taskName = taskName; this.trelloService = trelloService; }