// TODO : add reset is_sold_today and number_sold_today
 public static void addProduct(Product newProduct)
 {
     //openConnection();
     MySqlCommand command = l_DBConn.CreateCommand();
     try
     {
         String query = "REPLACE product(barcode,number_in_stock,name,category,price,manufacturer) VALUES('" + newProduct.getBarcode() + "','" + newProduct.getNumberInStock().ToString() +
                         "','" + newProduct.getName() + "','" + newProduct.getCategory() +
                         "','" + newProduct.getPrice().ToString() + "','" + newProduct.getManufacturer() + "')";
         command.CommandText = query;
         command.ExecuteNonQuery();
     }
     catch { };
     //closeConnection();
 }
 public static void modifyProduct(Product changedProduct)
 {
     //openConnection();
     MySqlCommand command = l_DBConn.CreateCommand();
     try
     {
         String query = "UPDATE product SET number_in_stock='" + changedProduct.getNumberInStock() +
                         "' ,name='" + changedProduct.getName() + "' ,category='" + changedProduct.getCategory() +
                         "' ,price='" + changedProduct.getPrice() + "' ,manufacturer='" + changedProduct.getManufacturer() +
                         "' WHERE barcode ='" + changedProduct.getBarcode() + "'";
         command.CommandText = query;
         command.ExecuteNonQuery();
     }
     catch { };
     //closeConnection();
 }
 public static Product getProduct(String barcode)
 {
     //openConnection();
     MySqlCommand command = l_DBConn.CreateCommand();
     String query = "SELECT * FROM product WHERE barcode ='" + barcode + "'";
     command.CommandText = query;
     MySqlDataReader reader = command.ExecuteReader();
     while (reader.Read())
     {
         int number_in_stock = (int)Int64.Parse(reader.GetValue(1).ToString());
         string name = reader.GetValue(2).ToString();
         string category = reader.GetValue(3).ToString();
         double price =  Double.Parse(reader.GetValue(4).ToString());
         string manufacturer = reader.GetValue(5).ToString();
         int number_sold_today = (int) Int64.Parse(reader.GetValue(7).ToString());
         Product newProduct = new Product(barcode, name, category, manufacturer, price, number_in_stock);
         newProduct.setNumberSoldToday(number_sold_today);
         reader.Close();
         return (newProduct);
     }
     reader.Close();
     //closeConnection();
     return null;
 }