示例#1
0
        private void btnAddCategory_Clicked(object sender, EventArgs e)
        {
            AddCategory addCategoryForm = new AddCategory(_views);

            if (addCategoryForm.ShowDialog() == DialogResult.OK)
            {
                RaiseDataModifiedEvent();
            }
        }
        protected void addCategory_Click(object sender, EventArgs e)
        {
            var addCategoryForm = new AddCategory(_views);

            if (addCategoryForm.ShowDialog() == DialogResult.OK)
            {
                RaiseDataModifiedEvent();
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (_displayMode == DisplayMode.Default)
                {
                    var addCategoryForm = new AddCategory(_views);

                    if (addCategoryForm.ShowDialog() == DialogResult.OK)
                    {
                        FillCategories();

                        if (addCategoryForm.SelectedCategoryID != null)
                        {
                            SelectByCategoryID(addCategoryForm.SelectedCategoryID.Value);
                        }
                    }
                }
                else if (_displayMode == DisplayMode.Billing)
                {
                    var addCategoryForm = new AddCategoryBilling(_views);
                    if (addCategoryForm.ShowDialog() == DialogResult.OK)
                    {
                        FillCategories();

                        if (addCategoryForm.SelectedCategoryID != null)
                        {
                            SelectByCategoryID(addCategoryForm.SelectedCategoryID.Value);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }