Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            // Opens AddCategory form and ensures no record is currently selected
            GlobalVariables.selectedCategoryID = 0;
            frmAddCategory editForm = new frmAddCategory();

            editForm.ShowDialog();
            lvCategories.Items.Clear();
            DisplayCategories();
        }
Пример #2
0
        private void btnEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            GridView gridView = gridCategory.FocusedView as GridView;

            Model.CATEGORY obj = new Model.CATEGORY();

            obj.CATEGORY_ID   = Convert.ToInt32(gridView.GetFocusedRowCellValue("CATEGORY_ID").ToString());
            obj.CATEGORY_NAME = gridView.GetFocusedRowCellValue("CATEGORY_NAME").ToString();
            obj.DESCRIPTION   = gridView.GetFocusedRowCellValue("DESCRIPTION").ToString();

            frmAddCategory frmAdd = new frmAddCategory(preCategory, obj);

            frmAdd.ShowDialog();
        }
Пример #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            // Checks user has selected a category
            if (lvCategories.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select a Category to update.");
                return;
            }
            // Stores CategoryID to be updated
            GlobalVariables.selectedCategoryID = int.Parse(lvCategories.SelectedItems[0].Text);

            // Opens AddCategory form
            frmAddCategory editForm = new frmAddCategory();

            editForm.ShowDialog();
            lvCategories.Items.Clear();
            DisplayCategories();
        }
Пример #4
0
        private void add_cat_panel_Click(object sender, EventArgs e)
        {
            frmAddCategory frm = new frmAddCategory();

            frm.ShowDialog();
        }
Пример #5
0
        private void btnCategoryAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmAddCategory frmAdd = new frmAddCategory(preCategory);

            frmAdd.ShowDialog();
        }