Beispiel #1
0
        /// <summary>
        /// 컨텐츠 메인뷰 정보 조회
        /// </summary>
        /// <param name="CONS_ID"></param>
        /// <returns></returns>
        public string S_CV_CTS_INFO_SIN(string CONS_ID)
        {
            List <string> arrResult = new List <string>();

            // List<Dictionary<string, string>> arrResult2 = new List<Dictionary<string, string>>();

            using (imrEntities entities = new imrEntities())
            {
                var conInfo = from c in entities.OTCSINFO
                              from d in entities.OTADCOPY

                              where c.CONS_ID == CONS_ID &&
                              c.CONS_COPY_CD == d.CONS_COPY_CD

                              select new
                {
                    CONS_ID         = c.CONS_ID,
                    CONS_NM         = c.CONS_NM,
                    CONS_PREV_PATH  = entities.OTCSSCRE.Where(a => a.CONS_ID == c.CONS_ID).FirstOrDefault().CONS_PREV_PATH,
                    CONS_THUMB_PATH = entities.OTCSSCRE.Where(a => a.CONS_ID == c.CONS_ID).FirstOrDefault().CONS_THUMB,
                    STAR_RATE       = (from e in entities.OTCSREVW
                                       where e.CONS_ID == c.CONS_ID &&
                                       e.USE_YN == "Y"
                                       select e).Count().ToString(),
                    CONS_PRICE        = c.CON_PRICE,
                    COPY_DOC          = entities.MTCOTPCD.Where(a => a.CO_CD_DTL == c.CONS_COPY_CD && a.USE_YN == "Y").FirstOrDefault().CO_CD_DOC,
                    CONS_SIZE         = c.CONS_SIZE,
                    CONS_DOC          = c.CONS_DOC,
                    COPY_NM           = d.COPY_NM,
                    COPY_PHONE        = d.COPY_PHONE,
                    COPY_MAIL_ADDRESS = d.COPY_MAIL,
                    COPY_HOME_PAGE    = d.COPY_HOMEPAGE,
                    CONS_TP           = entities.MTCOTPCD.Where(a => a.CO_CD_DTL == c.CONS_TP_CD && a.USE_YN == "Y").FirstOrDefault().CO_CD_DOC,
                    CONS_CAT          = entities.MTCOTPCD.Where(a => a.CO_CD_DTL == c.CONS_CT_CD && a.USE_YN == "Y").FirstOrDefault().CO_CD_DOC,
                    CONS_PATH         = c.CONS_PATH
                };

                foreach (var item in conInfo)
                {
                    //뭔가 정렬 굉장히 맘에 안드는데..
                    arrResult.Add(StaticUtils.DictionaryToXml(StaticUtils.GetDictionaryFieldValue(
                                                                  new S_CV_CTS_INFO_SIN()
                    {
                        CONS_ID           = item.CONS_ID,
                        CONS_NM           = item.CONS_NM,
                        CONS_PREV_PATH    = Convert.ToBase64String(CompressFolder(item.CONS_PREV_PATH)),
                        CONS_THUMB_PATH   = Convert.ToBase64String(ImageToByteArray(item.CONS_THUMB_PATH)),
                        STAR_RATE         = item.STAR_RATE,
                        CONS_PRICE        = item.CONS_PRICE.ToString(),
                        COPY_DOC          = item.COPY_DOC,
                        CONS_SIZE         = item.CONS_SIZE.ToString(),
                        CONS_DOC          = item.CONS_DOC,
                        COPY_NM           = item.COPY_NM,
                        COPY_PHONE        = item.COPY_PHONE,
                        COPY_MAIL_ADDRESS = item.COPY_MAIL_ADDRESS,
                        COPY_HOME_PAGE    = item.COPY_HOME_PAGE,
                        CONS_TP           = item.CONS_TP,
                        CONS_CAT          = item.CONS_CAT,
                        CONS_PATH         = item.CONS_PATH
                    }
                                                                  ))
                                  );
                }
            }

            return(StaticUtils.ListToXml(arrResult));
        }
Beispiel #2
0
        /// <summary>
        /// 컨텐츠 리뷰 리스트 조회
        /// </summary>
        /// <param name="CONS_ID"></param>
        /// <returns></returns>
        public string S_CV_CTS_REV_LIST(string CONS_ID)
        {
            List <string> arrResult = new List <string>();

            // List<Dictionary<string, string>> arrResult2 = new List<Dictionary<string, string>>();

            using (imrEntities entities = new imrEntities())
            {
                var revInfo = from b in entities.OTCSINFO
                              from c in entities.OTCSREVW

                              where b.CONS_ID == CONS_ID &&
                              b.CONS_ID == c.CONS_ID

                              select new
                {
                    USER_NO = c.USER_NO
                    ,
                    CONS_ID = b.CONS_ID
                    ,
                    REV_SEQ = c.REV_SEQ
                    ,
                    REV_DOC = c.REV_DOC
                    ,
                    REV_DTM = c.REV_DTM
                    ,
                    STAR_RATE = c.CONS_ST
                    ,
                    USER_NM = entities.OTUSINFO.Where(a => a.USER_NO == c.USER_NO && a.USE_YN == "Y").FirstOrDefault().USER_NM
                    ,
                    USER_NICK = entities.OTUSINFO.Where(a => a.USER_NO == c.USER_NO && a.USE_YN == "Y").FirstOrDefault().USER_NICK_NM
                };

                foreach (var item in revInfo)
                {
                    //뭔가 정렬 굉장히 맘에 안드는데..
                    arrResult.Add(StaticUtils.DictionaryToXml(StaticUtils.GetDictionaryFieldValue(
                                                                  new S_CV_CTS_REV_LIST()
                    {
                        USER_NO = item.USER_NO
                        ,
                        CONS_ID = item.CONS_ID
                        ,
                        REV_SEQ = item.REV_SEQ.ToString()
                        ,
                        REV_DOC = item.REV_DOC
                        ,
                        REV_DTM = item.REV_DTM.Value.ToString("yyyyMMdd HH:mm:ss")
                        ,
                        STAR_RATE = item.STAR_RATE
                        ,
                        USER_NM = item.USER_NM
                        ,
                        USER_NICK = item.USER_NICK
                    }
                                                                  ))
                                  );
                }
            }

            return(StaticUtils.ListToXml(arrResult));
        }
Beispiel #3
0
        /// <summary>
        /// 컨텐츠 리스트 조회, 검색
        /// </summary>
        /// <param name="PAGE_NO">페이징 숫자</param>
        /// <param name="SEARCH_WORD">검색 할 컨텐츠 이름, 빈값 : 전체 조회</param>
        /// <param name="CATEGORY">검색 할 컨텐츠 카테고리, 빈값 : 전체 조회</param>
        /// <returns></returns>
        public string S_MA_CTS_SRCH_LIST(string PAGE_NO, string SEARCH_WORD, string CATEGORY)
        {
            int           nPageNo   = int.Parse(PAGE_NO);
            List <string> arrResult = new List <string>();

            // 페이징 최대 조회 갯수
            int nMaxPage = 30;


            using (imrEntities entities = new imrEntities())
            {
                var downloadRate = from download in entities.OTUSCSLT
                                   from b in entities.OTCSINFO
                                   where b.CONS_NM.Contains(SEARCH_WORD) &&
                                   download.CONS_ID == b.CONS_ID
                                   select download;



                var starRate = from star in entities.OTCSREVW
                               from b in entities.OTCSINFO
                               where b.CONS_NM.Contains(SEARCH_WORD) &&
                               star.CONS_ID == b.CONS_ID
                               select star;
                int starSum = 0;
                foreach (var starItem in starRate)
                {
                    if (null != starItem.CONS_ST)
                    {
                        starSum += int.Parse(starItem.CONS_ST);
                    }
                }

                int downCount = downloadRate.Count <OTUSCSLT>();
                int starAvg   = 0;
                if (starRate.Count <OTCSREVW>() > 0)
                {
                    starAvg = starSum / starRate.Count <OTCSREVW>();
                }
                else
                {
                    starAvg = 0;
                }

                var contentsInfo = from b in entities.OTCSINFO
                                   from c in entities.OTADCOPY
                                   from master in entities.MTCOTPCD
                                   from master2 in entities.MTCOTPCD
                                   from f in entities.OTCSSCRE
                                   where b.USE_YN == "Y" &&
                                   master.USE_YN == b.USE_YN &&
                                   master.CO_CD_DTL == b.CONS_TP_CD &&
                                   master2.USE_YN == b.USE_YN &&
                                   master2.CO_CD_DTL == b.CONS_CT_CD &&
                                   b.CONS_COPY_CD == c.CONS_COPY_CD &&
                                   b.CONS_ID == f.CONS_ID &&
                                   b.CONS_CT_CD.Contains(CATEGORY) &&
                                   b.CONS_NM.Contains(SEARCH_WORD)
                                   orderby b.CONS_SEQ descending
                                   select new
                {
                    CONS_ID         = b.CONS_ID,
                    CONS_TP         = master.CO_CD_DOC,
                    CONS_CT         = master2.CO_CD_DOC,
                    CONS_DOC        = b.CONS_DOC,
                    CONS_NM         = b.CONS_NM,
                    COPY_NM         = c.COPY_NM,
                    CONS_PRICE      = b.CON_PRICE,
                    STAR_RATE       = starAvg.ToString(),
                    DOWN_RATE       = downCount.ToString(),
                    CONS_THUMB_PATH = f.CONS_THUMB
                };


                var result = contentsInfo.Skip((nPageNo - 1) * nMaxPage).Take(nMaxPage);

                foreach (var item in result)
                {
                    //뭔가 정렬 굉장히 맘에 안드는데..
                    arrResult.Add(StaticUtils.DictionaryToXml(StaticUtils.GetDictionaryFieldValue(
                                                                  new S_MA_CTS_SRCH_LIST()
                    {
                        CONS_ID         = item.CONS_ID,
                        CONS_NM         = item.CONS_NM,
                        CONS_DOC        = item.CONS_DOC,
                        CONS_CT         = item.CONS_CT,
                        CONS_PRICE      = item.CONS_PRICE.ToString(),
                        CONS_THUMB_PATH = Convert.ToBase64String(ImageToByteArray(item.CONS_THUMB_PATH)),
                        CONS_TP         = item.CONS_TP,
                        COPY_NM         = item.COPY_NM,
                        DOWN_RATE       = item.DOWN_RATE,
                        STAR_RATE       = item.STAR_RATE
                    }
                                                                  ))
                                  );
                }
            }
            //arrResult.ToArray();
            return(StaticUtils.ListToXml(arrResult));
        }