Пример #1
0
        public List <Chenduo.Model.imgHistory> GetImgHistory(int productId)
        {
            List <Chenduo.Model.imgHistory> list = new List <Chenduo.Model.imgHistory>();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from imgHistory where goodsid=@ProductId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProductId", SqlDbType.Int, 4)
            };
            parameters[0].Value = productId;
            DataTable dt = DbHelperSQL.Query(strSql.ToString(), parameters).Tables[0];

            Chenduo.Model.imgHistory model = null;
            for (int n = 0; n < dt.Rows.Count; n++)
            {
                model = new Chenduo.Model.imgHistory();
                if (dt.Rows[n]["goodsid"].ToString() != "")
                {
                    model.goodsid = SFUtils.ObjToInt(dt.Rows[n]["goodsid"]);
                }
                model.url = dt.Rows[n]["url"].ToString() != ""
                    ? SFUtils.getWebSite() + dt.Rows[n]["url"].ToString()
                    : "";

                list.Add(model);
            }
            return(list);
        }