// Generates PDF. private void generateButton_Click(object sender, EventArgs e) { Customer customer = null; if (string.IsNullOrWhiteSpace(companyNameTextbox.Text) || string.IsNullOrWhiteSpace(nameTextbox.Text) || string.IsNullOrWhiteSpace(departmentTextbox.Text) || string.IsNullOrWhiteSpace(postalcodeTextbox.Text) || string.IsNullOrWhiteSpace(locationTextbox.Text) || string.IsNullOrWhiteSpace(phonenumberTextbox.Text) || string.IsNullOrWhiteSpace(emailTextbox.Text) || string.IsNullOrWhiteSpace(kvkNumberTextbox.Text) || string.IsNullOrWhiteSpace(ibanTextbox.Text)) { MessageBox.Show("Vul alstublieft alle velden in.", "Foutmelding", MessageBoxButtons.OK); } else { if (selected != null) { customer = new Customer( companyNameTextbox.Text, nameTextbox.Text, departmentTextbox.Text, postalcodeTextbox.Text, locationTextbox.Text, adresTextbox.Text, phonenumberTextbox.Text, emailTextbox.Text, kvkNumberTextbox.Text, ibanTextbox.Text, selected.subThemeId ); } else { customer = new Customer( companyNameTextbox.Text, nameTextbox.Text, departmentTextbox.Text, postalcodeTextbox.Text, locationTextbox.Text, adresTextbox.Text, phonenumberTextbox.Text, emailTextbox.Text, kvkNumberTextbox.Text, ibanTextbox.Text ); } AddCustomer(customer); FillExistingCustomerList(); } // Adds Invoice to database. //if (ic.productPanelList.Count > 0) //{ } // bool exists = false; // foreach(Customer c in DatabaseController.customerList) // { // if ((c.companyName + c.department + c.name).Equals((customer.companyName + customer.department + customer.name))) // { // Console.WriteLine("Exist == true"); // exists = true; // } // } // if(!exists) // { // Console.WriteLine("Exist == false"); // DatabaseController.AddCustomer(customer); // } InvoiceData invoice = new InvoiceData(customer, representative, DateTime.Parse(dateInvoiceDateLabel.Text), room); DatabaseController.AddRoom(room); DatabaseController.AddInvoice(invoice); invoice = DatabaseController.invoiceList.Last(); foreach (InvoiceProductPanel ipp in ic.productPanelList) { DatabaseController.AddOrderedProduct(invoice.InvoiceDataId, ipp.product, ipp.amountOfCopies); } ic.SetInfo(customer, representative, intInvoiceNumberLabel.Text.ToString(), room); ic.MakePdf(); Close(); }