Пример #1
0
        public string YphhListV2(string kfbh, int splbid, string bq)
        {
            string sql = String.Format(@"select t2.ypbh,t2.ypzlbh,T4.DM+'.'+t4.mc LB,T1.lsdj1 lsdj,t3.zlmxid,T3.MYPIC,isnull(t5.bq,'') bq,isnull(t6.num,0) photoCount,isnull(t5.psbs,0) psbs
from yf_t_cpkfjh as t1
inner join yf_t_cpkfzlb as t2 on t1.id=t2.id 
INNER JOIN yf_t_cpkfsjtg as t3 on t2.zlmxid=t3.zlmxid and t3.tplx='sjtg' 
INNER JOIN YX_T_Splb AS T4 ON T1.SPLBID=T4.ID
LEFT JOIN yx_t_ypdmb AS t5 ON  t2.ypbh=t5.yphh
LEFT JOIN (SELECT TableID,COUNT(1) num FROM t_uploadfile 
                WHERE groupid='1003' AND TableID <> 0 group by TableID) as t6 ON t2.zlmxid = t6.TableID
where  t1.kfbh='{0}' ", kfbh);

            if (splbid != 0)
            {
                sql += String.Format("and t1.splbid={0} ", splbid);
            }

            if (bq != "")
            {
                sql += String.Format("AND t5.bq = '{0}' ", bq);
            }

            List <ListYFYYSP> yyList = new List <ListYFYYSP>();

            try
            {
                using (IDataReader dr = dal.ExecuteReader(sql))
                {
                    while (dr.Read())
                    {
                        ListYFYYSP yy = new ListYFYYSP();
                        yy.Yphh     = dr[0].ToString();
                        yy.Ypzlbh   = dr[1].ToString();
                        yy.Splbmc   = dr[2].ToString();
                        yy.Lsdj     = dr[3].ToString();
                        yy.Zlmxid   = int.Parse(dr[4].ToString());
                        yy.PicCount = int.Parse(dr[7].ToString());
                        yy.Bq       = dr[6].ToString();
                        yy.Psbs     = dr[7].ToString();
                        yyList.Add(yy);
                    }
                }
                return(ToString <List <ListYFYYSP> >(yyList));
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
Пример #2
0
        public string YphhList(string kfbh, int splbid)
        {
            List <ListYFYYSP> yyList = new List <ListYFYYSP>();

            using (IDataReader dr = dal.ExecuteReader(String.Format(@"select t2.ypbh,t2.ypzlbh,T4.DM+'.'+t4.mc LB,T1.lsdj1 lsdj,t3.zlmxid,T3.MYPIC from yf_t_cpkfjh as t1
inner join yf_t_cpkfzlb as t2 on t1.id=t2.id 
INNER JOIN yf_t_cpkfsjtg as t3 on t2.zlmxid=t3.zlmxid and t3.tplx='sjtg' 
INNER JOIN YX_T_Splb AS T4 ON T1.SPLBID=T4.ID
where  t1.kfbh='{0}' and t1.splbid={1} ", kfbh, splbid)))
            {
                while (dr.Read())
                {
                    ListYFYYSP yy = new ListYFYYSP();
                    yy.Yphh   = dr[0].ToString();
                    yy.Ypzlbh = dr[1].ToString();
                    yy.Splbmc = dr[2].ToString();
                    yy.Lsdj   = dr[3].ToString();
                    yy.Zlmxid = int.Parse(dr[4].ToString());
                    yyList.Add(yy);
                }
            }
            return(ToString <List <ListYFYYSP> >(yyList));
        }