public SaleOption GetOption() { SqlConnection connection; SqlCommand command; SqlDataReader reader; string query; SaleOption newOfferOption = new SaleOption(); connection = new SqlConnection(ConfigurationManager.ConnectionStrings["PeninsulaRV"].ConnectionString); query = "SELECT * FROM SaleOption WHERE SaleOptionID = @SaleOptionID"; connection.Open(); command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@OfferOptionID", OptionID); reader = command.ExecuteReader(); while (reader.Read()) { newOfferOption.OfferRef = reader["OfferRef"].ToString(); newOfferOption.Description = reader["Description"].ToString(); newOfferOption.Price = Convert.ToDecimal(reader["Price"]); } reader.Close(); connection.Close(); return(newOfferOption); }
public bool CompareSalesOption(SaleOption option1 = null, SaleOption option2 = null) { if (option1.Description != option2.Description) { return(false); } else { if (option1.Price != option2.Price) { return(false); } else { return(true); } } }