private void Confirm_Invoice(string planID, string orderID) { bool flag = false; //get Billing info Billing billing = new Billing(); billing.orderID = orderID; billing.planID = planID; var billingResult = billing.GetBillingID(billing.planID, billing.orderID); if (billingResult.Count != 0) { billing.billingID = billingResult[0].billingID; } else { billing.billingID = ""; MessageBox.Show("The billingID is null. Please check the billingID for the billing information.", "Check the billing information."); } //add Invoice Invoice invoice = new Invoice(); invoice.billingID = billing.billingID; invoice.orderID = billing.orderID; var invoiceResult = invoice.GetInvoices(invoice.billingID, invoice.orderID); //set Order.carrierID with selected carrierID if (invoiceResult.Count != 0) { invoice.command = "INSERT"; //assign data from table invoice.invoiceID = "IN" + invoiceResult[0].billingID; invoice.billingID = invoiceResult[0].billingID; invoice.contractID = invoiceResult[0].contractID; invoice.customerID = invoiceResult[0].customerID; invoice.completeStatus = "ISSUED"; flag = invoice.Save(); //#### Check the carrierAvailability if (flag == true) { MessageBox.Show("Invoice's Data is created sucessfully.", "Create Invoice Information."); } else { MessageBox.Show("Invoice's data is not created. You need to check this.", "It is failed for Invoice Information."); } } else { MessageBox.Show("Billing Data is not existed. You need to check this.", "There is no Billing Information."); } }