Example #1
0
        void PerformCategoryOperation(Category category, string operation)
        {
            frmAddCategory frmCategory = new frmAddCategory(EntityState.Dirty);
            int            CategoryID  = dgvList.SelectedRows[0].Cells["CategoryID"].Value.ToInt();

            switch (operation)
            {
            case "Modify":
                frmCategory.CategoryID = CategoryID;
                frmCategory.ShowDialog();
                break;

            case "Add":
                frmCategory = new frmAddCategory();
                frmCategory.ShowDialog();
                break;

            case "Delete":
                if (!(DialogResult.Yes == Helper.ShowMessage("Are you sure you want to delete this category?",
                                                             "Delete Seleted Category", MessageBoxButtons.YesNo, MessageBoxIcon.Question)))
                {
                    return;
                }

                new GenericService <Entities.Category>().Delete(new Category {
                    CategoryID = CategoryID
                });
                LoadGridWithDataDatasource(() => new CategoryService().GetAll());
                break;
            }
        }
Example #2
0
        private void btnNewCusromer_Click(object sender, EventArgs e)
        {
            if (!Helper.IsAdmin())
            {
                return;
            }

            frmAddCategory cat = new frmAddCategory();

            cat.ShowDialog();
        }