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(); } }
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 AddUpdateGivingFrm(bool isUpdate, Giving giving = null, Service service = null, DateTime?date = null, Session session = null) { this.addedDate = date ?? DateTime.Now; this.IsUpdate = isUpdate; this.currentGiving = giving; this.addedService = service; this.currentSession = session; InitializeComponent(); LoadForm(); }
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(); }
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 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; }
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 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; }
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; }
public List <GivingType> ShowUnused(Giving giving) { List <GivingType> givingTypes = new List <GivingType>(); DataTable dt = FinanceDbManager.BasicQuery(FinanceDbManager.QueryMode.SELECT_ALL, tableName, null, new QueryBuilder().Where(idName).NotIn( new QueryBuilder().Select("GivingItems", idName).Where("givingId").EqualsTo(giving.id) ).And("isActive").EqualsTo(true) ); if (dt.Rows.Count > 0) { foreach (DataRow r in dt.Rows) { givingTypes.Add(new GivingType(r)); } } return(givingTypes); }
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); }