public void LoadCards() { this.pnLists.Controls.Clear(); CardBLL cardBLL = new CardBLL(); cardDTOs = cardBLL.GetAllCard(this.id); foreach (CardDTO card in cardDTOs) { Card cards = new Card(0, card.CardId, card.IndexCard, _listSpace); this.pnLists.Controls.Add(cards); } }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tbTitleNewCard.Text)) { MessageBox.Show("Please enter title before add card", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { CardBLL cardBLL = new CardBLL(); CardDTO cardDTO = new CardDTO(cardBLL.GetAllCard().Count() + 1, this.id, cardDTOs.Count() + 1, tbTitleNewCard.Text, "", 1, DateTime.MinValue, 0); cardBLL.InsertCard(cardDTO); } LoadCards(); }