private void AddGivingItemBtn_Click(object sender, EventArgs e) { if (selectedGiving == null) { return; } if (givingDataGridView.Rows.Count == 0) { return; } AddUpdateGivingItemFrm addGivingItemFrm = new AddUpdateGivingItemFrm(false, selectedGiving); addGivingItemFrm.FormClosing += new FormClosingEventHandler(delegate { this.LoadGivingItems(selectedGiving); }); addGivingItemFrm.ShowDialog(); }
private void UpdateGivingItemBtn_Click(object sender, EventArgs e) { if (givingItemsDataGridView.Rows.Count == 0) { return; } GivingItemsController gic = new GivingItemsController(); GivingItem gi = gic.Show(Convert.ToInt32(givingItemsDataGridView.SelectedRows[0].Cells["givingItemId"].Value)); if (gi == null) { MessageBox.Show("Failed to get giving item", "Error Occured", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } AddUpdateGivingItemFrm editGivingItemFrm = new AddUpdateGivingItemFrm(true, selectedGiving, gi); editGivingItemFrm.FormClosing += new FormClosingEventHandler(delegate { this.LoadGivingItems(selectedGiving); }); editGivingItemFrm.ShowDialog(); }