Пример #1
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (givingTypesDataGridView.Rows.Count == 0)
            {
                return;
            }
            int id = Convert.ToInt32(givingTypesDataGridView.SelectedRows[0].Cells["givingTypeId"].Value);

            GivingTypesController givingTypesController = new GivingTypesController();

            GivingType givingType = givingTypesController.Show(id);

            DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete Oferring Type: " + 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)
            {
                givingType.Delete();
                MessageBox.Show("Offering Type Deleted from records!", "Offering Type Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadGivingTypes();
            }
        }
Пример #2
0
        public GivingItem(DataRow r)
        {
            GivingsController     gc  = new GivingsController();
            GivingTypesController gtc = new GivingTypesController();

            this.id         = Convert.ToInt32(r["givingItemId"]);
            this.giving     = gc.Show(Convert.ToInt32(r["givingId"]));
            this.givingType = gtc.Show(Convert.ToInt32(r["givingTypeId"]));
            this.amount     = Convert.ToDouble(r["amount"]);
            this.note       = r["note"].ToString();
        }
Пример #3
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (givingTypesDataGridView.Rows.Count == 0)
            {
                return;
            }
            int id = Convert.ToInt32(givingTypesDataGridView.SelectedRows[0].Cells["givingTypeId"].Value);
            GivingTypesController  givingTypesController = new GivingTypesController();
            GivingType             givingType            = givingTypesController.Show(id);
            AddUpdateGivingTypeFrm editGivingType        = new AddUpdateGivingTypeFrm(true, givingType);

            editGivingType.FormClosing += new FormClosingEventHandler(this.GivingTypeUpdated);
            editGivingType.ShowDialog();
        }
        public override void Add(params Param[] @params)
        {
            if (@params.Length != 4)
            {
                return;
            }
            GivingsController     gc  = new GivingsController();
            GivingTypesController gtc = new GivingTypesController();

            if (gc.Show((int)@params[0].value) == null || gtc.Show((int)@params[1].value) == null)
            {
                MessageBox.Show("Offering or Offering Type not found!", "Offering Item Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            base.Add(@params);
        }