public bool deleteCookware(CookwareEN delete) { bool deleted = false; SqlConnection c = new SqlConnection(db); try { c.Open(); SqlCommand com = new SqlCommand("DELETE FROM Cookware WHERE Name = " + delete.Name + " AND Material = " + delete.Material, c); com.ExecuteNonQuery(); deleted = true; } catch (Exception ex) { } finally { c.Close(); } return deleted; }
public bool addCookware(CookwareEN e) { bool added = false; SqlConnection c = new SqlConnection(db); try { c.Open(); SqlCommand com = new SqlCommand("INSERT INTO Cookware VALUES (" + e.Name + ", " + e.Material + "," + e.Imagen + ")", c); com.ExecuteNonQuery(); added = true; } catch (Exception ex) { } finally { c.Close(); } return added; }
public CookwareEN getCookware(string name, string material) { CookwareEN cook = new CookwareEN(); SqlConnection c = new SqlConnection(db); try { c.Open(); SqlCommand com = new SqlCommand("SELECT * FROM Cookware WHERE Name = " + name + " AND Material = " + material + ")", c); SqlDataReader dr = com.ExecuteReader(); if (dr.Read()) { cook.Name = dr["Name"].ToString(); cook.Material = dr["Material"].ToString(); dr.Close(); } } catch (Exception ex) { } finally { c.Close(); } return cook; }
public void UPDATE(CookwareEN update) { }
public void INSERT(CookwareEN e) { }
public List<CookwareEN> getCookwares() { List<CookwareEN> cookwareList = new List<CookwareEN>(); String sql = "SELECT * FROM Cookware"; // string sql = "SELECT * FROM NOTES ORDER BY ID DESC"; SqlConnection con = new SqlConnection(db); try { con.Open(); SqlCommand cmd = new SqlCommand(sql, con); SqlDataReader reader = cmd.ExecuteReader(); CookwareEN cookwareTemp = new CookwareEN(); while (reader.Read()) { cookwareTemp = new CookwareEN(); cookwareTemp.Name = reader["Name"].ToString(); cookwareTemp.Material = reader["Material"].ToString(); cookwareList.Add(cookwareTemp); } } catch (Exception ex) { } finally { con.Close(); } return cookwareList; }
public CookwareEN READ(int cod) { CookwareEN utensilio = new CookwareEN(); return utensilio; }