public static bool AddProdToPackage(int prodID, int packageID) { TravelExpertsDBCon db = new TravelExpertsDBCon(); List <Products_Suppliers> product_supplier; Packages_Products_Suppliers packageProductSupplier = new Packages_Products_Suppliers(); bool success = true; string query; // Getting the info from the db (assumes first option is correct, this is a big assumtion) query = "Select * from Products_Suppliers where ProductID = " + prodID; SQLAdapter.SQLAdapter.GetFromDB <Products_Suppliers>(out product_supplier, db, query); // Creating the DB object if (product_supplier.Count > 0) { packageProductSupplier.ProductSupplierID = product_supplier[0].ProductSupplierId; packageProductSupplier.PackageID = packageID; } else { success = false; } if (!SQLAdapter.SQLAdapter.InsertToDB <Packages_Products_Suppliers>(packageProductSupplier, db)) { success = false; } return(success); }
private void ToAddProduct_Load(object sender, EventArgs e) { this.DisplayPackage(); db = new TravelExpertsDBCon(); SQLAdapter.SQLAdapter.GetFromDB <Products>(out products, db); this.LoadComboBox(); }