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(); }
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(); }
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(); }
private void add_cat_panel_Click(object sender, EventArgs e) { frmAddCategory frm = new frmAddCategory(); frm.ShowDialog(); }
private void btnCategoryAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { frmAddCategory frmAdd = new frmAddCategory(preCategory); frmAdd.ShowDialog(); }