Example #1
0
        private void showAll()
        {
            cardDAL     DAL      = new cardDAL();
            List <Card> cardList = new List <Card>();

            cardList = DAL.getAllCards();

            try
            {
                collectionDataGridView.Rows.Clear();

                for (int i = 0; i < cardList.Count; i++)
                {
                    collectionDataGridView.Rows.Add();

                    collectionDataGridView.Rows[i].Cells["IDColumn"].Value       = cardList[i].Id;
                    collectionDataGridView.Rows[i].Cells["NameColumn"].Value     = cardList[i].Nome;
                    collectionDataGridView.Rows[i].Cells["QuantityColumn"].Value = cardList[i].Quantidade;
                    collectionDataGridView.Rows[i].Cells["ColorColumn"].Value    = cardList[i].Cor;
                    collectionDataGridView.Rows[i].Cells["CardTypeColumn"].Value = cardList[i].Tipo;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex);
            }
        }
Example #2
0
        private bool checkCardExistence(Card card)
        {
            cardDAL DAL = new cardDAL();

            if (DAL.getCardByName(card.Nome) != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        private void confirmRemoveButton_Click(object sender, EventArgs e)
        {
            cardDAL DAL = new cardDAL();

            if (DAL.getCardByID(_id) != null)
            {
                DAL.removeAmountFromID(_id, _amount);
                this.Close();
            }
            else
            {
                MessageBox.Show("This card ID don't exist.");
                this.Close();
            }
        }
Example #4
0
        public RemoveConfirmationForm(int id, int amount)
        {
            InitializeComponent();

            _id     = id;
            _amount = amount;

            cardDAL DAL = new cardDAL();

            if (DAL.getCardByID(_id) == null)
            {
                MessageBox.Show("This card ID don't exist.");
                this.Close();
            }
            else
            {
                this.Show();
                confirmRemoveLabel.Text = string.Format("REMOVE {0}x ID = {1}?", _amount, DAL.getCardByID(_id).Nome);
            }
        }
Example #5
0
        private void makeSearchButton_Click(object sender, EventArgs e)
        {
            #region filters
            int    _id;
            string _name, _color;
            string _type;

            int.TryParse(collectionIDTxtBox.Text, out _id);
            _name  = cardNameTxtBox.Text;
            _color = "";
            _type  = "";

            CheckBox[] colorBoxes = new CheckBox[] { whiteCheckBox, greenCheckBox, redCheckBox, blackCheckBox, blueCheckBox,
                                                     colorlessCheckBox };

            CheckBox[] typeBoxes = new CheckBox[] { landCheckBox, creatureCheckBox, artifactCheckBox, enchantmentCheckBox,
                                                    planeswalkerCheckBox, instantCheckBox, spellCheckBox, otherTypeCheckBox };

            foreach (CheckBox colorBox in colorBoxes)
            {
                if (colorBox.Checked)
                {
                    switch (colorBox.Name)
                    {
                    case "whiteCheckBox":
                        _color += "W";
                        break;

                    case "greenCheckBox":
                        _color += "G";
                        break;

                    case "redCheckBox":
                        _color += "R";
                        break;

                    case "blackCheckBox":
                        _color += "B";
                        break;

                    case "blueCheckBox":
                        _color += "U";
                        break;

                    case "colorlessCheckBox":
                        _color += "C";
                        break;

                    default:
                        break;
                    }
                }
            }
            // MessageBox.Show(_color);

            foreach (CheckBox typeBox in typeBoxes)
            {
                if (typeBox.Checked)
                {
                    _type += typeBox.Text + "|";
                }
            }


            #endregion

            //MessageBox.Show(buildConnectionStringToSearch(_id, _name, _color, _type));

            #region connection
            cardDAL DAL = new cardDAL();

            List <Card> ret = DAL.getAllCardsFiltered(_id, _name, _color, _type);

            mf.showData(ret);

            this.Close();
            #endregion
        }
Example #6
0
        private void AddCard(Card newCard)
        {
            cardDAL DAL = new cardDAL();

            DAL.addCard(newCard);
        }