public int Insert(Product_AttributeValue productAttributeValue)
        {
            if (productAttributeValue == null)
            {
                throw new ArgumentNullException("productAttributeValue");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "AttributeID",
                                         SqlDbType.NVarChar,
                                         productAttributeValue.AttributeID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "AttributeValue",
                                         SqlDbType.NVarChar,
                                         productAttributeValue.AttributeValue,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Sorting",
                                         SqlDbType.Int,
                                         productAttributeValue.Sorting,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "IsDefault",
                                         SqlDbType.Int,
                                         productAttributeValue.IsDefault,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "ReferenceID",
                                         SqlDbType.Int,
                                         null,
                                         ParameterDirection.Output)
                                 };

            this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Product_AttributeValue_Insert", parameters, null);
            return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value;
        }
 /// <summary>
 /// The modify product attribute value.
 /// </summary>
 /// <param name="productAttributeValue">
 /// The product attribute value.
 /// </param>
 public void ModifyProductAttributeValue(Product_AttributeValue productAttributeValue)
 {
     this.productAttributeValueDA.Update(productAttributeValue);
 }
 /// <summary>
 /// The add product attribute value.
 /// </summary>
 /// <param name="productAttributeValue">
 /// The product attribute value.
 /// </param>
 /// <returns>
 /// The <see cref="int"/>.
 /// </returns>
 public int AddProductAttributeValue(Product_AttributeValue productAttributeValue)
 {
     return this.productAttributeValueDA.Insert(productAttributeValue);
 }
Пример #4
0
        public ActionResult AddAttributeValue(string attributeValue, int Sorting, int isDefault, string productAttrID)
        {
            try
            {
                var productAttrValue = new Product_AttributeValue
                {
                    AttributeValue = attributeValue,
                    AttributeID = Convert.ToInt32(productAttrID),
                    Sorting = Sorting,
                    IsDefault = isDefault,

                };
                //if (productAttributeValueModel != null)
                //{
                //    var productAttrValue = DataTransfer.Transfer<Product_AttributeValue>(
                //        productAttributeValueModel,
                //        typeof(ProductAttributeValueModel));
                //    productAttrValue.AttributeID = Convert.ToInt32(productAttrID);
                //    productAttributeValueModel.ID =
                this.ProductAttributeValueService.AddProductAttributeValue(productAttrValue);
                // }

                return Json("");
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message, exception);
            }
        }
Пример #5
0
        public ActionResult ModifyAttributeValue(string attributeValue, int Sorting, int isDefault, int attributeID, int id)
        {
            try
            {

                var productAttrValue = new Product_AttributeValue
                {
                    AttributeID = attributeID,
                    AttributeValue = attributeValue,
                    CreateTime = DateTime.Now,
                    ID = id,
                    IsDefault = isDefault,
                    Sorting = Sorting
                };

                this.ProductAttributeValueService.ModifyProductAttributeValue(productAttrValue);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message, exception);
            }

            return Json(new AjaxResponse { Data = 1, Message = "修改成功" });
        }
        public void Update(Product_AttributeValue productAttributeValue)
        {
            if (productAttributeValue == null)
            {
                throw new ArgumentNullException("productAttributeValue");
            }

            var parameters = new List<SqlParameter>
                                 {
                                     this.SqlServer.CreateSqlParameter(
                                         "ID",
                                         SqlDbType.Int,
                                         productAttributeValue.ID,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "AttributeValue",
                                         SqlDbType.NVarChar,
                                         productAttributeValue.AttributeValue,
                                         ParameterDirection.Input),
                                     this.SqlServer.CreateSqlParameter(
                                         "Sorting",
                                         SqlDbType.Int,
                                         productAttributeValue.Sorting,
                                         ParameterDirection.Input),
                                         this.SqlServer.CreateSqlParameter(
                                         "IsDefault",
                                         SqlDbType.Int,
                                         productAttributeValue.IsDefault,
                                         ParameterDirection.Input
                                         ),
                                         this.SqlServer.CreateSqlParameter(
                                         "AttributeID",
                                         SqlDbType.Int,
                                         productAttributeValue.AttributeID,
                                         ParameterDirection.Input
                                         )
                                 };
            try
            {
                this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Product_AttributeValue_Update", parameters, null);
            }
            catch (Exception exception)
            {
                throw new Exception("Exception - ProductAttributeValueDA - Update", exception);
            }
        }