Beispiel #1
0
 public AddUpdateGivingItemFrm(bool isUpdate, Giving g, GivingItem gi = null)
 {
     this.giving     = g;
     this.givingItem = gi;
     this.isUpdate   = isUpdate;
     Console.WriteLine(g.member.FullName());
     InitializeComponent();
     this.Text = isUpdate ? "Update Offering Item" : "Add Offering Item";
     this.AddOfferingBtn.Text = isUpdate ? "Update Item" : "Add Item";
     this.AcceptButton        = AddOfferingBtn;
 }
        public GivingItem(Giving giving, GivingType givingType, double amount, string note = "")
        {
            GivingItemsController gc = new GivingItemsController();

            gc.Add(
                new Param("givingId", giving.id),
                new Param("givingTypeId", givingType.id),
                new Param("amount", amount),
                new Param("note", note)
                );
            GivingItem gi = gc.GetLastAdded();

            this.id         = gi.id;
            this.giving     = gi.giving;
            this.givingType = gi.givingType;
            this.amount     = gi.amount;
            this.note       = gi.note;
        }
Beispiel #3
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();
        }
Beispiel #4
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);
            }
        }