예제 #1
0
        public ActionResult Board(string id, string s = "", string e = "")
        {
            ChelloClient client = TrelloClientFactory.Get();
            Board board = client.Boards.Single(id);
            ViewBag.BoardName = board.Name;
            ViewBag.BoardId = id;

            DateTime startDate = DateTime.MinValue;
            DateTime endDate = DateTime.MaxValue;

            DateTime.TryParseExact(s, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out startDate);

            if (!DateTime.TryParseExact(e, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out endDate))
            {
                endDate = DateTime.MaxValue;
            }

            ActivityRepository repository = new ActivityRepository(id);
            CumulativeFlowModel cards = new CumulativeFlowModel(repository, startDate, endDate);
            CumulativeFlowModel points = null;

            if (repository.Lists.SelectMany(l => l.Cards).Any(c => c.Points.HasValue))
            {
                points = new CumulativeFlowModel(repository, startDate, endDate, (cs) => { return cs.Where(c => c.Points.HasValue).Sum(c => c.Points.Value); }, "Points");
            }

            return View(new DiagramsModel(cards, points));
        }
예제 #2
0
 public static void AddCard(this IDictionary<string, ActivityRepository.ActivityList> lists, string listId, ActivityRepository.ActivityCard card)
 {
     if (lists.ContainsKey(listId))
     {
         lists[listId].AddCard(card);
     }
 }
예제 #3
0
 public CumulativeFlowModel(ActivityRepository repository, DateTime displayStartDate, DateTime displayEndDate, Func<IEnumerable<ActivityRepository.ActivityCard>, int> calculation, string title)
 {
     _repository = repository;
     _beginTime = repository.BoardOpened;
     _endTime = repository.BoardClosed.HasValue ? repository.BoardClosed.Value : DateTime.UtcNow;
     _calculation = calculation;
     _title = title;
     _limitedByTrello = repository.LimitedByApi;
     _displayBeginTime = displayStartDate < _beginTime ? _beginTime : displayStartDate;
     _displayEndTime = displayEndDate > _endTime ? _endTime : displayEndDate;
 }
예제 #4
0
 public CumulativeFlowModel(ActivityRepository repository, DateTime displayStartDate, DateTime displayEndDate)
     : this(repository, displayStartDate, displayEndDate, (cards) => { return cards.Count(); }, "Cards")
 {
 }
예제 #5
0
 public CumulativeFlowModel(ActivityRepository repository, Func<IEnumerable<ActivityRepository.ActivityCard>, int> calculation, string title)
     : this(repository, DateTime.MinValue, DateTime.MaxValue, calculation, title)
 {
 }
예제 #6
0
 public CumulativeFlowModel(ActivityRepository repository)
     : this(repository, DateTime.MinValue, DateTime.MaxValue)
 {
 }