コード例 #1
0
        private void Add_button_Click(object sender, EventArgs e)
        {
            dataSet = BusinessLogic.ReadCategories();
            AddEditCategoryForm AddCategory = new AddEditCategoryForm(dataSet.Categories, null);

            AddCategory.Text = "Добавление категории";
            this.Enabled     = false;
            AddCategory.ShowDialog();
            if (AddCategory.DialogResult == DialogResult.OK)
            {
                dataSet = BusinessLogic.WriteCategories(dataSet);
                ReloadCategories();
            }
            this.Enabled = true;
        }
コード例 #2
0
        private void Edit_button_Click(object sender, EventArgs e)
        {
            dataSet            = BusinessLogic.ReadCategories();
            LastSelectionIndex = Categories_dataGridView.SelectedRows[0].Index;
            AddEditCategoryForm EditCategory = new AddEditCategoryForm(dataSet.Categories, dataSet.Categories.Rows.Find(Categories_dataGridView.SelectedRows[0].Cells["ID"].Value));

            EditCategory.Text = "Редактирование категории";
            this.Enabled      = false;
            EditCategory.ShowDialog();
            if (EditCategory.DialogResult == DialogResult.OK)
            {
                dataSet = BusinessLogic.WriteCategories(dataSet);
                ReloadCategories();
            }
            this.Enabled = true;
        }