public void Add(ProductTypeAttributeRecordInfo entity) { using (var conn = new SqlConnection(connectString)) { string sql = @"INSERT INTO ProductTypeAttributeRecord( ProductId,AttributeId,Value) VALUES(@ProductId,@AttributeId,@Value)"; conn.Execute(sql, entity); } }
public void Update(ProductTypeAttributeRecordInfo entity) { using (var conn = new SqlConnection(connectString)) { string sql = @"UPDATE ProductTypeAttributeRecord SET ProductId = @ProductId, AttributeId = @AttributeId, Value = @Value where Id=@Id"; conn.Execute(sql, entity); } }
/// <summary> /// 属性处理 /// </summary> /// <param name="productID"></param> protected void HanderAttribute(ProductInfo product) { if (product.Id > 0) { ProductTypeAttributeRecordBLL.Delete(product.Id); } int lastClassID = ProductClassBLL.GetLastClassID(product.ClassId); int productTypeID = ProductClassBLL.GetProductClassType(lastClassID); List <ProductTypeAttributeInfo> attributeList = ProductTypeAttributeBLL.ReadList(productTypeID); foreach (ProductTypeAttributeInfo attribute in attributeList) { ProductTypeAttributeRecordInfo attributeRecord = new ProductTypeAttributeRecordInfo(); attributeRecord.AttributeId = attribute.Id; attributeRecord.ProductId = product.Id; attributeRecord.Value = RequestHelper.GetForm <string>(attribute.Id.ToString() + "Value").Replace(',', ';'); ProductTypeAttributeRecordBLL.Add(attributeRecord); } }
public static void Update(ProductTypeAttributeRecordInfo entity) { dal.Update(entity); CacheHelper.Remove(cacheKey); }