Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        private void DeleteGivingItemBtn_Click(object sender, EventArgs e)
        {
            if (givingItemsDataGridView.Rows.Count == 0)
            {
                return;
            }
            GivingItemsController gic          = new GivingItemsController();
            GivingItem            g            = gic.Show((int)givingItemsDataGridView.SelectedRows[0].Cells["givingItemId"].Value);
            DialogResult          dialogResult = MessageBox.Show("Are you sure you want to delete Oferring  Item: " + g.givingType.title + "\n NOTE: this action cannot be undone!",
                                                                 "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (dialogResult == DialogResult.No)
            {
                return;
            }
            else if (dialogResult == DialogResult.Yes)
            {
                g.Delete();
                MessageBox.Show("Offering item Deleted from records!", "Offering Item Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadGivingItems(selectedGiving);
            }
        }