public Boolean AddProductBeneficiary(ProductBeneficiary prodbenf) { int result = 0; SqlConnection con = getConnection(); { try { string QUERY = "INSERT INTO ProductBeneficiary(Prod_Id,Benf_Id,Royalty_perc) VALUES (@Prod_Id,@Benf_Id,@Royalty_perc)"; con.Open(); SqlCommand cmd = new SqlCommand(QUERY, con); cmd.Parameters.AddWithValue("@Prod_Id", prodbenf.Prod_Id); cmd.Parameters.AddWithValue("@Benf_Id", prodbenf.Benf_Id); cmd.Parameters.AddWithValue("@Royalty_perc", prodbenf.Royalty_perc); result = cmd.ExecuteNonQuery(); con.Close(); } catch (SqlException se) { Console.Write(se.Message); } } return(result > 0 ? true : false); }
bool IService1.AddProductBeneficiary(ProductBeneficiary prodbenf) { return(products.AddProductBeneficiary(prodbenf)); }