Example #1
0
        private void menuStripEditProduct_Click(object sender, System.EventArgs e)
        {
            if (_currentProduct == null)
            {
                return;
            }

            var form = new AddProductForm(_currentProduct);

            if (form.ShowDialog() != DialogResult.Ignore)
            {
                LoadGrid();
            }
        }
Example #2
0
        private void menuStripNewProduct_Click(object sender, System.EventArgs e)
        {
            if (_categoryRepository.GetCategories().Count == 0)
            {
                MessageBox.Show("В базе данных отсутствуют категории!", "Создайте категорию!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            var form = new AddProductForm();

            if (form.ShowDialog() != DialogResult.Ignore)
            {
                LoadGrid();
            }
        }
Example #3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (gridProducts.SelectedRows.Count != 0)
            {
                _currentProduct = gridProducts.SelectedRows[0].Tag as Product;
            }
            else
            {
                return;
            }

            var form = new AddProductForm(_currentProduct);

            if (form.ShowDialog() != DialogResult.Ignore)
            {
                LoadGrid();
            }
        }