/// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WechatBuilder.Model.wx_shop_cart model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_shop_cart set ");
            strSql.Append("openid=@openid,");
            strSql.Append("wid=@wid,");
            strSql.Append("productId=@productId,");
            strSql.Append("skuId=@skuId,");
            strSql.Append("skuInfo=@skuInfo,");
            strSql.Append("totPrice=@totPrice,");
            strSql.Append("productNum=@productNum,");
            strSql.Append("createDate=@createDate");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@openid",     SqlDbType.VarChar,   100),
                new SqlParameter("@wid",        SqlDbType.Int,         4),
                new SqlParameter("@productId",  SqlDbType.Int,         4),
                new SqlParameter("@skuId",      SqlDbType.Int,         4),
                new SqlParameter("@skuInfo",    SqlDbType.VarChar,   500),
                new SqlParameter("@totPrice",   SqlDbType.Float,       8),
                new SqlParameter("@productNum", SqlDbType.Int,         4),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.openid;
            parameters[1].Value = model.wid;
            parameters[2].Value = model.productId;
            parameters[3].Value = model.skuId;
            parameters[4].Value = model.skuInfo;
            parameters[5].Value = model.totPrice;
            parameters[6].Value = model.productNum;
            parameters[7].Value = model.createDate;
            parameters[8].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WechatBuilder.Model.wx_shop_cart DataRowToModel(DataRow row)
 {
     WechatBuilder.Model.wx_shop_cart model = new WechatBuilder.Model.wx_shop_cart();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["openid"] != null)
         {
             model.openid = row["openid"].ToString();
         }
         if (row["wid"] != null && row["wid"].ToString() != "")
         {
             model.wid = int.Parse(row["wid"].ToString());
         }
         if (row["productId"] != null && row["productId"].ToString() != "")
         {
             model.productId = int.Parse(row["productId"].ToString());
         }
         if (row["skuId"] != null && row["skuId"].ToString() != "")
         {
             model.skuId = int.Parse(row["skuId"].ToString());
         }
         if (row["skuInfo"] != null)
         {
             model.skuInfo = row["skuInfo"].ToString();
         }
         if (row["totPrice"] != null && row["totPrice"].ToString() != "")
         {
             model.totPrice = decimal.Parse(row["totPrice"].ToString());
         }
         if (row["productNum"] != null && row["productNum"].ToString() != "")
         {
             model.productNum = int.Parse(row["productNum"].ToString());
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WechatBuilder.Model.wx_shop_cart model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_shop_cart(");
            strSql.Append("openid,wid,productId,skuId,skuInfo,totPrice,productNum,createDate)");
            strSql.Append(" values (");
            strSql.Append("@openid,@wid,@productId,@skuId,@skuInfo,@totPrice,@productNum,@createDate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@openid",     SqlDbType.VarChar, 100),
                new SqlParameter("@wid",        SqlDbType.Int,       4),
                new SqlParameter("@productId",  SqlDbType.Int,       4),
                new SqlParameter("@skuId",      SqlDbType.Int,       4),
                new SqlParameter("@skuInfo",    SqlDbType.VarChar, 500),
                new SqlParameter("@totPrice",   SqlDbType.Float,     8),
                new SqlParameter("@productNum", SqlDbType.Int,       4),
                new SqlParameter("@createDate", SqlDbType.DateTime)
            };
            parameters[0].Value = model.openid;
            parameters[1].Value = model.wid;
            parameters[2].Value = model.productId;
            parameters[3].Value = model.skuId;
            parameters[4].Value = model.skuInfo;
            parameters[5].Value = model.totPrice;
            parameters[6].Value = model.productNum;
            parameters[7].Value = model.createDate;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WechatBuilder.Model.wx_shop_cart GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,openid,wid,productId,skuId,skuInfo,totPrice,productNum,createDate from wx_shop_cart ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            WechatBuilder.Model.wx_shop_cart model = new WechatBuilder.Model.wx_shop_cart();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public WechatBuilder.Model.wx_shop_cart DataRowToModel(DataRow row)
		{
			WechatBuilder.Model.wx_shop_cart model=new WechatBuilder.Model.wx_shop_cart();
			if (row != null)
			{
				if(row["id"]!=null && row["id"].ToString()!="")
				{
					model.id=int.Parse(row["id"].ToString());
				}
				if(row["openid"]!=null)
				{
					model.openid=row["openid"].ToString();
				}
				if(row["wid"]!=null && row["wid"].ToString()!="")
				{
					model.wid=int.Parse(row["wid"].ToString());
				}
				if(row["productId"]!=null && row["productId"].ToString()!="")
				{
					model.productId=int.Parse(row["productId"].ToString());
				}
				if(row["skuId"]!=null && row["skuId"].ToString()!="")
				{
					model.skuId=int.Parse(row["skuId"].ToString());
				}
				if(row["skuInfo"]!=null)
				{
					model.skuInfo=row["skuInfo"].ToString();
				}
				if(row["totPrice"]!=null && row["totPrice"].ToString()!="")
				{
					model.totPrice=decimal.Parse(row["totPrice"].ToString());
				}
				if(row["productNum"]!=null && row["productNum"].ToString()!="")
				{
					model.productNum=int.Parse(row["productNum"].ToString());
				}
				if(row["createDate"]!=null && row["createDate"].ToString()!="")
				{
					model.createDate=DateTime.Parse(row["createDate"].ToString());
				}
			}
			return model;
		}
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public WechatBuilder.Model.wx_shop_cart GetModel(int id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 id,openid,wid,productId,skuId,skuInfo,totPrice,productNum,createDate from wx_shop_cart ");
			strSql.Append(" where id=@id");
			SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
			parameters[0].Value = id;

			WechatBuilder.Model.wx_shop_cart model=new WechatBuilder.Model.wx_shop_cart();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}