public void AddCard(Card newCard, int index) { if (newCard == null || index < 0) return; //In case the card is already registered, we change the id so is considered like a new one (will be inserted) newCard.Id = PersistenceDefaultValues.NO_IDENTIFIED; newCard.DeskId = this.Id; int realIndex = (index > _cards.Count) ? _cards.Count : index; newCard.Index = realIndex; newCard.Save(); _cards.Insert(realIndex, newCard); this.RefreshCardsIndexes(); }
internal static List<Card> GetCards(int deskId) { List<Card> deskCards = new List<Card>(); string selectQuery = string.Format("SELECT * FROM {0} WHERE {1}={2} ORDER BY {3}", TABLE_NAME, DESK_ID, deskId, INDEX); DataTable table = SQLiteLinker.GetDataTable(selectQuery); foreach (DataRow row in table.Rows) { Card newCard = new Card(); newCard.LoadData(row); deskCards.Add(newCard); } return deskCards; }
public CardEditorView(Desk desk, Card card) { __presenter = new CardEditorPresenter(this, desk, card); this.View.BackgroundColor = UIColor.White; }
public Card CreateCard() { Card newDeskCard = new Card(); Template backTemplate = this.GetCardBackTemplate(); backTemplate.LoadTemplate(); newDeskCard.LoadTemplateInBack(backTemplate); Template frontTemplate = this.GetCardFrontTemplate(); frontTemplate.LoadTemplate(); newDeskCard.LoadTemplateInFront(frontTemplate); return newDeskCard; }