// Check if the selected client has any invoices private void hasInvoiceCheck(Client client) { bool hasInvoice = InvoiceLookupApiClient.GetInvoicesByClient(client.ClientCode).Count != 0 ? true : false; // Disable the show invoices button, if there are no invoices for the client if (hasInvoice) { buttonReport.Enabled = true; } else { buttonReport.Enabled = false; } }
private void buttonShowInvoices_Click(object sender, EventArgs e) { Client client; client = ClientVM.DisplayClient; PrintInvoiceReportDialog printInvoiceReportDialog = new PrintInvoiceReportDialog(); printInvoiceReportDialog.ClientVM = this.ClientVM; // Use InvoiceLookupApi to find and return invoice report based on client code. ClientVM.Invoices = InvoiceLookupApiClient.GetInvoicesByClient(client.ClientCode); printInvoiceReportDialog.ShowDialog(); }
// Print the invoice report for the selected client from the invoice database. private void buttonReport_Click(object sender, EventArgs e) { Client client; int index = dataGridViewClients.CurrentRow.Index; client = (Client)clientVM.ClientsSource[index]; PrintInvoiceReportDialog printInvoiceReportDialog = new PrintInvoiceReportDialog(); printInvoiceReportDialog.ClientVM = this.clientVM; // Use InvoiceLookupApi to find and return invoice report based on client code. clientVM.Invoices = InvoiceLookupApiClient.GetInvoicesByClient(client.ClientCode); printInvoiceReportDialog.ShowDialog(); }
/// <summary> /// Method to get Invoices By Client Code. /// </summary> /// <param name="clientCode">The clientCode<see cref="string"/>.</param> /// <returns>The <see cref="List{Invoice}"/>.</returns> public static List <Invoice> GetInvoicesByClientCode(string clientCode) { return(InvoiceLookupApiClient.GetInvoicesByClient(clientCode)); }