예제 #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
        //
        // GET: /Diagrams/

        public ActionResult Index()
        {
            ChelloClient client = TrelloClientFactory.Get();

            var boards = client.Boards.ForUser("me");

            ViewBag.Boards       = boards.Where(b => !b.Closed);
            ViewBag.ClosedBoards = boards.Where(b => b.Closed);

            return(View());
        }
예제 #3
0
        private void Initialize()
        {
            ChelloClient client = TrelloClientFactory.Get();

            _lists = client.Lists.ForBoard(_boardId).ToDictionary(l => l.Id, l => new ActivityList(l.Id, l.Name));

            IEnumerable <CardUpdateAction> updates = client.CardUpdates.ForBoard(_boardId, new { limit = 1000, filter = "createCard,updateCard,moveCardFromBoard,moveCardToBoard,updateBoard,createBoard" });

            // HACK: Board closing doesn't come back properly - assume if last activity was a board update it is board closing
            // may give strange results for some cases
            if (updates.FirstOrDefault().Type.Equals("updateBoard", StringComparison.OrdinalIgnoreCase))
            {
                BoardClosed = DateTime.Parse(updates.FirstOrDefault().Date).ToUniversalTime();
            }

            ProcessUpdates(client, updates);
        }