Esempio n. 1
0
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            if (givingDataGridView.Rows.Count == 0)
            {
                return;
            }
            int id = Convert.ToInt32(givingDataGridView.SelectedRows[0].Cells["givingId"].Value);

            GivingsController gc = new GivingsController();

            Giving giving = gc.Show(id);

            DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete Oferring of " + giving.member.firstName + "\n NOTE: this action cannot be undone!",
                                                        "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (dialogResult == DialogResult.No)
            {
                return;
            }
            else if (dialogResult == DialogResult.Yes)
            {
                giving.Delete();
                MessageBox.Show("Offering Type Deleted from records!", "Offering Type Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadGivings();
            }
        }
Esempio n. 2
0
        private void GivingDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            GivingsController gc = new GivingsController();
            Giving            g  = gc.Show((int)givingDataGridView.SelectedRows[0].Cells["givingId"].Value);

            if (g != null)
            {
                LoadGivingItems(g);
            }
        }
        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();
        }
Esempio n. 4
0
        public void Update(Member member, DateTime givingDate, Service service)
        {
            GivingsController gc = new GivingsController();

            gc.Update(id,
                      new Param("memberId", member.id),
                      new Param("givingDate", givingDate),
                      new Param("serviceId", service.id)
                      );
            this.member     = member;
            this.givingDate = givingDate;
        }
Esempio n. 5
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            if (givingDataGridView.Rows.Count == 0)
            {
                return;
            }
            GivingsController gc     = new GivingsController();
            Giving            giving = gc.Show(Convert.ToInt32(givingDataGridView.SelectedRows[0].Cells["givingId"].Value));

            AddUpdateGivingFrm addGivingFrm = new AddUpdateGivingFrm(true, giving);

            addGivingFrm.FormClosing += new FormClosingEventHandler(this.GivingUpdated);
            addGivingFrm.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);
        }
Esempio n. 7
0
        public Giving(Member member, DateTime givingDate, Service service, Session session)
        {
            GivingsController gc = new GivingsController();

            gc.Add(new Param("memberId", member.id),
                   new Param("givingDate", givingDate),
                   new Param("entryDate", DateTime.Now),
                   new Param("serviceId", service.id),
                   new Param("sessionId", session.id)
                   );
            Giving            g  = gc.GetLastAdded();
            MembersController mc = new MembersController();

            this.member     = g.member;
            this.givingDate = g.givingDate;
            this.entryDate  = g.entryDate;
            this.service    = g.service;
            this.session    = g.session;
        }
Esempio n. 8
0
        public void LoadGivings()
        {
            GivingsController givingsController = new GivingsController();

            if ((Service)servicesCmbBx.SelectedValue == null)
            {
                return;
            }
            givings = currentSession.user.isAdmin? givingsController.ShowAllWithinScope((Service)servicesCmbBx.SelectedValue, givingDateDateTimePicker.Value): givingsController.ShowAllWithinScope((Service)servicesCmbBx.SelectedValue, givingDateDateTimePicker.Value, currentSession);
            //givings = givingsController.ShowAll();
            ResetGivingTable();

            //rows
            double total = 0;

            if (givings.Count > 0)
            {
                foreach (Giving giving in givings)
                {
                    givingDataGridView.Rows.Add(
                        giving.id,
                        giving.member.FullName(),
                        giving.givingDate.ToString("MMMM dd, yyyy"),
                        giving.entryDate.ToString("MMMM dd, yyyy")
                        );
                    total += giving.totalAmount();
                }
                givingDataGridView.ClearSelection();
                givingDataGridView.Rows[givings.Count - 1].Selected = true;
                LoadGivingItems(givings[givings.Count - 1]);
            }
            else
            {
                ResetGivingItemsTable();
                //selectedGiving = null;
                //  MessageBox.Show("No offering are currently registered in the system. Please add an offering!", "No Offering Found!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }

            totalOfferingTxt.Text = total.ToString("C", CultureInfo.CurrentCulture);
        }
Esempio n. 9
0
        private void LoadGivingItems(Giving g)
        {
            selectedGiving    = g;
            giverNameTxt.Text = g.member.FullName();
            givingItemsDateTimePicker.Value = g.givingDate;
            List <GivingItem> givingItems = g.givingItems();

            ResetGivingItemsTable();
            //rows
            if (givingItems.Count > 0)
            {
                foreach (GivingItem givingItem in givingItems)
                {
                    givingItemsDataGridView.Rows.Add(
                        givingItem.id,
                        givingItem.givingType.title,
                        givingItem.amount,
                        givingItem.note
                        );
                }
                givingItemsDataGridView.ClearSelection();
                givingItemsDataGridView.Rows[givingItems.Count - 1].Selected = true;
            }

            totalTxt.Text = g.totalAmount().ToString("C", CultureInfo.CurrentCulture);
            GivingsController givingsController = new GivingsController();

            givings = givingsController.ShowAll();
            double total = 0;

            foreach (Giving giving in givings)
            {
                total += giving.totalAmount();
            }

            totalOfferingTxt.Text = total.ToString("C", CultureInfo.CurrentCulture);
        }
Esempio n. 10
0
        public void Delete()
        {
            GivingsController gc = new GivingsController();

            gc.Delete(id);
        }