Пример #1
0
        private void btnAddItem_Click(object sender, EventArgs e)
        {
            ItemEditForm itemEditForm = new ItemEditForm();

            if (itemEditForm.ShowDialog() == DialogResult.OK)
            {
                dgvItem.DataSource = itemManager.GetAll();
                itemEditForm.Dispose();
            }
        }
Пример #2
0
        private void btnEditItem_Click(object sender, EventArgs e)
        {
            int  id   = (int)dgvItem.CurrentRow.Cells["ItemId"].Value;
            Item item = itemManager.GetByItemId(id);

            //if update success
            if (item != null)
            {
                ItemEditForm itemEditForm = new ItemEditForm(item);
                if (itemEditForm.ShowDialog() == DialogResult.OK)
                {
                    dgvItem.DataSource = itemManager.GetAll();
                    itemEditForm.Dispose();
                }
            }
        }