/// <summary> /// Saves the newly created product from the form into the database /// </summary> private void SaveNewProduct() { if (!ValidateNewProduct()) { return; } try { int newPackageID = PackageDB.InsertPackage(GetPackageFromFields()); Package package = PackageDB.GetById(newPackageID); GetBindedPackageIds(newPackageID); DisplayPackageDetails(package); HideNewPackageLayout(newPackageID); } catch (Exception e) { MessageBox.Show(e.Message, "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }