Example #1
0
        public int permanentlyDelete(ProductDiscount pd, MySqlConnection conn)
        {
            conn.Open();
            MySqlCommand cmd = new MySqlCommand("DELETE FROM `product_package_discount` WHERE `Product_ID` = @productID AND `Discount_Code`=@dicountCode", conn);

            cmd.Parameters.AddWithValue("@productID", pd.getProductID());
            cmd.Parameters.AddWithValue("@dicountCode", pd.getDiscountCode());
            cmd.Prepare();
            int i = cmd.ExecuteNonQuery();

            conn.Close();
            return(i);
        }
Example #2
0
        public int insert(ProductDiscount pd, MySqlConnection conn)
        {
            conn.Open();
            MySqlCommand cmd = new MySqlCommand("INSERT INTO `product_package_discount`(`Product_ID`, `Discount_Code`) VALUES (@productID,@dicountCode)", conn);

            cmd.Parameters.AddWithValue("@productID", pd.getProductID());
            cmd.Parameters.AddWithValue("@dicountCode", pd.getDiscountCode());
            cmd.Prepare();
            int i = cmd.ExecuteNonQuery();

            conn.Close();
            return(i);
        }