예제 #1
0
파일: Common.cs 프로젝트: kkwkk/ybyzt
        /// <summary>
        /// 获取商品最新价格信息
        /// </summary>
        /// <param name="CompID">核心企业ID</param>
        /// <param name="DisID">经销商ID</param>
        /// <param name="GoodinfoID">商品ID</param>
        /// <returns></returns>
        public static decimal GetGoodsPrice(int CompID, int DisID, int GoodinfoID)
        {
            //获取商品信息
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat(@"select * from dbo.GetGoodsInfoPrice({0},{1},'{2}')", DisID, CompID, GoodinfoID);

            DataTable dt = SqlHelper.Query(SqlHelper.LocalSqlServer, sql.ToString()).Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                //查询商品
                DataRow[] dr = dt.Select(" GoodsInfoID=" + GoodinfoID);
                if (dr.Length > 0)
                {
                    return(Convert.ToDecimal(dr[0]["finalPrice"].ToString()));
                }
                else
                {
                    return(0);
                }
            }
            return(0);
        }