/// <summary>
        /// 增加一条数据
        /// </summary>
        public static int Add(Model.Product_ProperValue model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Product_ProperValue(");
            strSql.Append("productId,properValueId,properValueText,properId,parentId)");
            strSql.Append(" values (");
            strSql.Append("@productId,@properValueId,@properValueText,@properId,@parentId)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@productId",       SqlDbType.Int,        4),
                new SqlParameter("@properValueId",   SqlDbType.Int,        4),
                new SqlParameter("@properValueText", SqlDbType.VarChar, 2000),
                new SqlParameter("@properId",        SqlDbType.Int,        4),
                new SqlParameter("@parentId",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.productId;
            parameters[1].Value = model.properValueId;
            parameters[2].Value = model.properValueText;
            parameters[3].Value = model.properId;
            parameters[4].Value = model.parentId;

            object obj = DBHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public static Model.Product_ProperValue DataRowToModel(DataRow row)
 {
     Model.Product_ProperValue model = new Model.Product_ProperValue();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["productId"] != null && row["productId"].ToString() != "")
         {
             model.productId = int.Parse(row["productId"].ToString());
         }
         if (row["properValueId"] != null && row["properValueId"].ToString() != "")
         {
             model.properValueId = int.Parse(row["properValueId"].ToString());
         }
         if (row["properValueText"] != null)
         {
             model.properValueText = row["properValueText"].ToString();
         }
         if (row["properId"] != null && row["properId"].ToString() != "")
         {
             model.properId = int.Parse(row["properId"].ToString());
         }
         if (row["parentId"] != null && row["parentId"].ToString() != "")
         {
             model.parentId = int.Parse(row["parentId"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.Product_ProperValue model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Product_ProperValue set ");
            strSql.Append("productId=@productId,");
            strSql.Append("properValueId=@properValueId,");
            strSql.Append("properValueText=@properValueText,");
            strSql.Append("properId=@properId,");
            strSql.Append("parentId=@parentId");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@productId",       SqlDbType.Int,        4),
                new SqlParameter("@properValueId",   SqlDbType.Int,        4),
                new SqlParameter("@properValueText", SqlDbType.VarChar, 2000),
                new SqlParameter("@properId",        SqlDbType.Int,        4),
                new SqlParameter("@parentId",        SqlDbType.Int,        4),
                new SqlParameter("@id",              SqlDbType.Int, 4)
            };
            parameters[0].Value = model.productId;
            parameters[1].Value = model.properValueId;
            parameters[2].Value = model.properValueText;
            parameters[3].Value = model.properId;
            parameters[4].Value = model.parentId;
            parameters[5].Value = model.id;

            int rows = DBHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 根据产品ID和属性ID获取对象
        /// </summary>
        /// <param name="productId"></param>
        /// <param name="properId"></param>
        /// <returns></returns>
        public static Product_ProperValue GetModel(int productId, int properId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,productId,properValueId,properValueText,properId,parentId from Product_ProperValue ");
            strSql.Append(" where productId=@productId and properId=@properId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@productId", SqlDbType.Int, 4), new SqlParameter("@properId", SqlDbType.Int, 4)
            };
            parameters[0].Value = productId;
            parameters[1].Value = properId;
            Model.Product_ProperValue model = new Model.Product_ProperValue();
            DataSet ds = DBHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }