コード例 #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();
        }
コード例 #4
0
        public void Update(Giving giving, GivingType givingType, double amount, string note = "")
        {
            GivingItemsController gic = new GivingItemsController();

            gic.Update(this.id,
                       new Param("givingId", giving.id),
                       new Param("givingTypeId", givingType.id),
                       new Param("amount", amount),
                       new Param("note", note));
            this.giving     = giving;
            this.givingType = givingType;
            this.amount     = amount;
            this.note       = note;
        }
コード例 #5
0
 public AddUpdateGivingTypeFrm(bool isUpdate, GivingType gt = null)
 {
     this.isUpdate   = isUpdate;
     this.givingType = gt;
     InitializeComponent();
     this.Text           = isUpdate ? "Update Offering Type" : "Add Offering Type";
     this.createBtn.Text = isUpdate ? "Update" : "Create";
     this.AcceptButton   = createBtn;
     if (isUpdate)
     {
         titleTxt.Text          = gt.title;
         isRegularChkBx.Checked = gt.isRegular;
         isActiveChkBx.Checked  = gt.isActive;
     }
 }
コード例 #6
0
        public GivingType(string title, bool isRegular, bool isActive)
        {
            GivingTypesController gtc = new GivingTypesController();

            gtc.Add(
                new Param("title", title),
                new Param("isRegular", isRegular),
                new Param("isActive", isActive));
            GivingType gt = gtc.GetLastAdded();

            this.id        = gt.id;
            this.title     = gt.title;
            this.isRegular = gt.isRegular;
            this.isActive  = gt.isActive;
        }
コード例 #7
0
        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;
        }