private void btnGenerate_Click(object sender, EventArgs e) { double monthlyfee; // Existence checks if (txtMonthlyFee.Text.Trim() == string.Empty) { MessageBox.Show("Enter Monthly Fee", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); txtMonthlyFee.Focus(); return; } //Type Check if (double.TryParse(txtMonthlyFee.Text, out monthlyfee) == false) { MessageBox.Show("Enter a number for Fee.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); txtMonthlyFee.Focus(); return; } else // All checks are satisfied { InvoiceReceipt InvoicePayment = new InvoiceReceipt(); InvoicePayment.SetSubscriberID((int)NUDSubID.Value); InvoicePayment.SetMonthlyFee(double.Parse(txtMonthlyFee.Text)); InvoicePayment.SetRenewalDate(DTPRenewalDate.Value); lstInvoice.Items.Add(lstInvoiceFetch(InvoicePayment)); SendStatusUpdate(true, "Records Generated!", "success"); } }
private ListViewItem lstInvoiceFetch(InvoiceReceipt xInvoice) { ListViewItem lstInvoice = new ListViewItem(xInvoice.GetSubscriberID().ToString()); lstInvoice.SubItems.Add(xInvoice.GetMonthlyBill().ToString()); lstInvoice.SubItems.Add(xInvoice.GetRenewalDate().ToLongDateString()); return(lstInvoice); }