/// <summary>
        /// 更新一条数据
        /// </summary>
        public void UpdatePriceClassDefaultPriceInfo(PriceClassDefaultPriceInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tbPriceClassDefaultPriceInfo set ");
            strSql.Append("PriceClassID=@PriceClassID,");
            strSql.Append("ProductsID=@ProductsID,");
            strSql.Append("pPrice=@pPrice,");
            strSql.Append("pIsEdit=@pIsEdit");
            strSql.Append(" where PriceClassDefaultPriceID=@PriceClassDefaultPriceID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PriceClassDefaultPriceID", SqlDbType.Int,   4),
                new SqlParameter("@PriceClassID",             SqlDbType.Int,   4),
                new SqlParameter("@ProductsID",               SqlDbType.Int,   4),
                new SqlParameter("@pPrice",                   SqlDbType.Money, 8),
                new SqlParameter("@pIsEdit",                  SqlDbType.Int,   4),
            };
            parameters[0].Value = model.PriceClassDefaultPriceID;
            parameters[1].Value = model.PriceClassID;
            parameters[2].Value = model.ProductsID;
            parameters[3].Value = model.pPrice;
            parameters[4].Value = model.pIsEdit;

            DbHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int AddPriceClassDefaultPriceInfo(PriceClassDefaultPriceInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tbPriceClassDefaultPriceInfo(");
            strSql.Append("PriceClassID,ProductsID,pPrice,pIsEdit)");
            strSql.Append(" values (");
            strSql.Append("@PriceClassID,@ProductsID,@pPrice,@pIsEdit)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PriceClassID", SqlDbType.Int,   4),
                new SqlParameter("@ProductsID",   SqlDbType.Int,   4),
                new SqlParameter("@pPrice",       SqlDbType.Money, 8),
                new SqlParameter("@pIsEdit",      SqlDbType.Int,   4),
            };
            parameters[0].Value = model.PriceClassID;
            parameters[1].Value = model.ProductsID;
            parameters[2].Value = model.pPrice;
            parameters[3].Value = model.pIsEdit;

            object obj = DbHelper.ExecuteScalar(CommandType.Text, strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 保存价格类型默认价格
        /// </summary>
        /// <param name="PriceClassID"></param>
        /// <param name="ProductsID"></param>
        /// <param name="pPrice"></param>
        /// <returns></returns>
        public static bool SavePriceClassDefaultPrice(int PriceClassID, int ProductsID, decimal pPrice, int pIsEdit)
        {
            bool re = false;
            PriceClassDefaultPriceInfo pci = DatabaseProvider.GetInstance().GetPriceClassDefaultPriceInfoModel(PriceClassID, ProductsID);

            if (pci != null)
            {
                pci.pPrice  = pPrice;
                pci.pIsEdit = pIsEdit;
                tbPriceClassDefaultPriceInfo.UpdatePriceClassDefaultPriceInfo(pci);
                re = true;
            }
            else
            {
                pci              = new PriceClassDefaultPriceInfo();
                pci.ProductsID   = ProductsID;
                pci.PriceClassID = PriceClassID;
                pci.pPrice       = pPrice;
                pci.pIsEdit      = pIsEdit;

                if (tbPriceClassDefaultPriceInfo.AddPriceClassDefaultPriceInfo(pci) > 0)
                {
                    re = true;
                }
                else
                {
                    re = false;
                }
            }
            return(re);
        }
        public PriceClassDefaultPriceInfo GetPriceClassDefaultPriceInfoModel(int PriceClassID, int ProductsID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 PriceClassDefaultPriceID,PriceClassID,ProductsID,pPrice,pIsEdit from tbPriceClassDefaultPriceInfo ");
            strSql.Append(" where PriceClassID=@PriceClassID and ProductsID=@ProductsID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PriceClassID", SqlDbType.Int, 4),
                new SqlParameter("@ProductsID",   SqlDbType.Int, 4)
            };
            parameters[0].Value = PriceClassID;
            parameters[1].Value = ProductsID;

            PriceClassDefaultPriceInfo model = new PriceClassDefaultPriceInfo();
            DataSet ds = DbHelper.ExecuteDataset(CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PriceClassDefaultPriceID"].ToString() != "")
                {
                    model.PriceClassDefaultPriceID = int.Parse(ds.Tables[0].Rows[0]["PriceClassDefaultPriceID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PriceClassID"].ToString() != "")
                {
                    model.PriceClassID = int.Parse(ds.Tables[0].Rows[0]["PriceClassID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ProductsID"].ToString() != "")
                {
                    model.ProductsID = int.Parse(ds.Tables[0].Rows[0]["ProductsID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["pPrice"].ToString() != "")
                {
                    model.pPrice = decimal.Parse(ds.Tables[0].Rows[0]["pPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["pIsEdit"].ToString() != "")
                {
                    model.pIsEdit = int.Parse(ds.Tables[0].Rows[0]["pIsEdit"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
 public static void UpdatePriceClassDefaultPriceInfo(PriceClassDefaultPriceInfo model)
 {
     DatabaseProvider.GetInstance().UpdatePriceClassDefaultPriceInfo(model);
 }
 public static int AddPriceClassDefaultPriceInfo(PriceClassDefaultPriceInfo model)
 {
     return(DatabaseProvider.GetInstance().AddPriceClassDefaultPriceInfo(model));
 }