public bool UpdateOfferById(SpecialOffer o)
 {
     try
     {
         SqlConnection cnn    = ReturnSQLConnection();
         string        query  = "UPDATE dbo.[SpecialOffer] SET Startdate=@Start, Enddate=@End, OfferPrice=@OfferPrice WHERE ProductID = @ProductId";
         SqlCommand    newCmd = CreateSQLCommandText(query, cnn);
         newCmd.Parameters.AddWithValue("@Start", o.StartTime);
         newCmd.Parameters.AddWithValue("@End", o.EndTime);
         newCmd.Parameters.AddWithValue("@OfferPrice", o.RetrieveOfferPrice());
         newCmd.Parameters.AddWithValue("@ProductId", o.RetrieveProductId());
         newCmd.ExecuteNonQuery();
         cnn.Close();
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
     return(false);
 }
        public bool CreateNewSpecialOffer(SpecialOffer s)
        {
            try
            {
                SqlConnection cnn    = ReturnSQLConnection();
                string        query  = "INSERT INTO dbo.[SpecialOffer] (Startdate, Enddate, OfferPrice, ProductID) VALUES (@Startdate, @Enddate, @OfferPrice, @ProductId)";
                SqlCommand    newCmd = CreateSQLCommandText(query, cnn);
                newCmd.Parameters.AddWithValue("@Startdate", s.StartTime);
                newCmd.Parameters.AddWithValue("@Enddate", s.EndTime);
                newCmd.Parameters.AddWithValue("@OfferPrice", s.RetrieveOfferPrice());
                newCmd.Parameters.AddWithValue("@ProductId", s.RetrieveProductId());

                newCmd.ExecuteNonQuery();
                cnn.Close();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(false);
        }
        public bool UpdateOfferById(SpecialOffer o)
        {
            string sqlUserInsert = "UPDATE dbo.[SpecialOffer] SET Startdate=@Start, Enddate=@End, OfferPrice=@OfferPrice WHERE ProductID = @ProductId";

            using (SqlConnection connection = ReturnSQLConnection())
            {
                int affectedRows = connection.Execute(sqlUserInsert, new { Start = o.StartTime, End = o.EndTime, OfferPrice = o.RetrieveOfferPrice(), ProductId = o.RetrieveProductId() });
                return(true);
            }
        }