public Product CreateNewProduct(Product product)
        {
            MySqlConnection connection = DBConnection.Instance().Connection;

            try
            {
                connection.Open();
                byte[]       imageData = ProductConverter.ToBytesArray(product.BitmapImage);
                MySqlCommand command   = new MySqlCommand("create_new_product", connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@_title", product.Title);
                command.Parameters.AddWithValue("@_price", product.Price);
                command.Parameters.AddWithValue("@_categoryId", product.CategoryId);
                command.Parameters.AddWithValue("@_image", imageData);

                MySqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    product.Id = int.Parse(reader[0].ToString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            connection.Close();
            return(product);
        }
        public int DeleteCurProduct(Product product)
        {
            MySqlConnection connection = DBConnection.Instance().Connection;

            try
            {
                connection.Open();
                byte[]       imageData = ProductConverter.ToBytesArray(product.BitmapImage);
                MySqlCommand command   = new MySqlCommand("delete_cur_product", connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@_idproduct", product.Id);
                command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            connection.Close();
            return(1);
        }