public void Initialize() { //Initialize van de test data. //Aantal datums voor onderstaande testen waar nodig. testDatumBirth1 = new DateTime(2001, 1, 1); testDatumBirth2 = new DateTime(); testGeplaatst = new DateTime(2016, 1, 16); //Niewe categorie c = new Categorie(1, "Airsoft", 1); //Niewe producten toevoegen. p = new Product("112342", c, "Geweer", "Ja", 10, 1, "mooi", "/Imageurl"); p1 = new Product("112342", c, "Geweer", "Ja", 20, 1, "mooi", "/Imageurl"); //Niewe klanten toevoegen. k = new Klant(1, "*****@*****.**", "TestWW", "Test", "Test", testDatumBirth1, "TestDatum", "BTW123456", "0613556430", true, true); k1 = new Klant(1, "*****@*****.**", "TestWW", "Test", "Test", testDatumBirth2, "TestDatum", "BTW123456", "0613556430", true, true); //Nieuwe medewerkers toevoegen. m = new Medewerker(1, "*****@*****.**", "TEST", "Mario", "Schipper", testDatumBirth1, "Klokuus", "", "0612366666", true); m1 = new Medewerker(2, "*****@*****.**", "TEST", "Mario", "Schipper", testDatumBirth1, "Klokuus", "", "0612366666", false); }
public bool ChangeProduct(Product product) { if (FindProduct(product.ID) != null) { data.UpdateProduct(product); //RefreshClass(); return true; } return false; }
public void RemoveProduct(Product product) { using (OracleConnection connection = Connection) { string delete = "DELETE FROM PRODUCT WHERE ID =" + product.ID; using (OracleCommand command = new OracleCommand(delete, connection)) { command.ExecuteNonQuery(); } } }
public void InsertCart(Product p, Klant k, int aantal) { using (OracleConnection connection = Connection) { string Insert = "INSERT INTO BESTELLINGPRODUCT (BestellingID, ProductID, AccontID, Aantal) VALUES (seq_bestelling_ID.nextval, :PRODUCTID, :ACCOUNTID, :AANTAL)"; using (OracleCommand command = new OracleCommand(Insert, connection)) { command.Parameters.Add(new OracleParameter("PRODUCTID", p.ID )); command.Parameters.Add(new OracleParameter("ACCOUNTID", k.ID)); command.Parameters.Add(new OracleParameter("AANTAL", aantal)); command.ExecuteNonQuery(); } } }
public bool AddProduct(Product product) { foreach (Categorie c in Categories) { if (FindProduct(product.ID) != null) { return false; } if (c.CategorieNaam != product.Categorie.CategorieNaam) continue; product.Categorie.ID = c.ID; data.InsertProduct(product); RefreshData(); return true; } return false; }
public void UpdateProduct(Product product) { using (OracleConnection connection = Connection) { string Update = "UPDATE PRODUCT SET CATEGORIENAAM =:Categorienaam, NAAM =:Naam, BESCHIKBAARHEID =:Beschikbaarheid, PRIJSSTUK =:PrijsStuk, AANTAL =:Aantal, BESCHRIJVING =:Beschrijving, imageUrl =:imageUrl WHERE ID =:ID"; using (OracleCommand command = new OracleCommand(Update, connection)) { command.Parameters.Add(new OracleParameter("CATEGORIENAAM", product.Categorie)); command.Parameters.Add(new OracleParameter("NAAM", product.Naam)); command.Parameters.Add(new OracleParameter("BESCHIKBAARHEID", product.Beschikbaarheid)); command.Parameters.Add(new OracleParameter("PRIJSSTUK", product.PrijsStuk)); command.Parameters.Add(new OracleParameter("AANTAL", product.Aantal)); command.Parameters.Add(new OracleParameter("BESCHRIJVING", product.Beschrijving)); command.Parameters.Add(new OracleParameter("imageUrl", product.ImgUrl)); command.Parameters.Add(new OracleParameter("ID", product.ID)); command.ExecuteNonQuery(); } } }
public void InsertProduct(Product product) { using (OracleConnection connection = Connection) { string Insert = "INSERT INTO Product (ID, Categorieid, Naam, Beschikbaarheid, PrijsStuk, Aantal, Beschrijving, imageUrl) VALUES (:ID, :CATEGORIEID, :NAAM, :BESCHIKBAARHEID, :PRIJSSTUK, :AANTAL, :BESCHRIJVING, :IMAGEURL)"; using (OracleCommand command = new OracleCommand(Insert, connection)) { command.Parameters.Add(new OracleParameter("ID", product.ID)); command.Parameters.Add(new OracleParameter("CATEGORIEID", product.Categorie.ID)); // ZIT NOG FOUT IN command.Parameters.Add(new OracleParameter("NAAM", product.Naam)); command.Parameters.Add(new OracleParameter("BESCHIKBAARHEID", product.Beschikbaarheid)); command.Parameters.Add(new OracleParameter("PRIJSSTUK", product.PrijsStuk)); command.Parameters.Add(new OracleParameter("AANTAL", product.Aantal)); command.Parameters.Add(new OracleParameter("BESCHRIJVING", product.Beschrijving)); command.Parameters.Add(new OracleParameter("IMAGEURL", product.ImgUrl)); command.ExecuteNonQuery(); } } }
protected void btnSubmit_OnClick(object sender, EventArgs e) { Product product = new Product(txtID.Text, new Categorie(0,ddlCategorie.SelectedValue,0), txtName.Text, txtBeschikbaar.Text, Convert.ToDecimal(txtPrice.Text), 0, txtDescription.Text, ddlImage.SelectedValue); admin.AddProduct(product); }
public bool AddProductToWinkelwagen(Product product, Klant klant, int aantal) { data.InsertCart(product, klant, aantal); { return true; } }