Exemplo n.º 1
0
 /// <summary>
 /// returns all products that includes this value
 /// </summary>
 /// <param name="propVal"></param>
 /// <returns></returns>
 public static List<int> GetProductsIDsByPropertyValue(PropertyValue propVal)
 {
     List<int> productIDs = SQLDataAccess.ExecuteReadList<int>("[Catalog].[sp_GetProductsIDsByPropertyValue]",
                                                          CommandType.StoredProcedure,
                                                          reader => SQLDataHelper.GetInt(reader, "ProductID"),
                                                          new SqlParameter("@ValueID", propVal.PropertyValueId));
     return productIDs;
 }
Exemplo n.º 2
0
 /// <summary>
 /// updates value in DB
 /// </summary>
 /// <param name="value"></param>
 public static void UpdatePropertyValue(PropertyValue value)
 {
     SQLDataAccess.ExecuteNonQuery("[Catalog].[sp_UpdatePropertyValue]", CommandType.StoredProcedure,
                                          new SqlParameter("@Value", value.Value),
                                          new SqlParameter("@SortOrder", value.SortOrder),
                                          new SqlParameter("@PropertyValueId", value.PropertyValueId)
                                          );
 }
Exemplo n.º 3
0
        /// <summary>
        /// adds new value for some property
        /// </summary>
        /// <param name="propVal"></param>
        public static int AddPropertyValueIntoDbAndReturnPropId(PropertyValue propVal)
        {
            if (propVal == null)
                throw new ArgumentNullException("propVal");
            if (propVal.PropertyId == 0)
                throw new ArgumentException(@"PropertyId cannot be zero", "propVal");

            var propValId = SQLDataAccess.ExecuteScalar<int>("[Catalog].[sp_AddPropertyValue]", CommandType.StoredProcedure,
                                                                new SqlParameter("@Value", propVal.Value),
                                                                new SqlParameter("@PropertyID", propVal.PropertyId),
                                                                new SqlParameter("@SortOrder", propVal.SortOrder)
                                                                );
            return propValId;
        }