public void DeleteBlogBericht(BlogBericht blogbericht) { using (OracleConnection connection = Connection) { string delete = "DELETE BLOGBERICHT WHERE BLOGBERICHTID = :ID"; using (OracleCommand command = new OracleCommand(delete, connection)) { command.Parameters.Add(new OracleParameter("ID", blogbericht.BlogBerichtId)); command.ExecuteNonQuery(); } } }
public void InsertBlogBericht(BlogBericht blog) { using (OracleConnection connection = Connection) { string insert = "INSERT INTO BLOGBERICHT VALUES (seq_BlogBericht_ID.nextval, :CATEGORIEID, :PRODUCTID, :TITEL, :DATUM, :TEKST, :AFBEELDINGPATH)"; using (OracleCommand command = new OracleCommand(insert, connection)) { command.Parameters.Add(new OracleParameter("CATEGORIEID", blog.Categorie.CategorieId)); command.Parameters.Add(new OracleParameter("PRODUCTID", null)); command.Parameters.Add(new OracleParameter("TITEL", blog.Titel)); command.Parameters.Add(new OracleParameter("DATUM", blog.Datum)); command.Parameters.Add(new OracleParameter("TEKST", blog.Tekst)); command.Parameters.Add(new OracleParameter("AFBEELDINGPATH", blog.AfbeeldingPath)); command.ExecuteNonQuery(); } } }
public void BlogBerichtTest() { BlogBericht blogBericht = new BlogBericht(1, "titel", DateTime.Now, "tekst", "afbeeldingpath", null); Assert.AreEqual(1, blogBericht.BlogBerichtId); Assert.AreEqual("titel", blogBericht.Titel); Assert.AreEqual("tekst", blogBericht.Tekst); Assert.AreEqual("afbeeldingpath", blogBericht.AfbeeldingPath); Assert.IsNull(blogBericht.Categorie); }
public void DeleteBlogBericht(BlogBericht blogBericht) { db.DeleteBlogBericht(blogBericht); }
public void InsertBlogBericht(BlogBericht blogbericht) { db.InsertBlogBericht(blogbericht); }
protected void OnClick(object sender, EventArgs e) { string titel = tbxTitel.Text; DateTime vandaag = DateTime.Now; string tekst = tbxTekst.Text; string afbeeldingpath = tbxAfbeeldingpath.Text; List<Categorie> parentCategorien = administratie.LaadParentCategories(); List<Categorie> childCategorien = new List<Categorie>(); List<Categorie> subChildCategorien = new List<Categorie>(); string selected = ddlCategorien.SelectedItem.Text; foreach (Categorie c in parentCategorien) { if (c.CategorieNaam == selected) { int catId = c.CategorieId; childCategorien = administratie.LaadSubCategories(catId); } } selected = ddlSubCategorien.SelectedItem.Text; int parentId; foreach (Categorie c in childCategorien) { if (c.CategorieNaam == selected) { parentId = c.CategorieId; subChildCategorien = administratie.LaadSubSubCategories(parentId); } } string catNaam = ddlSecondSubCategorien.Text; try { foreach (Categorie c in subChildCategorien) { if (c.CategorieNaam == catNaam) { BlogBericht blogBericht = new BlogBericht(0, titel, vandaag, tekst, afbeeldingpath, c); administratie.InsertBlogBericht(blogBericht); Response.Redirect("Blog.aspx"); } } } catch (Exception) { } }