public string ProductList(string code) { List <YpReview> list = new List <YpReview>(); string sql = string.Format(@"select TOP 10 id,sphh,yphh,lsdj,mlcf,ypmc,lcpsbs psbs,lcpsr psr,lcpsrq psrq,ztbs,ppbs from yx_T_ypdmb WHERE kfbh LIKE '{1}' and (yphh like '%{0}%' OR bq='{0}')", code, cache.SysConfig.GetValue("CheckViewYearSeason")); using (IDataReader dr = dal.ExecuteReader(sql)) { while (dr.Read()) { YpReview yy = new YpReview(); yy.Id = int.Parse(dr[0].ToString()); yy.Sphh = dr[1].ToString(); yy.Yphh = dr[2].ToString(); yy.Lsdj = decimal.Parse(dr[3].ToString()); yy.Mlcf = dr[4].ToString(); yy.Ypmc = dr[5].ToString(); yy.Psbs = dr[6].ToString(); yy.Psr = dr[7].ToString(); yy.Psrq = dr[8].ToString(); yy.Iszt = dr[9].ToString(); yy.Ispp = dr[10].ToString(); yy.IsEnable = true; list.Add(yy); } } return(ToString <List <YpReview> >(list)); }
public string ReviewListByName(string cname) { List <YpReview> list = new List <YpReview>(); //WHERE kfbh = '20153' string sql = string.Format(@"select t1.id,sphh,yphh,lsdj,mlcf,ypmc,ysbs psbs,ysr psr,ysrq psrq,ztbs,ppbs,t2.dm+'.'+t2.mc lbmc from yx_t_ypdmb t1 inner join YX_T_Splb t2 on t1.splbid=t2.id WHERE kfbh LIKE '{1}' and ysr='{0}' and ysbs=1 ORDER BY psrq DESC", cname, cache.SysConfig.GetValue("CheckViewYearSeason")); using (IDataReader dr = dal.ExecuteReader(sql)) { while (dr.Read()) { YpReview yy = new YpReview(); //yy.Id = int.Parse(dr[0].ToString()); //yy.Sphh = dr[1].ToString(); yy.Yphh = dr[2].ToString(); yy.Lsdj = decimal.Parse(dr[3].ToString()); //yy.Mlcf = dr[4].ToString(); yy.Ypmc = dr[5].ToString(); //yy.Psr = dr[7].ToString(); //yy.Psrq = dr[8].ToString(); yy.Iszt = dr[9].ToString(); yy.Ispp = dr[10].ToString(); yy.Splb = dr[11].ToString(); //yy.IsEnable = true; list.Add(yy); } } return(ToString <List <YpReview> >(list)); }