private void loadTask() { flpTasks.Controls.Clear(); using (var dbContext = new TODOContext()) { tasks = dbContext.Tasks.Where(c => c.CardId == card.Id).ToList(); comments = dbContext.Comments.Where(c => c.CardId == card.Id).ToList(); } foreach (var task in tasks) { UCTask ucTask = new UCTask(task); ucTask.DataUpdated += new EventHandler(UCTask_DataUpdated); flpTasks.Controls.Add(ucTask); } UCAddCard ucAdd = new UCAddCard(); ucAdd.BtnAddClick += new EventHandler(UCAdd_BtnAddClick); flpTasks.Controls.Add(ucAdd); foreach (var comment in comments) { UCComment ucComment = new UCComment(comment); flpTasks.Controls.Add(ucComment); } UCAddComment ucAddComment = new UCAddComment(card); ucAddComment.CmtAdded += new EventHandler(UCAddCmt_CmtAdded); flpTasks.Controls.Add(ucAddComment); }
private void loadData() { flpCards.Controls.Clear(); using (var dbContext = new TODOContext()) { cards = dbContext.Cards.Where(c => c.BoardId == board.Id).ToList(); } foreach (var card in cards) { UCCollection ucCollection = new UCCollection(card); ucCollection.eventLoadData += new EventHandler(UCCard_LoadData); ucCollection.ClickCard += new EventHandler <CardEventArgs>(UCCard_Click); flpCards.Controls.Add(ucCollection); } UCAddCard ucAddCollection = new UCAddCard(); ucAddCollection.BtnAddClick += new EventHandler(UCAddList_btnAddClick); flpCards.Controls.Add(ucAddCollection); }