Example #1
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            Toy toy = GetSelectedToy();

            if (toy == null)
            {
                return;
            }

            FormToy formToy = new FormToy(toy);

            if (formToy.ShowDialog() == DialogResult.OK)
            {
                Toy fToy = formToy.toy;
                toy.Change(fToy.Type, fToy.Age, fToy.Price);
                RefreshGrid();
                ListIsChanged = true;
            }
        }
Example #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            Toy toy = GetSelectedToy();

            if (toy == null)
            {
                return;
            }

            DialogResult result = MessageBox.Show("Are you sure you want to delete this record?", "Deleting",
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                  MessageBoxDefaultButton.Button2);

            if (result == DialogResult.No)
            {
                return;
            }

            toys.Remove(toy);
            RefreshGrid();
            ListIsChanged = true;
        }
Example #3
0
 public FormToy(Toy toy = null)
 {
     InitializeComponent();
     this.toy = toy;
     InitFields();
 }