/// <summary>Loads the billing grid.</summary> private void LoadBillingGrid() { if (!(lstBillParents.SelectedItem is Person selectedPerson)) { return; } //Get list of billing entries related to the parent var billingList = BillingService.GetBillingEntryList(selectedPerson.PersonID, dtFrom.Value, dtTo.Value); //Set primary key field and hide that column grdBilling.DataSource = billingList; if (grdBilling.Columns["BillingDetailID"] != null) { grdBilling.Columns["BillingDetailID"].Visible = false; grdBilling.Columns["BillingDetailID"].Tag = true; } //Set header Names grdBilling.Columns[1].HeaderCell.Value = "Date"; grdBilling.Columns[2].HeaderCell.Value = "Amount"; grdBilling.Columns[3].HeaderCell.Value = "Invoiced"; grdBilling.Columns[4].HeaderCell.Value = "Paid"; }
/// <summary>Handles the Click event of the btnInvoice control.</summary> private void btnInvoice_Click(object sender, EventArgs e) { BillingService.CreateInvoices(); MessageBox.Show(@"Invoices Created"); LoadBillingGrid(); }