Esempio n. 1
0
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            try
            {
                string  brand    = dgvShoes.CurrentRow.Cells[0].Value.ToString();
                string  model    = dgvShoes.CurrentRow.Cells[1].Value.ToString();
                string  colorway = dgvShoes.CurrentRow.Cells[2].Value.ToString();
                decimal size     = (decimal)dgvShoes.CurrentRow.Cells[3].Value;

                Shoe tempShoe = ShoeDB.GetShoe(brand, model, colorway, size);

                DialogResult dialog = MessageBox.Show("Are you sure you want to delete " + tempShoe.ToString() + "?",
                                                      "Verify", MessageBoxButtons.YesNo);

                if (dialog == DialogResult.Yes)
                {
                    ShoeDB.DeleteShoe(tempShoe);
                    MessageBox.Show("The shoe was removed successfully!");
                    this.DialogResult = DialogResult.OK;

                    List <Shoe> shoeList = ShoeDB.GetAllShoes();
                    dgvShoes.DataSource = shoeList;
                    tbShoeCount.Text    = shoeList.Count.ToString();
                }
            }

            catch
            {
                MessageBox.Show("There is no shoe to remove there");
            }
        }
Esempio n. 2
0
        private void MainMenuForm_Load(object sender, EventArgs e)
        {
            List <Shoe> shoeList = ShoeDB.GetAllShoes();

            dgvShoes.DataSource = shoeList;

            tbShoeCount.Text = shoeList.Count.ToString();
        }
Esempio n. 3
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            formAddShoe  form = new formAddShoe();
            DialogResult r    = form.ShowDialog();

            if (r == DialogResult.OK)
            {
                List <Shoe> shoeList = ShoeDB.GetAllShoes();
                dgvShoes.DataSource = shoeList;
                tbShoeCount.Text    = shoeList.Count.ToString();
            }
        }